fix(security): enforce Ed25519 verification and hide escrow_secret (#8179) - #8183
fix(security): enforce Ed25519 verification and hide escrow_secret (#8179)#8183shiyaam-s07 wants to merge 4 commits into
Conversation
|
Welcome to RustChain! Thanks for your first pull request. Before we review, please make sure:
Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150) A maintainer will review your PR soon. Thanks for contributing! |
|
Submitted fix in PR #8183 with Ed25519 signature verification and payload redaction for review! |
FlintLeng
left a comment
There was a problem hiding this comment.
PR Review: Airdrop Token Ownership + GPU Escrow Ed25519 Signature
Reviewed on: 2026-08-07
Summary
Two distinct security fixes:
claim_airdropnow verifies GitHub token ownership — confirms the provided token belongs to the claimed username before processing the airdropcreate_escrowin GPU render protocol now requires Ed25519 signature over a message, authenticating thefrom_wallet;escrow_secretis stripped from API responses
Fix 1: Airdrop Token Verification ✅
The vulnerability: Without this check, anyone could submit a claim with a legitimate GitHub username (e.g., a famous contributor) and receive their airdrop allocation if the username happened to be in the snapshot. No ownership proof was required.
The fix is correct: GET /user with the provided token returns the authenticated user's login. The response is compared case-insensitively (casefold()) against the claimed github_username. Mismatch → claim rejected. This binds the token to the claimed identity.
Edge cases handled: Network failures (requests.RequestException) → fail closed (reject claim), not open. HTTP non-200 → reject. This is the right behaviour for a security-sensitive flow.
Fix 2: GPU Escrow Ed25519 Signature ✅
The vulnerability: create_escrow accepted a from_wallet address without cryptographic proof that the caller controls the corresponding private key. An attacker who knew a valid wallet address could create an escrow draining that wallet.
The fix is correct: Requires signature and message fields. Ed25519PublicKey.from_public_bytes(from_wallet).verify(sig_bytes, message.encode()) — standard Ed25519 verification using the wallet address as the public key. The attacker needs both the private key and a message signed with it.
Escrow secret stripped from response: result.pop("escrow_secret", None) prevents the secret from leaking in the API response. Clean.
Minor note: The Ed25519 key is derived from the wallet address bytes — bytes.fromhex(from_wallet). If from_wallet is not a valid Ed25519 public key (wrong length, invalid curve point), from_public_bytes raises ValueError, caught by the generic except Exception. This is acceptable as it rejects invalid keys, but a more specific catch could log differently.
Wallet: RTC019e78d600fb3131c29d7ba80aba8fe644be426e
✅ LGTM — two clean, targeted security fixes that close real attack surface.
|
"Thanks for the review @FlintLeng! Here is my actual RTC wallet address for the bounty: RTC834f28bba15768582b5d619e3f1f2d5f50d481b3" |
Fixes #8179
🛡️ Security Vulnerability & Fix Overview
This PR resolves a high-severity security issue where GPU escrow creation endpoints (
/render/escrow) accepted arbitraryfrom_walletaddress inputs without validating ownership, while also leaking internalescrow_secretdata back in the API payload.Ed25519 Wallet Ownership Verification:
signatureandmessage(nonce/timestamp) parameters from incoming payload requests innode/gpu_render_protocol.py.cryptographylibrary (ed25519.Ed25519PublicKey) to guarantee that the caller strictly controls the correspondingfrom_walletpublic key.401 Unauthorizedresponse if signatures are missing, malformed, or mathematically mismatched.Data Leakage Redaction:
escrow_secretfrom the returned endpoint dictionary payload insidecreate_escrow, preventing unauthorized exposure of sensitive state secrets in API responses.🧪 Automated Testing & Verification
tests/test_gpu_render_protocol.py):401.401.escrow_secretis completely absent from API response outputs.node/airdrop_v2.pyto achieve a 100% test pass rate across the workspace viapytest.📋 Checklist