Skip to content

Improve shell path escaping in CLI to prevent command injection#176

Merged
YoavCodes merged 1 commit intoblackboardsh:mainfrom
RinZ27:fix/cli-shell-injection
Mar 7, 2026
Merged

Improve shell path escaping in CLI to prevent command injection#176
YoavCodes merged 1 commit intoblackboardsh:mainfrom
RinZ27:fix/cli-shell-injection

Conversation

@RinZ27
Copy link
Contributor

@RinZ27 RinZ27 commented Feb 21, 2026

Vulnerability in path escaping was noticed where only double quotes were being handled. Since the CLI uses string templates with shell-execution functions like execSync, characters such as backticks or dollar signs in file paths could lead to arbitrary command execution on a developer's machine.

Switching to single quotes for POSIX systems provides a much more robust shield against shell expansion. While double quotes still allow for variable interpolation and command substitution, single quotes neutralize these threats entirely. Additionally, several locations using direct double-quote wrapping were refactored to use the centralized escape utility.

Safety of the build process is significantly improved by this change, especially when dealing with projects or paths containing special characters. My tests confirmed that standard paths continue to work correctly while malicious paths are now safely escaped and do not trigger unexpected shell behavior.

Copy link
Member

@YoavCodes YoavCodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! A step in the right direction, thanks for surfacing (and fixing). will do a pass and harden some other places

@YoavCodes YoavCodes merged commit 7fa590d into blackboardsh:main Mar 7, 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.

2 participants