security: remove leaked API key + harden operator-API auth & path containment#64
Draft
ConWan30 wants to merge 1 commit into
Draft
security: remove leaked API key + harden operator-API auth & path containment#64ConWan30 wants to merge 1 commit into
ConWan30 wants to merge 1 commit into
Conversation
…ntainment Full-repo vulnerability review (report: audits/security-review-2026-06-27.md). Fixes the safe, code-level findings; deployed/FROZEN Solidity findings are reported for operator review + redeploy, not patched here. - CRITICAL: remove hardcoded QuickSilver API key fallback baked into a public repo in bridge/vapi_bridge/vapi_llm_client.py and frontend LlmChatView.jsx. Both now fail closed when the env var is unset. (Key must be ROTATED at the provider — it is in git history and has been world-readable.) - HIGH: POST /operator/evaluate-agent-action allowed an empty-key bypass under the default empty OPERATOR_API_KEY and used a timing-unsafe compare. Now fails closed (503) when unconfigured and uses hmac.compare_digest. - MEDIUM: replace five plain `!=` operator-key comparisons in transports/http.py with hmac.compare_digest (timing-oracle hardening). - MEDIUM: fix read_file path containment in operator_api/agent_misc.py — replace startswith() prefix test (admits sibling dirs like ../QorTroller-secret) with os.path.commonpath(). Verified: edited modules syntax-check clean; path-containment fix validated against in-repo/escape/sibling cases; local-host tools tests pass 5/6 (the one failure is a pre-existing checkout fixture, fails identically on origin); operator-initiative o3 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016miH3NCWew5RMRwWtfHBdA
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
Full-repo vulnerability review. This PR fixes the safe, code-level findings; deployed/FROZEN
Solidity findings and one dev-only fail-open are reported for operator review rather than
patched (changing live, PV-CI-pinned bytecode is out of the safe-change envelope for an audit
branch). Full write-up:
audits/security-review-2026-06-27.md.Fixed in this PR
sk-el_…was hardcoded as afallback in
bridge/vapi_bridge/vapi_llm_client.pyandfrontend/src/views/LlmChatView.jsxin this public repo (the frontend also shipped it to every browser). Removed both
fallbacks; the code now fails closed when the env var is unset. Working tree is
git grepclean.
POST /operator/evaluate-agent-actionusedapi_key != cfg.operator_api_key. Under the default emptyOPERATOR_API_KEY, an emptyapi_keypassed ("" != ""→ False) on a state-mutating endpoint. Now fails closed (503when unconfigured) and uses
hmac.compare_digest.!=operator-key checks intransports/http.py(PATCH /config, passport endpoints, +2) replaced withhmac.compare_digest.read_fileinoperator_api/agent_misc.pyconfined paths withstartswith(), which admits sibling dirs whose name extends the repo root(
../QorTroller-secret/…). Replaced withos.path.commonpath().History purge would require a force-push to a public repo (left to explicit operator decision);
rotation is the load-bearing mitigation.
Reported for follow-up (not changed here)
OPERATOR_API_KEYis unset (default) — recommend a startupassertion or explicit
ALLOW_UNAUTH_READSopt-in.VAPIQuickSilverCollateral.claimExcessYieldcross-operator collateral drain; permissionless
BountyMarket.aggregateSwarmReport; un-timelockedVAPIGovernanceTimelock.setCoSigner/transferOperator;PoACVerifier/TieredDeviceRegistry/ZKSepProofVerifiersignature replay (missing domain separation / caller binding). Details andfixes in the audit report.
Verification
Edited modules syntax-check clean; path-containment fix validated against in-repo /
../../../passwd/
/etc/passwd/ sibling-prefix cases;test_local_host_tools_endpoint.py5/6 (the 1 failure is apre-existing checkout fixture that fails identically on
main); operator-initiative o3 tests pass.Confirmed clean
Parameterized SQL (no injection), no
os.system/shell-injection on HTTP paths, no insecuredeserialization, no SSRF, CORS correctly scoped, no other committed secrets.
🤖 Generated with Claude Code
Generated by Claude Code