fix: add HMAC authentication to Rent-a-Relic API write endpoints#4041
fix: add HMAC authentication to Rent-a-Relic API write endpoints#4041BossChaos wants to merge 2 commits intoScottcjn:mainfrom
Conversation
haoyousun60-create
left a comment
There was a problem hiding this comment.
HMAC auth for Rent-a-Relic write endpoints is overdue — good catch on the escrow manipulation risk. The implementation looks clean. Consider adding rate limiting as a follow-up for defense in depth.
fengqiankun6-sudo
left a comment
There was a problem hiding this comment.
PR #4041 Security Review
Summary
Adds HMAC authentication to Rent-a-Relic API write endpoints.
Code Assessment
- Correctness: HMAC-based auth for write ops
- Coverage: Rent-a-Relic API endpoints
- Security: Prevents unauthorized write access
Severity: SECURITY
Unauthorized write operations on Rent-a-Relic API.
Estimated RTC: 8-12
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
Adds HMAC-based authentication to Rent-a-Relic API (
tools/rent_a_relic/server.py) write endpoints to prevent unauthorized escrow manipulation and reservation spoofing.Problem
The Rent-a-Relic server has NO authentication on any endpoint. This means:
🚨 Critical: Escrow Release Without Authorization
The
POST /relic/complete/<session_id>endpoint allows anyone to:output_hash(defaults toSHA256(session_id)if omitted)This is equivalent to a financial endpoint with no access control — anyone can drain escrow.
🚨 High: Reservation Spoofing
The
POST /relic/reserveendpoint allows anyone to:agent_id(impersonation)Solution
HMAC Authentication Middleware
X-Relic-Auth: timestamp:signatureheaderhmac.compare_digest()to prevent timing attacksRELIC_API_SECRETconfigurable via environment variableProtected Endpoints
POST /relic/reservePOST /relic/complete/<session_id>GET /relic/availableGET /relic/machinesGET /relic/leaderboardGET /relic/reservation/<session_id>Authentication Protocol
Testing
py_compile)hmac