Pre-launch: prod build ships source maps (vite.config sourcemap: true) #117
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#117
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?
Found during DEX security checklist gap-fill on Sunday 2026-04-26.
Repro
frontend-dapp/vite.config.ts L70:
sourcemap: trueis unconditional - no env split, nomode === 'production'check. Everynpm run buildwrites .js.map files alongside the bundle output. If the prod hosting serves /dist as-is (typical for a static frontend), the deployed site exposes the full un-minified source via source maps.Why it matters pre-launch
Source maps don't expose secrets in this codebase - the
define: { 'process.env': '{}' }at L64 wipes them at build time. But the maps still:This is hygiene that the rest of the org already practices:
sourcemap: false(mainnet live)sourcemapset (Vite default for prod = false)DEX is the outlier.
Severity
LOW-MEDIUM. Not a vulnerability on its own. Worth fixing pre-mainnet to match the rest of the ecosystem.
Fix options
Option A (simple, matches bridge):
Option B (keep maps for staging/dev only):
Option C (hidden source maps - preserve for crash reporting tools, not served publicly):
Option C is the strongest if the team uses Sentry / equivalent crash reporting — maps are emitted but not referenced by the bundled JS, so the browser doesn't auto-fetch them.
Acceptance
npm run buildsmoke test: confirm /dist no longer contains *.js.map files (Option A/B prod) or that the bundle .js files have no//# sourceMappingURL=trailer (Option C)cc @PlasticDigits
mentioned in commit cl8y-ecosystem-qa@98dddc8a8a762d6c4da82d826efd3392239b000d
mentioned in issue #118
mentioned in commit
0a86ba31eaImplemented production-only Vite source maps (Option B via `mode`): default `npm run build` / `vite build` (`production`) sets `build.sourcemap: false`; non-production modes (e.g. `vite build --mode staging`) still emit `*.js.map` for staging diagnostics.
Merged to `main`:
0a86ba3— docs + new agent playbook `skills/AGENTS_FRONTEND_PRODUCTION_BUILD.md`, cross-links from `skills/AGENTS_TERRACLASSIC_GAS.md` and `docs/frontend.md` (anchor `#vite-production-sourcemaps`). Vitest guard: `frontend-dapp/src/viteConfig.build.test.ts` (`@vitest-environment node` + `loadConfigFromFile`). Also fixed missing `AssetInfo` import on `PoolPage.tsx` so `tsc -b` passes for CI.Out of repo: acceptance asked updating `cl8y-ecosystem-qa` `specs/DEX-Security-Checklist-DRAFT.md` row 1.20 — not in this repo; tracked in `docs/frontend.md` as a follow-up for whoever owns that checklist.
@brouie please verify when you have a moment.
Checklist for verification
Leaving the issue open per process.
Verified on
0a86ba3. 6/6 PASS — closing.Acceptance items
npm run build→ 0.js.mapfiles indist/—find dist -name '*.js.map' | wc -lreturned 0 after cleannpm ci && npm run build(built in 13.45s).sourceMappingURLtrailers in prod bundle —grep -rl 'sourceMappingURL' dist --include='*.js'returned 0 hits.--mode stagingstill emits maps —npx vite build --mode stagingproduced 33.js.mapfiles, build output explicitly showsmap: 212.01 kB,map: 488.12 kB, etc. Mode-based logic works as designed.viteConfig.build.test.tsand passes — 3 tests, all PASS in 96ms (covers prod sourcemap-off, non-prod sourcemap-on, and the GitLab #118 dev-mnemonic rejection test).docs/frontend.md#vite-production-sourcemapsanchor resolves with invariant table cross-linking #117 + ecosystem-qa row 1.20.skills/AGENTS_FRONTEND_PRODUCTION_BUILD.mdhas canonical refs table + 3 rules of thumb. Cross-link toAGENTS_TERRACLASSIC_GAS.mdis good continuity.8ae453aoncl8y-ecosystem-qamain:specs(dex-security): mark row 1.20 source map leakage OK (DEX #117 verified). Row now readsNO — prod build | Fixed by #117 (commit 0a86ba3)... | OK.Nice clean fix. cc @PlasticDigits
mentioned in issue #179
mentioned in issue #337
mentioned in merge request !834
mentioned in commit
f875d5388amentioned in commit
0e3afcaef3mentioned in commit
65876e17c7mentioned in merge request !953
mentioned in issue #421