Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pensar - auto fix for Command Injection via Unsanitized Project Name Input #12

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from

Conversation

pensarapp[bot]
Copy link

@pensarapp pensarapp bot commented Apr 1, 2025

Secured with Pensar

Fixed an OS Command Injection vulnerability (CWE-78) by adding input validation for the user-supplied project name. The fix adds a regex check (/^[a-zA-Z0-9_-]+$/) after collecting the user input to ensure the appName only contains alphanumeric characters, underscores, and dashes. If the validation fails, the script displays an error message and exits, preventing any potentially dangerous characters from being included in the shell command that is executed via execSync(). This prevents attackers from injecting malicious commands through the project name input.

More Details
Type Identifier Message Severity Link
Application CWE-78, CWE-20 The application builds a shell command using user-supplied input (appName) without thorough sanitization. Although the input is trimmed, an attacker could potentially inject malicious shell commands, leading to OS Command Injection (CWE-78). This vulnerability arises because the command string includes unsanitized data from a low-trust source crossing into a sensitive execution context (child_process.execSync). The risk is compounded by the direct execution of the constructed command. While default values and prompts mitigate the risk in controlled environments, if an attacker can manipulate the input, they might execute unintended commands. This is considered a true positive vulnerability. high Link

Copy link

vercel bot commented Apr 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
simpl-cms-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 1, 2025 7:21am

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.

0 participants