sec: reject production VITE_DEV_MODE=true (FE-01) #695
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#695
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Gate
P1 supply-chain / Chain B. Internal audit
INTERNAL_GROK46_1787908099FE-01 (still active fromINTERNAL_KIMIK3_1785897304FE-01 / F389-08). Productionvite buildalready rejects an inlined mnemonic (#118 / #378) and requiresVITE_WC_PROJECT_ID. It does not rejectVITE_DEV_MODE=true. Combined with GitLabonly_allow_merge_if_pipeline_succeeds=false(sister ticket), a Coolify/env mistake can ship Simulated Wallet chrome ondex.cl8y.com.Related: #118, #378. Do not reopen mnemonic or WC-id guards.
Current codebase
frontend-dapp/src/utils/constants.ts:DEV_MODE = import.meta.env.VITE_DEV_MODE === 'true'frontend-dapp/src/services/terraclassic/devWallet.ts: Simulated Wallet / local sign only whenVITE_DEV_MODE=trueand mnemonic presentfrontend-dapp/src/viteConfig.build.test.ts: covers mnemonic + WC id, notVITE_DEV_MODEVITE_DEV_MODE=trueon purpose (vitest.config.ts,playwright.config.ts)vite build/ Coolify production usesmode=productionA production bundle with
VITE_DEV_MODE=trueand no mnemonic does not leak a seed, but it can show Simulated Wallet UI, local-sign paths, and “dev network” affordances. That is a phishing / wrong-network surface if the env flag is set in Coolify.Why the new implementation is needed
Build guards exist so production cannot depend on operator memory. Mnemonic is already fail-closed.
VITE_DEV_MODEis the remaining flag that turns on the entire dev-wallet feature gate. One-line reject closes FE-01 without changing LocalTerra / Playwright.Constraints / guardrails
vite/vitest/playwrightindevelopmentorlocalterra. Those must keepVITE_DEV_MODE=true.VITE_ALLOW_DEV_MNEMONIC=local-onlyas permission to shipVITE_DEV_MODEin production mode. Production reject is unconditional.vite build --mode stagingmay keepVITE_DEV_MODEif needed for QA Simulated Wallet — document the choice. Recommend: rejectVITE_DEV_MODE=trueformode === 'production'only (same pattern as WC id)..env.production.Relevant files
frontend-dapp/vite.config.tsassertBuildEnvGuardsfrontend-dapp/src/viteConfig.build.test.tsfrontend-dapp/src/utils/constants.tsDEV_MODEfrontend-dapp/src/services/terraclassic/devWallet.tsfrontend-dapp/vitest.config.tsVITE_DEV_MODE=truefrontend-dapp/playwright.config.tsVITE_DEV_MODE=truedocs/frontend.mdRecommended direction
In
assertBuildEnvGuards, after the WC-id check:mode === 'production' && env.VITE_DEV_MODE === 'true'→ throw a clear error (same style as mnemonic / WC).mode=development/ vitest env still loads; staging without the flag still builds.docs/frontend.md§ trust boundaries / Simulated Wallet.make verify-issue-<N>: grep the throw + the new test name.Acceptance criteria
vite build --mode productionwithVITE_DEV_MODE=truefails closed (no bundle).vite build --mode productionwith flag unset still succeeds (existing WC id required).make test-frontend/ Playwright e2e still run withVITE_DEV_MODE=true.viteConfig.build.test.tsasserts the production reject; no mnemonic logged.make verify-issue-<N>+ Makefile / AGENTS.md frontend table.Test plan — happy / bad path
loadConfigFromFile({ command: 'build', mode: 'production' })+VITE_DEV_MODE=true/VITE_DEV_MODE/false{ command: 'build', mode: 'development' }+ flag true{ command: 'serve', mode: 'production' }command !== 'build') — unchangedmake test-frontend.env.developmentsets both flagsTest plan — attack / abuse vectors
VITE_DEV_MODE=trueon production buildVITE_DEV_MODE=truein.env.productiononmaintest-frontend-build/ this guard fails the pipelineimport.meta.envdefault'true'only if env set — guard reads the same env as ViteVerification criteria
cd frontend-dapp && VITE_DEV_MODE=true VITE_WC_PROJECT_ID=x npx vite build --mode productionexits non-zero.make test-frontendandsrc/viteConfig.build.test.tsinclude the new case.make verify-issue-<N>green.VITE_DEV_MODEunset (operator check; record on the issue).marked as related to #118
marked as related to #378
mentioned in merge request !1192
Implementation is in !1192 (
feat/695-reject-prod-vite-dev-mode).Production
vite build --mode productionnow rejectsVITE_DEV_MODE=true(FE-01). LocalTerra / Vitest / Playwright keep the flag. Operator follow-up: confirm Coolify production env hasVITE_DEV_MODEunset.Verify:
make verify-issue-695mentioned in commit
489268eb91Merge sanity (!1192 landed on main)
Conflict:
Makefilehelp vsorigin/main(plus !1193). Resolved by keeping main Cloud Agent / Frontend lists and addingverify-issue-695. Thenmake verify-issue-6957/7 PASS (12 Vitest cases including production reject, no local-only mnemonic bypass, LocalTerra/Vitest/Playwright keep the flag).Do not reopen this issue unless a merged invariant is wrong. Operator leftovers moved to a post-merge ticket.
Residual (non-blocking)
VITE_DEV_MODEunset (record after next frontend rebuild). A mistakentruenow fails the production build (desired)..env.developmentsets both flags (not re-run in this pass; config unchanged).make test-frontend/ Playwright e2e were not re-run here; verify harness greps + Vitest cover the guard. CI/test-frontendonmainis the runtime proof.scripts/qa/README.mdhas no #695 index row.mentioned in issue #698
marked as related to #698
mentioned in issue #699
marked as related to #699
marked as related to #700
mentioned in issue #700
Post-merge leftovers tracked on #700.
mentioned in issue #706