Skip to content

Fix weak and inconsistent secret default validation#467

Open
ChristianPavilonis wants to merge 1 commit intomainfrom
fix/secret-default-validation
Open

Fix weak and inconsistent secret default validation#467
ChristianPavilonis wants to merge 1 commit intomainfrom
fix/secret-default-validation

Conversation

@ChristianPavilonis
Copy link
Collaborator

Summary

  • Reject all known placeholder values for synthetic.secret_key ("secret-key", "secret_key", "trusted-server") and publisher.proxy_secret ("change-me-proxy-secret") at runtime startup so misconfigured deployments fail fast.
  • Consolidate validation into predicate methods (is_placeholder_secret_key, is_placeholder_proxy_secret) with explicit placeholder lists, replacing the inconsistent checks that missed the actual TOML defaults.
  • Improve error reporting by renaming InsecureSecretKey to InsecureDefault { field } so the error message identifies which secret triggered rejection.

Changes

File Change
crates/common/src/error.rs Renamed InsecureSecretKeyInsecureDefault { field: String } with a descriptive display message
crates/common/src/settings.rs Added PROXY_SECRET_PLACEHOLDERS const + is_placeholder_proxy_secret() on Publisher; replaced validate_secret_key() with SECRET_KEY_PLACEHOLDERS const + is_placeholder_secret_key() on Synthetic; added 4 unit tests
crates/common/src/settings_data.rs Replaced single == "secret-key" check with calls to both predicates; returns field-specific InsecureDefault errors; updated test to assert placeholder rejection
crates/common/build.rs Added comment explaining why placeholder rejection is intentionally skipped at build time

Closes

Closes #406

Test plan

  • cargo test --workspace
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check

Checklist

  • Changes follow CLAUDE.md conventions
  • No unwrap() in production code — use expect("should ...")
  • Uses tracing macros (not println!)
  • New code has tests
  • No secrets or credentials committed

Reject all known placeholder values for synthetic.secret_key and
publisher.proxy_secret at runtime startup so deployments using
default secrets fail fast instead of running with predictable
cryptographic keys.
@ChristianPavilonis ChristianPavilonis self-assigned this Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Weak/inconsistent secret default validation

1 participant