Skip to content

fix(proxy): recognise any auth scheme, not just Bearer - #220

Merged
ralyodio merged 1 commit into
masterfrom
fix-auth-scheme
Aug 1, 2026
Merged

fix(proxy): recognise any auth scheme, not just Bearer#220
ralyodio merged 1 commit into
masterfrom
fix-auth-scheme

Conversation

@ralyodio

@ralyodio ralyodio commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

The gap

#212 gave credentialed callers their own rate-limit bucket, keyed off Authorization: Bearer … or X-API-Key.

The wallet extension uses neither. It signs with:

Authorization: Wallet <walletId>:<signature>:<timestamp>

(packages/extension/src/core/api.ts:176)

So every request the extension made fell through to the anonymous 60/min per-IP bucket — the exact ceiling #212 was written to remove, still standing for the one caller that needed it most.

A bulk payout spends one prepare-tx plus one broadcast per payment, so 60 calls is roughly 30 payments. Past that the run fails with Request failed with status 429, which is what the payer is still seeing mid-batch.

The fix

Match any auth scheme and take the credential that follows, rather than hardcoding Bearer. That covers Wallet, Bearer, and anything added later without another round of this.

A bare Authorization: Bearer with no token still returns null, so junk headers stay on the anonymous bucket — there's an existing test pinning that, and it still passes.

Tests

src/proxy.test.ts — 13 passed. New:

  • parses the extension's exact Wallet <id>:<sig>:<ts> shape
  • two wallets on the same scheme get distinct buckets
  • a Wallet-scheme caller clears 200 requests to /api/web-wallet/:id/broadcast, where it previously stopped at 60

Fourth in the chain: #211 (web-wallet caps), #212 (credentialed bucket), #213 (provider hang), this.

🤖 Generated with Claude Code

The credentialed rate-limit bucket added in #212 only matched
`Authorization: Bearer`. The wallet extension signs its requests with
`Authorization: Wallet <walletId>:<signature>:<timestamp>`, so every
call it made fell through to the anonymous 60/min per-IP bucket.

A bulk payout spends one prepare-tx plus one broadcast per payment, so
that ceiling is reached around the thirtieth payment and the rest fail
with 429 — the same wall #212 was meant to remove, still standing for
the one caller that needed it most.

Match any scheme and take the credential that follows. A bare
`Authorization: Bearer` with no token still yields null, so the
anonymous bucket keeps covering junk headers.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

@ralyodio
ralyodio merged commit e189205 into master Aug 1, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant