What this thread does
Do first: run snyk code test --sarif-file-output=before.sarif without a severity filter, then decide which source-to-sink routes require remediation.
Short answer
As of November 2026, Snyk CLI 1.1308.4 is the pinned client (November 4 release).. Keep the full baseline, and run a separate high-severity gate. Fix the reachable unsafe operation, retain valid-input behavior, and rescan the same scope.
Choose / don't choose
- Non-shell subprocess: choose
execFilewith an executable and argument array when shell syntax is unnecessary. Its default avoids a shell; validate permitted executable and argument meaning. Don't concatenate user values into shell strings and rely on escaping across shells. Windows.bat/.cmdneed different handling (Node API).
Not for: CodeQL or Semgrep pull-request setup; see add-codeql-or-semgrep-security-scan-to-github-pull-requests
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
--severity-threshold | high for the gate; omit for separate full triage. Code accepts low, medium, high, not critical. | CLI 1.1308.4 | command |
--sarif-file-output | before.sarif and after.sarif, distinct names; retain complete results, not just terminal lines | CLI 1.1308.4 | export |
--org | Explicitly select the same organization for both scans; default is the preferred organization | CLI 1.1308.4 | command |
--json-file-output | Optional JSON alternative; no file is created for a SAST scan with no findings | CLI 1.1308.4 | command |
shell | execFile spawns the command directly without a shell by default; shell syntax then has no interpretation by a shell | Node child_process API | API |
Order of operations
1. Preserve the full baseline and scan status. Use snyk code test --severity-threshold=high separately; that filtered artifact cannot retain low/medium findings. In SARIF, high maps to error, medium to warning, low to note/info (results). 2. Follow the reported input through each transform and branch to the sink. An unchecked alternate route needs its own fix. If validation dominates every route but the trace still reports it, establish its actual guarantees; an unrecognized sanitizer is a hypothesis, not proof of a false positive. Preserve the unresolved warning with the route and validation rationale. If a proven validator is unrecognized, use Snyk custom sanitizers: register its fully qualified name and the matching sanitizer type only after establishing its security contract. flows_through_sanitizer cleans the return value; if_true_sanitizer and if_false_sanitizer clean arguments only on the corresponding checked branch; any_usage_sanitizer considers arguments sanitized after execution. A wrong type can hide unsafe usage. Registering a function does not make its implementation safe. 3. Design a harmless regression from that route: for command injection, intercept the process boundary and assert hostile metacharacters cannot cause a second command, while an allowed value reaches the intended executable as one argument. Require the security assertion to fail against the old implementation. For traversal, use a temporary permitted directory and an outside sentinel; cover parent traversal and applicable symlinks without changing the sentinel. These are application-specific regression designs, not analyzer-generated guarantees. 4. Patch the confirmed boundary, run focused positive and negative cases, then run snyk code test --sarif-file-output=after.sarif with unchanged root, organization, exclusions and threshold. Compare rule identity, sink and flow, not line numbers alone. Preserve SARIF locations and any codeFlows/threadFlows; the standard defines threadFlowLocation objects, but optional fields must be inspected rather than assumed present. 5. Treat exit 0 as completed without findings, 1 as completed with findings, 2 as scan failure and 3 as no supported project (exit codes). A missing artifact alone does not close a finding.
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
Unsanitized input from file name flows into os.RemoveAll | A reported input-to-filesystem route may lack sufficient context; this alone does not settle reachability | Inspect production vs fixture context and preserve a boundary regression; do not exclude production code to reduce counts | redbeam, January 20, 2026 |
403 Forbidden | With --report, the account can lack View Project Ignores permission | Grant that permission in the intended role before reporting; inspect the scan failure separately | command |
The file exclusion guide describes file/directory exclusions, not a narrow verdict on a single route. Redbeam's report is context evidence, not proof that these findings are harmless.
Missing
- The actual validator and route are unspecified; its recognition and security contract cannot be inferred. Keep disputed routes unresolved; scan disappearance alone cannot establish security.
Checked
2026-11-12; CLI 1.1308.4; Snyk command, results, exclusions and trace references, Node process API, OASIS SARIF standard, release and redbeam's report read. No application commands executed.
Started from a post by @Snyk, packaged by the editor. Original post