fix: prevent timing attack on sophia governor admin key authentication#4048
fix: prevent timing attack on sophia governor admin key authentication#4048BossChaos wants to merge 2 commits intoScottcjn:mainfrom
Conversation
haoyousun60-create
left a comment
There was a problem hiding this comment.
Solid security fix. The implementation looks clean and addresses the vulnerability properly. LGTM! 🚀
fengqiankun6-sudo
left a comment
There was a problem hiding this comment.
PR #4048 Security Review
Summary
Prevents timing attack on sophia governor admin key authentication.
Code Assessment
- Correctness: hmac.compare_digest for constant-time comparison
- Coverage: Sophia governor admin endpoints
- Pattern: Same approach as other governor auth fixes
Severity: SECURITY
Governor admin key timing attacks.
Estimated RTC: 10-15
fengqiankun6-sudo
left a comment
There was a problem hiding this comment.
LGTM! Good security fix. ✅
|
Closing per branch-contamination audit (2026-05-09). This PR is part of a 161-PR cluster from your account where the diff carries files unrelated to the claimed fix. Specifically, 128 of 161 PRs in this batch modify This is a branching-hygiene problem, not a quality problem with the underlying fixes. The pattern means:
To get back to paid status:
I have nothing against the underlying fixes — quality has been good when scoped. But contamination at this scale is unreviewable, and Faucet Tiers policy requires clean diffs for security claims. Specifically clean PRs already approved for payout (per 2026-05-06 audit, still scope-clean as of today):
These will be paid via the admin /wallet/transfer flow. — auto-triage 2026-05-09 (this is mechanical contamination detection, not a personal judgment) |
Summary
Fixes a timing attack vulnerability in
node/sophia_governor_review_service.pywhere the admin key comparison uses Python's==operator instead of constant-time comparison.Issue
Before:
Python's
==string comparison short-circuits, enabling timing side-channel attacks to recover the admin key character by character.After:
hmac.compare_digest()runs in constant time, eliminating the timing side channel.Consistency
This fix aligns with the same pattern applied to:
node/bridge_api.py(already useshmac.compare_digest)node/lock_ledger.py(already useshmac.compare_digest)node/beacon_x402.py(fixed in PR fix: prevent timing attack on beacon admin key authentication #4045)Testing
import hmac