Skip to content

fix(deploy): validate package.json name before shell interpolation - #18

Open
ygd58 wants to merge 1 commit into
ProjectOpenSea:mainfrom
ygd58:fix/deploy-project-name-shell-injection
Open

fix(deploy): validate package.json name before shell interpolation#18
ygd58 wants to merge 1 commit into
ProjectOpenSea:mainfrom
ygd58:fix/deploy-project-name-shell-injection

Conversation

@ygd58

@ygd58 ygd58 commented Aug 17, 2026

Copy link
Copy Markdown

Fixes #14.

Root cause

deploy.ts derives the Vercel project name from package.json's name field and interpolates it directly into a shell command string passed to execSync (which runs via sh -c). Any shell metacharacter in name executes during tool-sdk deploy.

Fix

Adds isValidVercelProjectName(), validated against Vercel's actual allowed project-name charset ([a-z0-9][a-z0-9._-]*, <=100 chars). If the derived name fails validation, the --project flag is omitted (matching existing behavior when no name is present) and a warning is logged, instead of shell-interpolating the raw value.

Testing

  • New regression test: a package.json name containing shell metacharacters must never reach execSync.
  • New regression test: a normal scoped package name (@scope/my-tool) still produces --project=my-tool as before.
  • Full suite passing. tsc --noEmit and biome check clean on changed files.

Fixes ProjectOpenSea#14. The Vercel project name derived from package.json's
"name" field was interpolated directly into a shell command string
passed to execSync, allowing arbitrary shell metacharacters in
package.json to execute during `tool-sdk deploy`.

Adds isValidVercelProjectName() and omits the --project flag (with a
warning) when the derived name doesn't match Vercel's allowed
project-name charset, instead of shell-interpolating it unchecked.

Two regression tests added: a malicious name that must never reach
execSync, and a normal scoped name that must still work.
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.

deploy: package.json "name" is interpolated into a shell string passed to execSync (CWE-78)

1 participant