fix(security): harden SessionId path handling, secret-mask nonce, stale comment#6372
Merged
Conversation
bug-ops
enabled auto-merge (squash)
July 17, 2026 04:19
…le comment Add SessionId::try_new to reject path-traversal characters at the five HTTP session handlers that take a caller-supplied id, switch SecretMaskRegistry's nonce to an explicit OS-backed CSPRNG, and correct a stale unsafe-code-confinement comment in main.rs. None of these are exploitable today; all are defense-in-depth hardening. Also enable clippy::await_holding_lock workspace-wide after verifying zero hits across every CI feature combination, so the existing manual blocking-pattern scan gets compile-time backup. Closes #6349 Closes #6355
bug-ops
force-pushed
the
fix/6349-session-hardening
branch
from
July 17, 2026 04:24
4caa016 to
16faaf3
Compare
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
Bundles two small, non-blocked, defense-in-depth hardening fixes into a single PR:
SessionId::try_newvalidating constructor rejects/,\,.., and NUL bytes.Applied at the 5 HTTP handlers in
src/serve/handlers.rsthat take a caller-suppliedsession id (
get/delete/prompt/events/fork_session_handler), each nowreturning
400on rejection.SessionId::newis unchanged and remains theconstructor for trusted call sites (internal generation, test fixtures, already
DB/registry-validated round-trips) to avoid ~90-call-site churn for a
not-exploitable-today issue.
SecretMaskRegistry::new's per-registry nonce now usesrand::rngs::SysRng(explicit OS-backed CSPRNG) instead of
rand::random()'s default thread-localgenerator.
src/main.rscomment claiming allunsafecode is confined tothat module.
clippy::await_holding_lockworkspace-wide in[workspace.lints.clippy], after verifying zero hits across every CI featurecombination.
Notes
crates/zeph-experimentsis the only crate missing[lints] workspace = true(pre-existing, unrelated to this PR) and is therefore not covered by the new lint.
Follow-up filed as chore(arch): zeph-experiments missing [lints] workspace = true — excluded from await_holding_lock and all other workspace lints #6371.
--profile ci, nextest, rustdoc gate, doc-tests,gitleaks) run and independently re-verified by the reviewer — all green.
Closes #6349
Closes #6355
Test plan
cargo +nightly fmt --checkcargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warningscargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins(13985 passed, 0 failed)RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace)cargo test --doc -p zeph-common -p zeph-sanitizergitleaks protect --staged— cleanSessionId::try_newtests + 4 handler*_rejects_path_traversal_idtests.local/testing/playbooks/security-hardening.mdandcoverage-status.mdupdated