Skip to content

Build input safety: slug validation, HTML escaping, secret denylist#6

Open
miguelrisero wants to merge 1 commit into
chore/governance-and-cifrom
fix/build-safety
Open

Build input safety: slug validation, HTML escaping, secret denylist#6
miguelrisero wants to merge 1 commit into
chore/governance-and-cifrom
fix/build-safety

Conversation

@miguelrisero

Copy link
Copy Markdown
Contributor

Stack 2 of 5 (base: chore/governance-and-ci). Council P0 — treat repo content as untrusted now that the repo is public.

  • Slug-validate project folder names (^[a-z0-9][a-z0-9-]*$) at discovery; invalid names are skipped with a warning. This closes the command-injection path where name was interpolated into spawn("sh", ["-c", …]) (e.g. npx vite build --base /${name}/).
  • HTML-escape project name/title/type and section titles in the generated landing index; allowlist link schemes (internal paths + http(s) only) so externals.json can't inject javascript:/markup → fixes the stored-XSS sink.
  • Secret denylist on static copy: also exclude .env*, .npmrc, *.pem/*.key, id_rsa/id_ed25519, .DS_Store so a static template can't accidentally publish credentials.

npm run build stays green; both example cards still render. (build-node-functions.mjs already validates template.config.json paths against traversal/symlink escape.)

⚠️ Stacked — don't merge before #5 (PR1). Merge order: 1→5.

Validate project folder names against a strict slug (^[a-z0-9][a-z0-9-]*$) at
discovery and skip the rest — closes the command-injection vector where a folder
name was interpolated into `sh -c` (`npx vite build --base /<name>/`). Extend the
static-copy filter to drop secret-looking files (.env*, .npmrc, *.pem/*.key, ssh
keys) so a template can't publish credentials. HTML-escape project name/title/type
and section titles in the generated landing index, and allowlist link schemes
(internal paths + http(s) only) so externals.json can't inject script/markup.
@vercel

vercel Bot commented Jun 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
templates Ready Ready Preview, Comment Jun 3, 2026 9:35am

Request Review

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