fix(swift-sdk): cap the faucet captcha's aggregate proof-of-work#4100
Conversation
Review hardening on #4049: the per-field bounds still admitted c=256, d=6 (~4.3B expected SHA-256 attempts) from a compromised or misbehaving faucet endpoint — enough to pin the device CPU until the 30 s timeout on every faucet tap. Bound the aggregate expected work (c x 16^d) at 64M attempts (~10x the live faucet's soft challenge); costlier challenges throw and route to the web-faucet fallback. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 38 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Review complete (commit 7ab9aa6) |
thepastaclaw
left a comment
There was a problem hiding this comment.
Code Review
This is a small, well-scoped hardening fix that adds an aggregate proof-of-work bound (c × 16^d ≤ 64M) after the existing per-field bounds check in TestnetFaucet.swift's solveCaptcha. Both agents verified the arithmetic against the stated live-faucet baseline (~6.6M) and worst-case (~4.3B) and confirmed the guard is correctly placed before any solver tasks spawn. Only one low-severity documentation nitpick was found; no correctness, security, or consensus-relevant issues.
Source (experiment sonnet-primary-opus-quarter-sample-20260710, cohort sonnet_primary, bucket 2, trigger new_pr, specialists none): reviewers codex/general=gpt-5.6-sol(completed); sonnet5/general=claude-sonnet-5(completed); verifier=verifier-sonnet5-4100-1783853670=claude-sonnet-5; orchestrator=openai/gpt-5.6-sol reasoning=high (orchestration-only, not a reviewer/verifier).
💬 1 nitpick(s)
…p error Review nitpick on #4100: the guard's message echoed only the raw c/d inputs; surface expectedWork and the 64M threshold so production logs show how close a drifting faucet endpoint is to the cap. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
thepastaclaw
left a comment
There was a problem hiding this comment.
Code Review
This new_push follow-up (b0f1ef1 → 7ab9aa6) makes exactly one change: the aggregate PoW-cap error message now reports the computed expectedWork value and the 64,000,000 threshold alongside c and d, directly resolving the sole prior nitpick. The guard's math and placement are unchanged and remain correct (c × 16^d ≤ 64M, checked before any solver tasks spawn). No new issues in this delta or across the cumulative PR.
Source (experiment sonnet-primary-opus-quarter-sample-20260710, cohort sonnet_primary, bucket 2, trigger new_push, specialists none): reviewers codex/general=gpt-5.6-sol(completed); sonnet5/general=claude-sonnet-5(completed); verifier=verifier-sonnet5-4100-1783854540=claude-sonnet-5; orchestrator=openai/gpt-5.6-sol reasoning=high (orchestration-only, not a reviewer/verifier).
Hardening for the
TestnetFaucetclient that merged in #4098: its per-field challenge bounds (c ≤ 256,d ≤ 6) still admit an aggregate of ~4.3B expected SHA-256 attempts, so a misbehaving or compromised same-domain faucet endpoint can pin the device's cores across 256 parallel solver tasks until the 30-second timeout on every faucet tap. Add an aggregate bound (c × 16^d ≤ 64M, ~10× the live faucet's actual soft challenge of c=100, d=4 ≈ 6.6M) so oversized challenges throw and route to the web-faucet fallback instead of burning CPU/battery.Split out of #4049 when that PR was narrowed to the
send_paymentfee fix — this commit was originally review hardening there (ad29deae05) and was deliberately parked for a standalone PR rather than dropped. One hunk, comment-documented; Swift parse-checked.Note: the faucet client's placement in the SDK package is itself under review (it may move back app-side); if #4098 is reverted, this rides along with the file.
🤖 Generated with Claude Code