Repository navigation
Description
Problem
A node holds the cap and expiry of the capability the client presents, not the terms registered on-chain. On-chain registration is write-once (PaymentPool._registerCapability returns early once authorized[poolId][signer] is set), so a second owner-signed capability for an already-registered signer is ignored at redemption.
Evidence:
- ADR 003 § Mid-stream signer cap re-check:
held_capis "the cap the node holds on the lane from admission", taken from the presented capability. crates/node/src/payment_settlement.rs:1660persistsregistered_untilfromreg.expiry, the presented capability's expiry, after a registration lands, even when the on-chain registration was a no-op.- No call site in
crates/nodereadsgetAuthorization/getAuthorizations.
Attack
The pool owner (the payer) is the attacker:
- Register signer S with a small/short capability by getting one redemption landed.
- Sign a second capability for S with a larger cap or later expiry and pull from other nodes.
- Those nodes admit and serve under the second capability's terms. On-chain, vouchers past the first capability's cap or expiry redeem to 0.
The loss scales with blob size. This is traced from code, not yet reproduced.
Fix
The node protects itself (no contract change; capability renewal stays out, signers rotate keys):
- Failing test first (e2e or settlement-level): register S with capability A, present capability B (higher cap, later expiry) for S at another node, and show the node serves past A's terms and the redemption pays 0 beyond them.
- Admission: for a (pool, signer) the node has not seen registered, read
getAuthorizationonce. If registered, holdmin(presented, on-chain)for cap and expiry; refuse if the clamped terms cannot cover a serve floor. Cache the registered terms per (pool, signer) for the process lifetime and persist them with the lane: write-once registration means they never change. - Redemption: at
payment_settlement.rs:1660, persist the expiry the chain registered (from the read or the landed registration's event), not the presentedreg.expiry. - Update ADR 003 (Capability delegation, mid-stream signer cap re-check) and ADR 005 if the admit path changes, in present-tense STE.
Open decision
Residual race: two different capabilities for a signer that is not yet registered. The first to land wins, and a node holding the other one can over-serve until its own first redemption reveals the registered terms. Options: accept this bounded window, or redeem early for a signer the node has not yet seen registered. Decide before step 2 lands.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
fix(node): clamp a presented capability to the signer's on-chain regi…