Bug: attest_debug admin check bypassed when RC_ADMIN_KEY not configured
Severity: MEDIUM
Description
node/rustchain_v2_integrated_v2.2.1_rip200.py has an admin check that can be bypassed:
ADMIN_KEY = os .getenv ("RC_ADMIN_KEY" ) # Returns None if not set
@app .route ('/ops/attest/debug' , methods = ['POST' ])
def attest_debug ():
admin_key = request .headers .get ("X-Admin-Key" , "" ) or request .headers .get ("X-API-Key" , "" )
if not hmac .compare_digest (admin_key , ADMIN_KEY or "" ): # None or "" → ""
return error
When RC_ADMIN_KEY is not set:
ADMIN_KEY = None
ADMIN_KEY or "" = ""
admin_key (no header sent) = ""
hmac.compare_digest("", "") = True — authentication bypassed!
Impact
Debug endpoint accessible without admin key when env var not set
Exposes internal config, MAC hashes, and miner enrollment data
Same class as Bug: machine_passport_api admin endpoints open when ADMIN_KEY unset #4878 , Bug: Memory API /clear endpoint lacks authentication #4880 , Bug: Webhook auth skips signature verification when WEBHOOK_SECRET not configured #4995 — default-allow auth pattern
Fix
Add explicit check for ADMIN_KEY being set:
if not ADMIN_KEY :
return jsonify ({"error" : "Admin key not configured" }), 503
if not hmac .compare_digest (admin_key , ADMIN_KEY ):
return jsonify ({"error" : "Unauthorized" }), 401
Wallet: RTC9d7caca3039130d3b26d41f7343d8f4ef4592360
Bug: attest_debug admin check bypassed when RC_ADMIN_KEY not configured
Severity: MEDIUM
Description
node/rustchain_v2_integrated_v2.2.1_rip200.pyhas an admin check that can be bypassed:When
RC_ADMIN_KEYis not set:ADMIN_KEY= NoneADMIN_KEY or ""= ""admin_key(no header sent) = ""hmac.compare_digest("", "")= True — authentication bypassed!Impact
Fix
Add explicit check for ADMIN_KEY being set:
Wallet:
RTC9d7caca3039130d3b26d41f7343d8f4ef4592360