Skip to content

Conversation

@AmirGhMohseni
Copy link

Fix: Command Injection in blocks-builder.ts -- Issue 383

This PR addresses a critical Command Injection vulnerability in the workflow engine.

Changes:

  • Removed shell: true from spawn()
  • Added allowlist for safe commands (npm, yarn, etc.)
  • Added input validation to block shell metacharacters (;, |, &, etc.)
  • Added unit tests for security validation

Why this matters:

  • The vulnerable code allowed arbitrary OS command execution if attacker-controlled input reached command or args.
  • This directly impacts the workflow engine, a critical bounty scope.
  • Follows best practice: never use shell: true with untrusted input.

This vulnerability was detected via Semgrep: javascript.lang.security.detect-child-process

Added validation and security features for serving preview files.

Signed-off-by: Amir <98203210+AmirGhMohseni@users.noreply.github.com>
Signed-off-by: Amir <98203210+AmirGhMohseni@users.noreply.github.com>
Issue 383

Signed-off-by: Amir <98203210+AmirGhMohseni@users.noreply.github.com>
Signed-off-by: Amir <98203210+AmirGhMohseni@users.noreply.github.com>
@AmirGhMohseni AmirGhMohseni changed the title Fix/command injection blocks builder Fix: command injection blocks builder Nov 29, 2025
@AmirGhMohseni AmirGhMohseni changed the title Fix: command injection blocks builder Fix: Command injection blocks builder Nov 29, 2025
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