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.ts — executeWithShell():
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)
- Review the hotspot as safe in SonarQube Cloud (documenting the denylist + spawn-based design), OR
- Harden toward an allowlist: restrict
executeWithShell to a vetted set of executables/operators instead of a denylist, OR
- 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
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.ts—executeWithShell():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 onrm/dd/curl/wget/nc/bash/shafter separators and in command/backtick substitution.Why this is deferred (not fixed in the cycle)
Proposed resolutions (owner decision)
executeWithShellto a vetted set of executables/operators instead of a denylist, ORexecuteDirectly(no shell) as the default and require explicit opt-in for shell commands with a narrowed grammar.Scope
packages/validation-executor/src/utils/secureExecution.tspackages/validation-executor/test/unit/secureExecution.test.ts