security(core,llm): enforce unsafe_code deny and deterministic vault serialization#909
Merged
security(core,llm): enforce unsafe_code deny and deterministic vault serialization#909
Conversation
…serialization (#858) - Add [workspace.lints.rust] unsafe_code = "deny" to root Cargo.toml (#867) - Annotate unavoidable unsafe blocks (candle mmap, std::env in tests) with #[allow(unsafe_code)] - Replace HashMap with BTreeMap in AgeVaultProvider to eliminate non-deterministic JSON key ordering in vault.save() (#876)
…hanges - docs/src/reference/security.md: document workspace-level unsafe_code = "deny" and BTreeMap in AgeVaultProvider - README.md: add Security section noting workspace-wide unsafe_code deny policy - crates/zeph-core/README.md: update vault module description with BTreeMap and deterministic serialization
- Resolve modify/delete conflict: bootstrap.rs refactored into bootstrap/ module (#906) - Resolve content conflict: main.rs tests extracted to src/tests.rs (#906) - Apply #[allow(unsafe_code)] to std::env tests in bootstrap/tests.rs and src/commands/vault.rs - Add 4 BTreeMap coverage tests to vault.rs (deterministic order, save/load roundtrip, into_iter regression)
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.
Closes #858, closes #867, closes #876.
Summary
[workspace.lints.rust] unsafe_code = "deny"to rootCargo.toml; future contributors cannot introduce unsafe blocks without an explicit#[allow(unsafe_code)]#[allow(unsafe_code)]: candle mmap (VarBuilder::from_mmaped_safetensors) andstd::env::set_var/remove_varin tests (Rust 2024 edition)HashMapwithBTreeMapinAgeVaultProviderand all related private functions; serialized JSON now has deterministic key order, eliminating spurious vault file churnTest plan
cargo +nightly fmt --check— cleancargo clippy --workspace -- -D warnings— cleancargo nextest run --workspace --lib --bins— 2757 passed