fix: fail closed for RWA and widget token restrictions#7621
fix: fail closed for RWA and widget token restrictions#7621fairlighteth wants to merge 8 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
Deploying explorer-dev with
|
| Latest commit: |
894f645
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://22fd3e65.explorer-dev-dxz.pages.dev |
| Branch Preview URL: | https://deepsec-medium-05-rwa-geoblo.explorer-dev-dxz.pages.dev |
Deploying swap-dev with
|
| Latest commit: |
894f645
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a894e07f.swap-dev-5u6.pages.dev |
| Branch Preview URL: | https://deepsec-medium-05-rwa-geoblo.swap-dev-5u6.pages.dev |
- block trade and import flows until RWA checks are ready - hide restricted token lists until geo or consent checks pass - enforce widget-selected token scopes for favorites and bridge search
- reset the token list cache when geo checks switch from curated-only mode back to the full source set - cover the invalidation rule with a focused unit test
✅ AI Review (Codex GPT-5, worked 2m): no new non-duplicate findingsReview completed. I found no new non-duplicate comments worth posting. Review scope and related contextRelated context checked:
|
- filter favorite chips against the current selectable token set - cover widget-scoped favorite leakage in selector hook tests
- preserve virtual widget lists while curated-only mode is active - cover the curated widget token path with a regression test
|
- keep later geoblock flag changes authoritative over old requests - cover the pending geo request race with a regression test
✅ AI Review (Codex GPT-5, worked 1m): no new non-duplicate findingsReview completed. I found no new non-duplicate comments worth posting. Review scope and related contextRelated context checked:
|
Summary
Addresses the MEDIUM RWA/geoblock and widget token-scope findings in
cowswap-frontend.This PR makes the restriction model fail closed when prerequisites are missing or still loading:
To Test
pnpm exec jest --config apps/cowswap-frontend/jest.config.mjs --runInBand --runTestsByPath apps/cowswap-frontend/src/modules/tokensList/state/tokensToSelectAtom.test.ts apps/cowswap-frontend/src/modules/tokensList/hooks/useTokensToSelect.test.ts apps/cowswap-frontend/src/modules/tradeFormValidation/services/validateTradeForm.test.tspasses.pnpm exec jest --config libs/tokens/jest.config.ts --runInBand --runTestsByPath libs/tokens/src/updaters/TokensListsUpdater/curatedMode.test.tspasses.pnpm exec tsc --noEmit -p apps/cowswap-frontend/tsconfig.app.jsonpasses.Background
These findings were mostly fail-open cases.
The goal here is not to broaden restrictions, but to make sure missing geo data, partially loaded token metadata, or widget-mode fallbacks do not silently turn a blocked state into an allowed one.