Verify #378: Frontend trust boundaries, build guards, and expert mode #906
No reviewers
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic!906
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "verify/issue-378-frontend-trust-boundaries"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements the #378 remediation bundle for parent #376 (H-04, H-05, M-07, M-08, M-09, M-10, M-15): off-chain trust documentation, production build guards, narrowed CSP
connect-src, protocol-page contract audit surface, token logo host allowlist, and expert-mode typed confirmation.Acceptance checklist
docs/security-model.md§ Off-chain trust;docs/frontend.md§ Off-chain deploy checklist;docs/runbooks/launch-checklist.mdPhase 4vite buildfails on dev mnemonic outside development; fails on missing WC project ID in productionVITE_DEV_MNEMONIC=test-seed npm run build -- --mode staging→ error;npm run buildwithout WC ID → error;src/viteConfig.build.test.tshttps:connect-src in production); documented dev exceptiondist/index.htmlconnect-src lists explicit hosts only;render.yamlupdated;docs/frontend.md§ CSPProtocolPage.tsxdata-testid="protocol-core-contracts";ProtocolPage.test.tsx; docs note optional LCD sanitytokenLogoAllowlist.ts+TokenLogo.tsx;docs/CG_CMC_COMPLIANCE.md§ Token metadata human reviewExpertModeModal.tsxphraseenable expert mode;ExpertModeModal.test.tsx;swapRouteSlippage.tsstill 30% blockmake test-frontend— 166 files, 994 testsVITE_WC_PROJECT_ID=verify-test-wc-id npm run build;rgondist/— no2ce7811b…or mnemonic stringsTokenLogo.test.tsx+tokenLogoAllowlist.test.tsExpertModeModal.test.tsx— enable button disabled until phrase matchesmake devbrowser walkthroughmake has-localterraexit 2). UI flows covered bySwapPage.test.tsx(route summary, expert mode),ProtocolPage.test.tsxTest plan
Follow-ups
index.htmltheme bootstrap inline scripts into bundled modules to allow removingscript-src 'unsafe-inline'in production CSP.make devbrowser QA aftermake setup-cloud-localterraon a VM with Chrome.Security review — MR !906
Commit reviewed:
525056e0ffb110a9f79bd799f8063007fbfb9c8eScope: Frontend trust-boundary hardening for #378 — production build guards (
VITE_DEV_MNEMONIC,VITE_WC_PROJECT_ID), narrowed production CSPconnect-src, token logo host allowlist, expert-mode typed confirmation, protocol-page contract audit surface, and related docs/runbook updates.Method: Full MR diff review with attacker-input tracing on logo URLs (indexer
logo_url→TokenLogo), build-time env injection paths, CSP enforcement (VitetransformIndexHtml+render.yaml), WalletConnect project ID resolution, and expert-mode enablement flow. Cross-checked prior MR discussion threads (none).Outcome:
FINDINGS: 0medium+No new medium, high, or critical vulnerabilities identified on this diff. Inline threads: none.
Areas reviewed (no exploitable path found)
tokenLogoAllowlist.ts+TokenLogo.tsxlogo_urlis hostname-allowlisted (https:+ exact host match); untrusted hosts fall back to blockies. No subdomain-suffix bypass (gitlab.com.evil.comrejected);www.gitlab.comblocked (registry uses baregitlab.com). Residual logo-phishing on UGC hosts (e.g. public GitLab repos) is operator-trust / human-review scope documented in MR — narrower than pre-MR arbitraryhttps:logos.vite.config.tsbuild guardsVITE_DEV_MNEMONICblocked for staging/production; escape hatch requiresVITE_ALLOW_DEV_MNEMONIC=local-only+VITE_NETWORK=local+ non-staging/non-production mode — deploy-time misconfig only, not remotely triggerable.wallet.tsresolveWcProjectId()import.meta.env.DEV; production builds without ID fail at build (vite.config) and runtime.cspConnectSrc.ts/render.yamlconnect-srcnarrowed from broadhttps:; env-derived LCD/RPC/indexer origins parsed viaURLAPI. Dual CSP (meta + Render header) is restrictive intersection — operational indexer-host alignment, not attacker leverage.ExpertModeModal.tsxlocalStoragetoggle remains user-controlled (pre-existing). Not a new authz boundary.ProtocolPage.tsxVITE_*addresses rendered via React text nodes /AddressRow— no HTML injection sink.Label:
block:securitynot applied (zero medium+ findings).added 11 commits
main4e06ee36- Merge main into verify/issue-378-frontend-trust-boundaries.Compare with previous version
Resolved merge conflicts with
main(commit4e06ee36).Approach: Merged
maininto the source branch and aligned overlapping #378 code with main's canonical implementation (vite CSP/build guards,ENABLE EXPERT MODEphrase, token logo allowlist naming).Kept from this MR:
ProtocolPage.test.tsx(updated forprotocol-deploy-addressestestids), CG/CMC token metadata human-review section, and verification test coverage.Removed as superseded:
cspConnectSrc.tsand duplicate__tests__/files (main uses inline CSP invite.config.ts).Sanity:
make test-frontend— 166 files, 999 tests passed.changed the description
changed the description
Security review — MR !906
Commit reviewed:
4e06ee36886598e8b9bfd74f498c1dd4c359272dScope: Post-merge-conflict diff vs
main(base_sha9f1d4cb2→head_sha4e06ee36): operator token-metadata human-review documentation (docs/CG_CMC_COMPLIANCE.md) andProtocolPage.test.tsxregression coverage for factory/router audit test IDs. Runtime #378 hardening (build guards, CSP, logo allowlist, expert-mode phrase) is already onmainand is out of this diff.Method: Diff-only review with attacker-input tracing on changed files. Cross-checked prior security review on
525056e0— that broader bundle assessment still holds onmain; this pass re-validates only what this MR still adds.Outcome:
FINDINGS: 0medium+Security review: no medium+ findings on this diff. Inline threads: none.
Areas reviewed (no exploitable path in diff)
docs/CG_CMC_COMPLIANCE.md§ Token metadata human reviewProtocolPage.test.tsxLabel:
block:securitynot applied (zero medium+ findings).mentioned in commit
171aa60b58