feat: add findings.filter.delta workflow for line-range delta filtering#665
Draft
mattdolan-snyk wants to merge 3 commits into
Draft
feat: add findings.filter.delta workflow for line-range delta filtering#665mattdolan-snyk wants to merge 3 commits into
mattdolan-snyk wants to merge 3 commits into
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Adds a product-agnostic line-range delta filter that removes findings whose source location does not intersect an explicitly-supplied set of changed file/line ranges. - internal/utils/findings/delta.go: ParseChangedScope, NormalizeRelPath, mergeRanges, ChangedScope, GetDeltaFilter (LOCAL_FINDING_MODEL adapter) - internal/utils/findings/delta_test.go: table-driven tests covering intersection logic, merge-ranges, path normalisation, and all fail-closed malformed-input cases - pkg/local_workflows/delta_filter_workflow.go: findings.filter.delta workflow handling LOCAL_FINDING_MODEL and UFM_RESULT content types; no-op on absent input, fail-closed on malformed input - pkg/local_workflows/delta_filter_workflow_test.go: workflow-level tests using real juice-shop SARIF fixture - pkg/configuration/constants.go: FLAG_CHANGED_LINES_FILE, FLAG_CHANGED_LINES - pkg/local_workflows/local_workflows.go: register InitDeltaFilterFindingsWorkflow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mattdolan-snyk
force-pushed
the
claude/vigilant-driscoll-7b417e
branch
from
July 24, 2026 09:43
1c42bca to
29dba5f
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
findings.filter.delta— a product-agnostic line-range delta filter operating on the GAF workflow layer. Given explicit changed files + line ranges, returns only findings whose location intersects changed lines. Handles bothLOCAL_FINDING_MODEL(Snyk Code) andUFM_RESULT(Secrets) content types so both products are covered without any changes to their extensions.Why
Brings the line-granularity filtering currently done in the Secure At Inception Claude Code hook into the CLI as a reusable primitive. File granularity already exists via
code-client-gochangedFiles/limitToFiles; this adds the line layer. Any finding-producing product (SAST, Secrets, …) gets "only show me what I changed" without product-specific code.Contract
Explicit JSON input (
--changed-lines-file/--changed-lines), no git. Schema v1:{ "version": 1, "files": { "src/app.py": [{ "start": 10, "end": 24 }, { "start": 80, "end": 80 }], "src/new_file.py": "all" } }Fail behaviour (split by case):
files: {}→ fail closed ("omit the flag for a full scan")Finding with file in scope but no line data → kept (false positive beats false negative for a security gate).
Files changed
internal/utils/findings/delta.goParseChangedScope,NormalizeRelPath,mergeRanges,ChangedScope,GetDeltaFilter(LocalFinding adapter)internal/utils/findings/delta_test.gopkg/local_workflows/delta_filter_workflow.gofindings.filter.deltaworkflow; dispatches on content type; UFM adapter viafilteredTestResultwrapperpkg/local_workflows/delta_filter_workflow_test.gopkg/configuration/constants.goFLAG_CHANGED_LINES_FILE,FLAG_CHANGED_LINESconstantspkg/local_workflows/local_workflows.goInitDeltaFilterFindingsWorkflowTests
go test ./internal/utils/findings/— all pass (intersection-not-containment, multi-range,"all"sentinel, path normalisation, malformed input enumeration)go test ./pkg/local_workflows/— all pass (registration, no-flag pass-through, line filter, file not in scope, malformed fail-closed, summary recomputed)Known follow-ups
EffectiveSummary/RawSummaryon the TestResult still reflect pre-filter counts. Forsnyk secrets test --jsonconsumers the count fields will be stale. Fixing requires a summary-update path on the TestResult interface or post-filter reconstruction.runWorkflowAndProcessDatabetween the severity filter and output workflow.Companion PR
CLI PR wires this workflow into the command chain for
snyk code testandsnyk secrets test(both sharerunWorkflowAndProcessData).