fix: require admin auth on beacon API GET endpoints#6318
Open
BossChaos wants to merge 4 commits into
Open
Conversation
- /wallet/balances/all: exposes all miner RTC balances + rankings - /lottery/eligibility: exposes miner lottery eligibility + epoch info - /consensus/round_robin_status: exposes all attested miners + multipliers Fixes Algora bounty Scottcjn#73 (Scottcjn/Rustchain)
- GET /sophia/status/<miner_id>: exposes miner verdict, device fingerprint, fingerprint score - GET /sophia/status: exposes ALL miners' verdicts, device fingerprints, scores Fixes Algora bounty Scottcjn#73 (Scottcjn/Rustchain)
- GET /api/airdrop/claim/<claim_id>: exposes github_username, wallet_address, and airdrop tier Fixes Algora bounty Scottcjn#73 (Scottcjn/Rustchain)
- GET /api/agents: exposes all relay agents with pubkeys and coinbase addresses - GET /api/agent/<agent_id>: exposes single agent details - GET /api/contracts: exposes all beacon contracts and agent IDs - GET /api/bounties: exposes all beacon bounties with reward amounts - GET /api/reputation: exposes all agent scores and RTC earnings - GET /api/reputation/<agent_id>: exposes single agent reputation Fixes Algora bounty Scottcjn#73 (Scottcjn/Rustchain)
CyberNomad2000
suggested changes
May 25, 2026
Contributor
CyberNomad2000
left a comment
There was a problem hiding this comment.
Requesting changes because the newly protected RIP-200 rewards GET routes fail once the admin key path is actually exercised.
hmac is imported inside settle_rewards(), so it is local to that POST handler. The new GET handlers added in this PR call hmac.compare_digest(...) from get_balance, get_all_balances, check_eligibility, and round_robin_status, but there is no module-level hmac binding. With RC_ADMIN_KEY configured and a valid X-Admin-Key, /wallet/balance raises NameError before it can return the balance.
Focused verification on this PR head:
python -m py_compile node/rewards_implementation_rip200.pypasses.- A Flask
test_client()request to/wallet/balance?miner_id=miner1withRC_ADMIN_KEY=secretandX-Admin-Key: secretreturns HTTP 500 withNameError: name 'hmac' is not definedatnode/rewards_implementation_rip200.py:318.
Moving import hmac to module scope, or importing it inside each newly changed GET handler, should fix the regression.
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
Fixed 6 unauthenticated GET endpoints in
beacon_api.py(Beacon Atlas API) that exposed sensitive relay agent, contract, bounty, and reputation data.Vulnerabilities Fixed
GET /api/agentsGET /api/agent/<agent_id>GET /api/contractsGET /api/bountiesGET /api/reputationGET /api/reputation/<agent_id>Fix
Added
X-Admin-Keyheader validation usinghmac.compare_digest(timing-safe) withRC_ADMIN_KEYenv var. Returns401 Unauthorizedfor invalid/missing keys,503if env var not configured.Bounty