fix: require 16 characters for a new vault passphrase and warn when an existing one is weaker

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 21:19:19 +07:00
parent 7d7ebdc172
commit 8a025b10e4
10 changed files with 50 additions and 26 deletions

View File

@@ -148,7 +148,7 @@ async fn world() -> World {
async fn world_with(exports: Option<crate::exports::ExportGate>) -> World {
let dir = tempfile::tempdir().unwrap();
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault")
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault-passphrase")
.await
.unwrap();
if let Some(gate) = exports {

View File

@@ -34,7 +34,7 @@ fn every_registered_path_has_an_authorization_contract() {
async fn human_read_endpoints_reject_anonymous_and_outpost_tokens() {
let dir = tempfile::tempdir().unwrap();
let mut state =
crate::state::HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault")
crate::state::HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault-passphrase")
.await
.unwrap();
state.sessions = crate::admin::SessionGate::fixture(state.db.clone());
@@ -80,7 +80,7 @@ async fn human_read_endpoints_reject_anonymous_and_outpost_tokens() {
async fn local_proxy_never_enables_auth_when_credentials_are_absent() {
let dir = tempfile::tempdir().unwrap();
let mut state =
crate::state::HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault")
crate::state::HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault-passphrase")
.await
.unwrap();
state.admin = crate::admin::AdminGate {

View File

@@ -22,7 +22,7 @@ struct Harness {
async fn harness_with(configure: impl FnOnce(&mut HubState)) -> Harness {
let dir = tempfile::tempdir().unwrap();
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault")
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault-passphrase")
.await
.unwrap();
state.admin.token = Some(ADMIN.into());

View File

@@ -23,7 +23,7 @@ struct Harness {
async fn harness_with(gate: Option<ExportGate>) -> Harness {
let dir = tempfile::tempdir().unwrap();
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault")
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault-passphrase")
.await
.unwrap();
state.admin.token = Some(ADMIN.into());

View File

@@ -248,7 +248,7 @@ fn config(idp: &Idp) -> OidcConfig {
async fn harness_with(min_refresh: Duration) -> Harness {
let idp = Idp::start().await;
let dir = tempfile::tempdir().unwrap();
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault")
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault-passphrase")
.await
.unwrap();
let config = config(&idp);
@@ -788,7 +788,7 @@ async fn an_idp_outage_degrades_to_fixed_errors_and_never_a_session() {
#[tokio::test]
async fn oidc_endpoints_are_absent_when_oidc_is_not_configured() {
let dir = tempfile::tempdir().unwrap();
let state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault")
let state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault-passphrase")
.await
.unwrap();
let app = crate::api::router(state);

View File

@@ -44,7 +44,7 @@ struct Lab {
async fn lab_with(configure: impl FnOnce(&mut HubState)) -> Lab {
let dir = tempfile::tempdir().unwrap();
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault")
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault-passphrase")
.await
.unwrap();
state.admin.token = Some(ADMIN.into());

View File

@@ -1622,7 +1622,7 @@ mod tests {
#[tokio::test]
async fn unauthenticated_floods_write_one_denial_row_per_source() {
let dir = tempfile::tempdir().unwrap();
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault")
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault-passphrase")
.await
.unwrap();
state.admin.token = Some("synthetic-admin-token-of-32-chars!".into());
@@ -1661,7 +1661,7 @@ mod tests {
#[tokio::test]
async fn wrong_admin_tokens_are_throttled_per_source() {
let dir = tempfile::tempdir().unwrap();
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault")
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault-passphrase")
.await
.unwrap();
state.admin.token = Some("synthetic-admin-token-of-32-chars!".into());
@@ -1686,7 +1686,7 @@ mod tests {
#[tokio::test]
async fn reconstitute_targets_stay_inside_the_exports_directory_for_every_caller() {
let dir = tempfile::tempdir().unwrap();
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault")
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault-passphrase")
.await
.unwrap();
state.admin.token = Some("synthetic-admin-token-of-32-chars!".into());
@@ -1761,7 +1761,7 @@ mod tests {
#[tokio::test]
async fn the_api_description_is_not_served_to_anonymous_callers() {
let dir = tempfile::tempdir().unwrap();
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault")
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault-passphrase")
.await
.unwrap();
state.admin.token = Some("synthetic-admin-token-of-32-chars!".into());
@@ -1786,7 +1786,7 @@ mod tests {
#[tokio::test]
async fn responses_carry_security_headers_and_assets_cache_for_a_year() {
let dir = tempfile::tempdir().unwrap();
let state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault")
let state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault-passphrase")
.await
.unwrap();
let app = router(state);
@@ -1821,7 +1821,7 @@ mod tests {
#[tokio::test]
async fn a_failed_denial_audit_write_still_answers_401() {
let dir = tempfile::tempdir().unwrap();
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault")
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault-passphrase")
.await
.unwrap();
state.admin.token = Some("synthetic-admin-token-of-32-chars!".into());
@@ -1853,7 +1853,7 @@ mod tests {
#[tokio::test]
async fn legacy_uploads_are_owned_by_the_assigned_outpost() {
let dir = tempfile::tempdir().unwrap();
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault")
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "synthetic-vault-passphrase")
.await
.unwrap();
state.accept_plain_upload = true;
@@ -2065,7 +2065,7 @@ mod tests {
#[tokio::test]
async fn orbit_creation_validates_cron_and_direct_run_preserves_wormhole_status() {
let dir = tempfile::tempdir().unwrap();
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "test-vault")
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "test-vault-passphrase")
.await
.unwrap();
state.admin.token = Some("fixture-admin".into());
@@ -2131,7 +2131,7 @@ mod tests {
#[tokio::test]
async fn new_orbits_validate_source_access_and_keep_provider_internal() {
let dir = tempfile::tempdir().unwrap();
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "test-vault")
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "test-vault-passphrase")
.await
.unwrap();
state.admin.token = Some("fixture-admin".into());
@@ -2187,7 +2187,7 @@ mod tests {
#[tokio::test]
async fn orbit_responses_and_schema_hide_provider_config() {
let dir = tempfile::tempdir().unwrap();
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "test-vault")
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "test-vault-passphrase")
.await
.unwrap();
state.admin.token = Some("fixture-admin".into());

View File

@@ -369,7 +369,7 @@ mod tests {
#[tokio::test]
async fn operator_session_requires_csrf_and_expires_without_disabling_cli() {
let dir = tempfile::tempdir().unwrap();
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "fixture-vault")
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "fixture-vault-passphrase")
.await
.unwrap();
state.sessions = SessionGate::fixture(state.db.clone());
@@ -507,7 +507,7 @@ mod tests {
#[tokio::test]
async fn me_reports_the_caller_and_rejects_anonymous() {
let dir = tempfile::tempdir().unwrap();
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "fixture-vault")
let mut state = HubState::bootstrap(dir.path().to_str().unwrap(), "fixture-vault-passphrase")
.await
.unwrap();
state.sessions = SessionGate::fixture(state.db.clone());

View File

@@ -191,7 +191,7 @@ mod tests {
};
let mut state = crate::state::HubState::bootstrap(
dir.path().join("hub").to_str().unwrap(),
"synthetic-vault",
"synthetic-vault-passphrase",
)
.await
.unwrap();