Skip to content

The bundle budget builds through Vite's API, with no shell - #567

Merged
zlareb1 merged 2 commits into
mainfrom
fix/bundle-budget-no-shell
Nov 12, 2026
Merged

zlareb1 merged 2 commits into
mainfrom
fix/bundle-budget-no-shell

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

npm run budget builds the dashboard through Vite's API instead of a shell command.

Why

CodeQL's js/shell-command-injection-from-environment flags frontend/scripts/bundle_budget.mjs. It ran execSync(`npx vite build --sourcemap --outDir ${JSON.stringify(out)} --emptyOutDir`), where out is the absolute path of dist-budget in the checkout. JSON.stringify puts the path in double quotes, inside which the shell still expands $( ) and backticks, so a checkout under a directory whose name holds them would run that text as a command. The script now calls Vite's build() with the same options; Vite reads vite.config.ts as its CLI does, and no shell sees the path.

Scope and risk

  • frontend/scripts/bundle_budget.mjs only, which CI and npm run budget run. The build options are those of the CLI flags it replaces (sourcemap, outDir); the script already removes the output directory before the build, so --emptyOutDir is dropped.
  • Nothing the dashboard ships changes.

Compatibility, rollout and rollback

  • Wire: none.
  • Operator steps: none.
  • Rollback: revert.

Tests

npm --prefix frontend run budget builds the same chunks, with the same hashes, as the previous script on the same tree (stylesheets 36.6 kB and boot scripts 186.5 kB gzipped, index chunk 119.5 kB) and ends bundle-budget: OK. Biome passes on the script.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code; ran the budget before and after the change.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

🤖 Generated with Claude Code

zlareb1 and others added 2 commits November 12, 2026 14:50
The script ran npx vite build through execSync with the output path in double quotes from JSON.stringify, which leaves $( ) and backticks to the shell: a checkout path holding them ran as a command.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 merged commit b7592a1 into main Nov 12, 2026
39 of 43 checks passed
@zlareb1
zlareb1 deleted the fix/bundle-budget-no-shell branch November 12, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant