PR/MR runs compare the new scan against the repository's head scan. That comparison first uses the diff-scans endpoints, which require an organization token with these scopes in addition to whatever the scan itself needs:
diff-scans:creatediff-scans:listfull-scans:list
If the token is missing them the scan still succeeds, so this is easy to miss. The only signal is a warning, after which the CLI falls back to the older streaming comparison:
Diff scan comparison failed with APIAccessDenied(Insufficient permissions), falling back to the streaming scan comparison
Grant the scopes to use the diff-scans path. It polls with short, bounded requests
rather than holding one connection open while the backend computes, which is what lets
large comparisons survive network idle timeouts — notably Azure NAT gateways, which
reap idle connections after four minutes and surface as an intermittent
ConnectionResetError.
The two paths can take noticeably different amounts of time on the same repository,
because cached diff-scan responses always embed per-package license details while the
streaming comparison requests a lean payload. On a large dependency tree, compare the
Diff scan comparison ready in ... timing against the Diff Report Gathered in ...
total before assuming either path is at fault.
- In diff scope,
--strict-blockinguses a stricter alert set (new + unchanged) for blocking checks and diff-based output selection. --sarif-scope fullrequires--reach.- In
--sarif-scope fullwith--sarif-file, SARIF JSON is written to file and stdout JSON is suppressed. --sarif-grouping alertcurrently applies to--sarif-scope full.
Differences in result counts can be valid, even when filtering appears similar.
Common reasons:
diffvsfulldata source:--sarif-scope diffis based on diff alerts (typically net-new in the compared scan context).--sarif-scope fullis based on full reachability facts data.
- Consolidation differences:
- Dashboard and API/CLI can apply different consolidation/grouping rules.
--sarif-grouping alertand--sarif-grouping instanceintentionally produce different row counts.
- Policy vs dataset:
--strict-blockingonly affects diff-scope behavior and does not make diff output equivalent to full dashboard data.
- Reachability data availability:
- If reachability analysis partially fails and falls back to precomputed reachability, counts can shift.
Recommended comparison path:
- Use full-scope SARIF for parity-oriented comparisons.
- Keep grouping fixed (
alertfor dashboard-style rollups,instancefor detailed exports). - Compare reachability filters with the same mode and grouping across runs.
Use --save-submitted-files-list to inspect exactly what was sent for scanning.
socketcli --save-submitted-files-list submitted_files.jsonOutput includes:
- timestamp
- total file count
- total size
- complete submitted file list
Use --save-manifest-tar to export discovered manifest files as .tar.gz.
socketcli --save-manifest-tar manifest_files.tar.gzCombined example:
socketcli --save-submitted-files-list files.json --save-manifest-tar backup.tar.gzFor octopus merges (3+ parents), Git can report incomplete changed-file sets because default diff compares against the first parent.
If needed, force full scan behavior with:
--ignore-commit-files
If report is not visible in GitLab Security Dashboard:
- verify
dependency_scanningartifact is configured in.gitlab-ci.yml - verify job completed and artifact uploaded
- verify report file schema is valid
If vulnerabilities array is empty:
- this can be expected when no actionable security issues are present in the result scope
- confirm expected scope/flags and compare with Socket dashboard data