Security Audit Finding
Severity: Medium
File: node/bridge_api.py:788-792
Issue: The /api/bridge/update-external endpoint (bridge service callback) uses != for API key comparison instead of hmac.compare_digest, and is completely unauthenticated when RC_BRIDGE_API_KEY is not set.
Code:
api_key = request.headers.get("X-API-Key", "")
expected_key = os.environ.get("RC_BRIDGE_API_KEY", "")
if expected_key and api_key != expected_key: # Timing-unsafe + bypass when unset
return jsonify({"error": "Unauthorized"}), 401
Impact:
- Timing attack on API key comparison
- When
RC_BRIDGE_API_KEY is not set, endpoint is completely open
- Attacker can forge external confirmation data (fake confirmations, fake tx hashes)
- Could mark bridge transfers as "completed" without actual external confirmation
Fix:
expected_key = os.environ.get("RC_BRIDGE_API_KEY", "")
if not expected_key or not hmac.compare_digest(api_key, expected_key):
return jsonify({"error": "Unauthorized"}), 401
Wallet: RTC4642c5ee8467f61ed91b5775b0eeba984dd776ba
Security Audit Finding
Severity: Medium
File: node/bridge_api.py:788-792
Issue: The
/api/bridge/update-externalendpoint (bridge service callback) uses!=for API key comparison instead ofhmac.compare_digest, and is completely unauthenticated whenRC_BRIDGE_API_KEYis not set.Code:
Impact:
RC_BRIDGE_API_KEYis not set, endpoint is completely openFix:
Wallet: RTC4642c5ee8467f61ed91b5775b0eeba984dd776ba