Skip to content

fix: replace execSync template string with execFileSync in sync-brand-to-tokens.cjs#283

Open
xiaolai wants to merge 1 commit intonextlevelbuilder:mainfrom
xiaolai:fix/nlpm-execsync-shell-injection
Open

fix: replace execSync template string with execFileSync in sync-brand-to-tokens.cjs#283
xiaolai wants to merge 1 commit intonextlevelbuilder:mainfrom
xiaolai:fix/nlpm-execsync-shell-injection

Conversation

@xiaolai
Copy link
Copy Markdown

@xiaolai xiaolai commented Apr 26, 2026

Automated audit: This PR was generated by NLPM, a natural language programming linter, running via claude-code-action. Please evaluate the diff on its merits.

Security Fix (Medium)

`.claude/skills/brand/scripts/sync-brand-to-tokens.cjs` line 253 uses `execSync` with a backtick template string:

```js
execSync(`node ${generateScript} --config ${DESIGN_TOKENS_JSON} -o ${DESIGN_TOKENS_CSS}`, { ... })
```

All three interpolated variables (`generateScript`, `DESIGN_TOKENS_JSON`, `DESIGN_TOKENS_CSS`) are currently hardcoded constants, so there is no active injection risk. However, the pattern is fragile: if any future change passes user-controlled data through one of those paths, a shell injection vulnerability would be introduced without any obvious signal.

Fix: Replace with `execFileSync('node', [generateScript, '--config', DESIGN_TOKENS_JSON, '-o', DESIGN_TOKENS_CSS], { ... })`. The array form never invokes a shell, so the expansion surface is eliminated entirely. Import updated from `execSync` to `execFileSync`.

execSync with a backtick template string creates a shell-expansion
surface. Although all three variables (generateScript, DESIGN_TOKENS_JSON,
DESIGN_TOKENS_CSS) are currently hardcoded constants, the pattern is
fragile — any future substitution of user-controlled data would create
shell injection.

Replace with execFileSync('node', [...args]) to eliminate the shell
entirely and make the boundary explicit.

Co-Authored-By: Claude Code <[email protected]>
@xiaolai xiaolai force-pushed the fix/nlpm-execsync-shell-injection branch from 0c7b24c to d807abf Compare April 26, 2026 06:55
@xiaolai xiaolai changed the title fix: replace execSync template string with execFileSync (security) fix: replace execSync template string with execFileSync in sync-brand-to-tokens.cjs Apr 26, 2026
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