Repository navigation
Conversation
bitflow-arb-receiver / -v2/-v3/-v4 were found vulnerable under F-10 (no contract-caller check, repaid to a caller-supplied `core` instead of a hardcoded one) and removed from flashstack-stx-core's approved-receiver list. Removal stopped new loans reaching them, but never addressed the actual ask: a v3-style hardened rewrite, so Bitflow arb stays usable. v5 ports the already-proven alex-arb-receiver-v5 pattern onto Bitflow's real swap mechanics (confirmed live against stableswap-stx-ststx-v-1-2's actual interface, not assumed): contract-caller == FLASH-CORE gate, hardcoded repay target, required pre-set slippage floor, max-fee-bp guard, min-profit floor, two-step ownership, exact-output capture from the swap's own return value rather than a balance read. 6 tests, mutation-verified (the caller-gate test was confirmed to actually fail when the gate is removed, not just trivially pass). Not deployed or approved on any core yet. FINDINGS_REGISTER.md intentionally untouched here -- this branch is off main, which doesn't have F-10 in it yet (still on the unmerged f10-remove-vulnerable-receivers branch); reconciling that entry is left for whichever branch merges second, to avoid an ID collision. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
2 tasks done
8 of 10 tasks
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bitflow-arb-receiver/-v2/-v3/-v4were all found vulnerable under F-10 (fix(F-10): remove 3 unrestricted-callback receivers from flashstack-stx-core #95): nocontract-callercheck onexecute-stx-flash, repaid to a caller-suppliedcoreinstead of a hardcoded one. All removed fromflashstack-stx-core's approved-receiver list.bitflow-arb-receiver-v5.clarports the already-provenalex-arb-receiver-v5hardening pattern onto Bitflow's real swap mechanics, confirmed live againststableswap-stx-ststx-v-1-2's actual deployed interface rather than assumed:contract-caller == FLASH-COREgate (+ defense-in-depth assert on thecoreparameter itself), hardcoded repay target, a required pre-set slippage floor (auto-reset after each use), amax-fee-bpguard against a fee-increase race condition, amin-profitfloor, two-step ownership transfer, and exact-output capture from the swap's own return value rather than a post-swap balance read (closing the same residual-token-pollution gap ALEX v5's [M-1] fixed — confirmed Bitflow'sswap-x-for-y/swap-y-for-xboth return the output amount directly, so this ports cleanly).Not included
FINDINGS_REGISTER.mdintentionally untouched — this branch is offmain, which doesn't have F-10 in it yet (still on the unmergedf10-remove-vulnerable-receiversbranch). Adding an entry here risked an ID collision once both merge. Reconciling the register is left for whichever branch merges second.Test plan
clarinet check— clean, zero errors (one real bug caught along the way: adefine-constant-bound principal silently fails Clarinet's read-only purity check inside anas-contract-wrapped call where an inline literal principal passes — same semantics, different static-analysis outcome; documented inline in the contract)tests/bitflow-arb-receiver-v5-security.test.ts— 6/6 passing: direct-call rejection, rejection even via this project's own localflashstack-stx-corecopy (proves the gate checks the real mainnet address, not.flashstack-stx-coresugar), all pre-flight guards, owner-gating on every admin function, zero-amount rejection on rescues, two-step ownership transfer,get-settingsdefaultscontract-caller == FLASH-COREassert was confirmed to flip the caller-gate test red (falls through to the next guard,ERR-MIN-STSTX-UNSET) rather than the test trivially passing regardless🤖 Generated with Claude Code