Move secret validation to compile-time for release builds#525
Closed
ChristianPavilonis wants to merge 1 commit into
Closed
Move secret validation to compile-time for release builds#525ChristianPavilonis wants to merge 1 commit into
ChristianPavilonis wants to merge 1 commit into
Conversation
Shift the reject_placeholder_secrets() check from an unconditional runtime gate to a compile-time gate in build.rs for release builds, while keeping a cfg-guarded runtime safety net. Debug/test builds now pass through with the default trusted-server.toml placeholders, so developers no longer need env var overrides for local iteration.
Collaborator
Author
|
Closing, just reverting the check. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
build.rsthat only fires for release builds, socargo build --releasefails fast if secrets have not been overridden.reject_placeholder_secrets()call with#[cfg(not(debug_assertions))]so debug/test builds work with the defaulttrusted-server.tomlplaceholders without needing env var overrides.Changes
crates/common/build.rsreject_placeholder_secrets()call after merging settings (checksPROFILE == "release")crates/common/src/settings_data.rsreject_placeholder_secrets()with#[cfg(not(debug_assertions))]; update test to expect success in debug modecrates/common/src/settings.rsvalidate_secret_keyto describe new compile-time + runtime behaviorCloses
Closes #524
Test plan
cargo test --workspace— 669 passedcargo clippy --all-targets --all-features -- -D warningscargo fmt --all -- --checkcd crates/js/lib && npx vitest run— 272 passedcd crates/js/lib && npm run formatcd docs && npm run formatcargo build --bin trusted-server-fastly --release --target wasm32-wasip1(with secret env vars set)Checklist
unwrap()in production code — useexpect("should ...")tracingmacros (notprintln!)