fix: use constant-time x402 admin key checks#4198
Merged
Scottcjn merged 1 commit intoScottcjn:mainfrom May 10, 2026
Merged
Conversation
Owner
|
💰 PAID — 10 RTC pending, will confirm in 24h.
What workedWelcome @cerredz! Both x402 admin gates switch to constant-time compare cleanly. Tests pin the unauthorized path; for next time, also add a test that proves authorized requests still work end-to-end (round-tripping a valid key through the full handler). — auto-triage 2026-05-10 |
Contributor
Author
|
Thanks for the triage and payout note. I pushed a follow-up commit (
Validation rerun:
|
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
Fixes #4197.
This hardens the x402 admin wallet-linking routes by replacing regular admin-key string inequality with
hmac.compare_digest:POST/PATCH /wallet/link-coinbaseinnode/rustchain_x402.pyPOST /api/agents/<agent_id>/walletinnode/beacon_x402.pyThe test coverage now checks both rejected invalid-admin-key requests and accepted valid-admin-key requests that round-trip through the Flask handlers and write the expected wallet rows.
Proof
ruffis not installed in my local environment, so I could not run the repo lint command locally.Bounty
Bug report/fix submitted for consideration under #305. Payout details can be provided privately if accepted.