Repository navigation
feat: harden control plane security, prefix-stable tool ordering, and async credential locking - #203
Open
parth2024-tech wants to merge 3 commits into
Open
parth2024-tech wants to merge 3 commits into
parth2024-tech wants to merge 3 commits into
Conversation
…and fix compaction
…stence, and secret scrubbing
…ced compaction persistence
This branch has not been deployed
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
This PR delivers a comprehensive hardening pass covering local control-plane security, prefix cache stability for dynamic deferred tools, cross-process credential safety, and non-blocking session compaction persistence.
Key Changes
Control Plane & Request Guardrails:
subtle::ConstantTimeEq) across all control and capture routes.Origin,Sec-Fetch-Site: cross-site) and restrictHostheader to loopback addresses to prevent DNS rebinding.Content-Type: application/jsonon mutation endpoints to block CORS-exempt browser simple-requests.Prefix Cache Stability for Dynamic Tools (Codex Responses Lite & Grok):
input[0]AdditionalToolsis now frozen strictly to base non-deferred tools (defer_loading != true).tool_referenceintool_resultcontent) are injected as discreteAdditionalToolsitems at the turn boundary where they resolve, preventing token-stream mutation of historical conversation turns and preserving 100% of KV prefix caching.sort_tools_stable_prefix.(?=...),(?!...), etc.) from tool schemas to prevent upstream regex validator failures.Non-Blocking Async File Locking & Double-Checked Auth:
FileLock::try_acquire(LOCK_EX | LOCK_NB) andacquire_lock_asyncwith cooperative async polling sleeps andspawn_blockingfallback so Tokio worker threads are never blocked by synchronous OS syscalls during upstream OAuth handshakes.load_auth()inside the locked section to prevent race conditions during concurrent single-use refresh token rotations.Compaction & Secret Hygiene:
(session_id, lineage)to prevent subagent turns from clobbering parent compaction states.sessions.jsonwith an atomic dirty flag and background 5-second flusher instead of synchronous disk writes in live stream handlers.sk-ant-***,sk-***,ghp_***,AKIA***,PRIVATE KEY) in captured request logs.Validation
cargo check: Clean (0 errors).cargo clippy --all-targets -- -D warnings: Clean (0 warnings).cargo test --lib: 982 passed (including new prefix-stability and secret scrubbing tests).