Skip to content

Check existing alerts on code-only changes with --strict-blocking - #462

Merged
lelia merged 10 commits into
mainfrom
fix/strict-blocking-no-manifest-change
Nov 24, 2026
Merged

lelia merged 10 commits into
mainfrom
fix/strict-blocking-no-manifest-change

Conversation

@dc-larsen

@dc-larsen David Larsen (dc-larsen) commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Behavior

--strict-blocking compares scans when a change touches no supported manifest. It uses the configured scan scope and the existing comparison path. Block findings fail the run, and SCM pull requests and merge requests report existing findings in the security comment.

GitHub and GitLab branch pipelines without PR/MR context using --scm still run non-blocking full scans. Without either adapter, code-only default-branch pushes and scans of non-git paths can now fail on policy or comparison errors. If the pipeline previously ran only full scans, check the API token scopes for comparisons.

Verification

  • CLI regression tests exercise GitHub and GitLab routing, multiple existing advisories through the SDK parser, an ignored advisory, and exit codes for incomplete comparisons and missing existing-alert data.

Release

Ships in 2.14.0. Merge order: #461 → #462 → #460 → #464 → #465 → #463. Merged together in that order on main at #459, the six pass the full test suite and ruff check. main requires branches to be up to date, so update each PR from main after the previous merge. CHANGELOG.md will conflict each time: combine the bullets under the existing ## 2.14.0 subsections (Upgrade notes, Changed, Fixed, Documentation) by hand rather than taking either side.

This is 2 of 6, after #461. When #460 is updated after this merges, docs/ci-cd.md conflicts in one paragraph; #460's description has the resolution.

Upgrade impact. With --scm api (the default), --strict-blocking now runs a comparison for code-only jobs that previously fell back to a full scan. This includes default-branch pushes. If a job previously only uploaded scans, check for full-scans:list to read scan data and repo:list if the CLI selects the baseline automatically. See the upgrade guide in #463.

Measured timing. The author measured about 13–14 seconds end to end for the comparison and about 1 second for the full-scan fallback on the same inputs in a test org. Comparison timings were in line with runs that already used --ignore-commit-files.

Public Changelog

--strict-blocking now checks existing Block findings on code-only changes and reports them in pull and merge request comments. Without a GitHub or GitLab SCM adapter, default-branch pushes and scans of non-git paths can also fail on Block findings or comparison errors.

Fixes: CE-515
Refs: ASK-631

Without --ignore-commit-files, the CLI reads the changed files to decide
whether to compare. When none is a supported manifest it sets
force_api_mode, creates a full scan of the target path, and turns blocking
off because a full scan has no baseline. That fallback exists so a change
that cannot alter dependencies doesn't post a comment or block on alerts
it didn't introduce. Under --strict-blocking it also skipped the check the
flag exists for: a code-only pull request passed with a warning that
--strict-blocking needs diff mode, even when the repository had existing
blocking alerts.

With --strict-blocking, a change that touches no manifest now runs the
comparison over every manifest in the target path, the same way
--ignore-commit-files does. Existing alerts are loaded from the new full
scan and fail the run, and PR/MR comments list them. Failures reading them
keep the infrastructure-error code. Runs without --strict-blocking keep
the full-scan fallback, and SCM branch pipelines still create a full scan.
@lelia lelia changed the title Check existing alerts under --strict-blocking when no manifest changed Check existing alerts under --strict-blocking when no manifest changed Nov 20, 2026
@lelia lelia self-assigned this Nov 20, 2026
The no-manifest message was logged when the mode was chosen, before the
SCM event type was known. Skipped pull request events (closed, for example)
printed that every manifest would be compared and then exited without a
scan, and SCM branch pipelines printed it before creating a full scan. Log
it after the event check, only when the run goes on to compare.

Document the wider reach of the change: without --scm, default-branch
pushes and non-git target paths now compare under --strict-blocking and can
fail on existing blocking alerts. Note that --reach pull request scans need
a default-branch scan made with --reach, and reword the API Mode line.

Add tests for GitLab merge request and branch pipelines, an API-mode
default-branch push, and the log message. The branch pipeline tests now
return a blocking alert from the full scan, so they fail if blocking were
left on.
…o-manifest-change

# Conflicts:
#	CHANGELOG.md
…o-manifest-change

# Conflicts:
#	CHANGELOG.md
2.13.2 was released from main, so this change needs the next patch version.
Exercise the comparison and SDK parser from the CLI. Verify that incomplete
comparisons and missing existing-alert data use the configured exit policy.
Document scan scope, baseline selection, and the upgrade impact.
@lelia lelia changed the title Check existing alerts under --strict-blocking when no manifest changed Check existing alerts on code-only changes with --strict-blocking Nov 24, 2026
@lelia
lelia marked this pull request as ready for review November 24, 2026 02:55
@lelia
lelia requested a review from a team as a code owner November 24, 2026 02:55
@lelia

lelia commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

bugbot run

@cursor

cursor Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes CI exit behavior and scan type for --strict-blocking on manifest-less commits, including default-branch/API-only runs that previously always full-scanned without blocking.

Overview
--strict-blocking now runs a scan comparison even when changed-file detection finds no supported manifest, so code-only PRs/MRs (and API-mode pipelines without GitHub/GitLab SCM) can fail on existing Block findings instead of falling back to a non-blocking full scan.

The CLI sets force_diff_mode when strict blocking is on and no manifest triggered the normal comparison path, logs that behavior, and GitHub/GitLab security comments can list those findings under Existing alerts. Branch pipelines without PR/MR context still use non-blocking full scans when --scm is set; docs and --help were updated accordingly, with upgrade notes about comparison API token scopes.

Release 2.14.0 bumps socketdev to 3.6.4. A new regression test module covers routing, exit codes, PR comments, and SCM edge cases.

Reviewed by Cursor Bugbot for commit 2c6eb6c. Configure here.

@lelia
lelia temporarily deployed to socket-firewall November 24, 2026 02:55 — with GitHub Actions Inactive
@lelia

lelia commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

bugbot run

@lelia
lelia temporarily deployed to socket-firewall November 24, 2026 02:57 — with GitHub Actions Inactive
@lelia

lelia commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

bugbot run

@lelia
lelia temporarily deployed to socket-firewall November 24, 2026 03:00 — with GitHub Actions Inactive

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 2c6eb6c. Configure here.

@lelia
lelia merged commit e966d9e into main Nov 24, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants