Skip to content

Deferred from PR #52: SonarCloud D Security Rating on secureExecution shell path #53

Description

@cryptoxdog

Context

Deferred during PR remediation on #52 (commit 076901f).

SonarCloud's Quality Gate reports a D Security Rating on New Code. The source is:

packages/validation-executor/src/utils/secureExecution.tsexecuteWithShell():

const result = spawnSync('sh', ['-c', command], { ... });

This shell path is taken only when requiresShellExecution(command) is true (pipes, redirects, chaining, globbing, substitution). It is guarded by a denylist sanitizer (sanitizeShellCommand) that throws on rm/dd/curl/wget/nc/bash/sh after separators and in command/backtick substitution.

Why this is deferred (not fixed in the cycle)

  • Shell execution is an intentional, required capability — the validation executor must run spec-defined commands that legitimately use shell features. Removing it would break documented functionality.
  • SonarCloud classifies this as a Security Hotspot; resolving the rating requires either a human "review as safe" decision in the SonarQube Cloud UI, or an architectural change. Neither is a mechanical code fix, and I did not attempt to trick the scanner.

Proposed resolutions (owner decision)

  1. Review the hotspot as safe in SonarQube Cloud (documenting the denylist + spawn-based design), OR
  2. Harden toward an allowlist: restrict executeWithShell to a vetted set of executables/operators instead of a denylist, OR
  3. Split the API: keep executeDirectly (no shell) as the default and require explicit opt-in for shell commands with a narrowed grammar.

Scope

  • packages/validation-executor/src/utils/secureExecution.ts
  • Related tests: packages/validation-executor/test/unit/secureExecution.test.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions