Skip to content

Quote mapper-generated validation command arguments #110

@rohitjavvadi

Description

@rohitjavvadi

Problem

Some mapper-generated validation commands interpolate repo-controlled paths, package names, task names, or test paths directly into shell command strings. Those commands are later executed through the validation path with shell: true, so a project path or package name containing shell metacharacters can be interpreted as command syntax instead of a literal argument.

Evidence

Examples on current main:

  • src/mappers/projects.ts:204 builds pnpm --dir ${packageRoot} ${script}.
  • src/mappers/projects.ts:212 builds npm --prefix ${packageRoot} run ${script}.
  • src/mappers/shared.ts:369 and src/mappers/shared.ts:377 do the same for shared Node script commands.
  • src/mappers/turbo.ts:129-137 interpolates Turbo task/filter values directly.
  • src/mappers/rust.ts:92 interpolates a crate member path into cargo test --manifest-path.
  • src/mappers/swift.ts:177 and src/mappers/swift.ts:217 interpolate nested Swift package roots into swift test --package-path.
  • src/mappers/elixir.ts:304 interpolates a test path into mix test.
  • src/app.ts:1076-1078 runs feature validation commands after fix.
  • src/exec.ts:20-28 executes command strings with shell: true.

Reproduction idea

A workspace package under a path such as:

apps/web; touch INJECTED

can produce a validation command shaped like:

pnpm --dir apps/web; touch INJECTED test

When that string is executed by a shell, touch INJECTED is no longer just part of the package path. The same class of issue can happen with Turbo filters/package names and other mapper-generated command arguments.

Expected behavior

Mapper-generated validation commands should treat repo-derived paths, task names, package names, and test paths as literal command arguments. A weird but valid path should either be safely quoted or rejected before it reaches shell execution.

Possible fix

Use the existing shell quoting helper for dynamic command arguments before assembling validation command strings. At minimum this should cover Node package roots/scripts, Turbo task/filter values, Rust manifest paths, Swift package roots, and Elixir test paths.

Regression coverage should include:

  • package roots containing ;
  • package names or filters containing ;
  • paths containing command substitution syntax such as $()
  • existing simple command output staying unchanged

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Urgent regression or broken agent/channel workflow affecting real users now.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:securityThis issue is about security boundaries, credentials, authz, sandboxing, or sensitive data.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    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