fix: harden buy page, cache, headers, and create recipients after audit - #64
Merged
Conversation
Follow-ups from the security audit that don't change contract behavior: - buy page verifies ?offering= against the factory's OfferingCreated scan before rendering anything that approves or pays - a listing-cache item the dedupe key can't read now triggers a full rescan instead of throwing on every load - vercel.json ships a CSP (frame-ancestors 'none', self scripts, Base RPC, Alchemy, Google Fonts, WalletConnect hosts), Referrer-Policy, nosniff - /create checks the proceeds address and every holder for ERC-1155 receiver support so a hook-less contract fails in the form, not at mint or close - contracts.md: revenue goes to the token, never payoutSplit, and why
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
r0ohafza
marked this pull request as ready for review
August 24, 2026 22:30
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.
Changed user flows
?offering=address is checked against the factory'sOfferingCreatedscan before the page renders. Unknown address → "Unknown offering" notice with no approve/pay UI; scan failure → "Could not verify offering, refresh to retry"; otherwise unchanged. First visit in a fresh browser waits on the same listing scan/already performs.IERC1155Receiver). A contract without the hook flags the field ("This contract can't receive ERC-1155 units. Use a wallet address or a Safe.") and blocks the deploy; EOAs and Safes pass. No wallet prompt is issued before the check.dedupeKeythrow falls back to a full rescan, matching the documented corrupt-cache behavior.vercel.jsonnow sends a Content-Security-Policy (frame-ancestors 'none', self scripts, Google Fonts, Alchemy, Base RPC, WalletConnect relay/verify/api hosts),Referrer-Policy,X-Content-Type-Options,X-Frame-Options. Needs a preview-deploy console check; local dev/preview don't apply Vercel headers.contracts.mdstates that revenue must go to the token, neverpayoutSplit, and explains the placeholder-recipient window during Funding.Test coverage changed
tests/pact-flow.spec.tspublic buy, private claim, and failed-round refund flows now pass through the gate against the anvil factory (existing specs, unchanged).cachedScan rescans when a cached item has no dedupe keyinsrc/lib/chain/offerings.test.ts.Validation
npm run typechecknpm testnpm run test:contractsnpm run test:e2eFull
npm run validateresult:typecheck, lint, unit (82), forge (87), e2e (11) all pass.
format:checkwas run on the touched files only; the untracked audit scratch directory in the working tree is not part of this branch.E2E impact override:
buy-app.tsxandcreate-app.tsxchanged without spec changes. The buy gate is on the path of every existing buy/claim/refund spec, which all pass; the create receiver check is a pre-deploy read that the existing create spec exercises on the EOA path. Contract-recipient rejection needs a manual check.