Skip to content

Commit cae37c9

Browse files
committed
Merge main into martin/retire-analysis-splitting-flag
Moves the release to 2.15.0 above main's 2.14.0, and the changelog entry now has an upgrade note for jobs that opted in to splitting.
2 parents 67c15da + 4eed245 commit cae37c9

32 files changed

Lines changed: 2441 additions & 416 deletions

‎CHANGELOG.md‎

Lines changed: 68 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,79 @@
11
# Changelog
22

3-
## 2.13.3
3+
## 2.15.0
44

5-
### Deprecated
5+
### Upgrade notes
66

7-
- `--reach-enable-analysis-splitting` is now a hidden no-op, since the Coana
8-
CLI no longer splits analyses. The flag still parses, so existing CI scripts
9-
keep working. Remove it when convenient.
7+
- `--reach-enable-analysis-splitting` is deprecated and no longer has an
8+
effect. With it, a reachability analysis that failed or timed out was
9+
retried in smaller batches. Jobs that pass it now run one analysis, as jobs
10+
without it already did, so their results can differ. The flag still parses,
11+
so existing CI commands keep working. Remove it when convenient.
1012

1113
### Changed
1214

1315
- Reachability always passes `--disable-analysis-splitting` to the Coana CLI,
14-
so a version picked with `--reach-version` that still splits by default
15-
runs a single analysis too.
16+
including for a Coana version picked with `--reach-version`.
17+
18+
## 2.14.0
19+
20+
### Upgrade notes
21+
22+
- Without a GitHub or GitLab SCM adapter, `--strict-blocking` now compares scans
23+
even when no manifest changed. This includes default-branch pushes and scans of
24+
non-git paths. These runs can now fail on Block findings or comparison errors
25+
and need the [API token scopes for comparison runs](docs/troubleshooting.md#api-token-permissions).
26+
- If you use the GitHub Actions example, replace the combined workflow with the
27+
[PR workflow](workflows/github-actions.yml) and require its `socket-security`
28+
check. Install the [push workflow](workflows/github-actions-push.yml) in the
29+
same change: the PR workflow doesn't run on pushes, so without it the
30+
default-branch baseline stops updating and PR comparisons run against an old
31+
scan. Install the
32+
[ignore-command workflow](workflows/github-actions-comments.yml) if you use PR
33+
ignore commands.
34+
35+
### Changed
36+
37+
- Updated the Socket Python SDK (`socketdev`) to 3.6.4. This can increase
38+
advisory counts in full-scan JSON, SARIF, and GitLab security reports, and
39+
in the existing findings shown in GitLab security and FOSSA diff reports.
40+
- Skipped GitHub events and GitLab pipeline sources now warn that no scan ran.
41+
42+
### Fixed
43+
44+
- `--strict-blocking` counts distinct advisories on unchanged dependencies and
45+
lists findings that persist after a version change in the Existing alerts
46+
table. When a finding has both Warn and Block actions, Block takes precedence.
47+
- SARIF reports use advisory IDs to distinguish findings on the same package
48+
and manifest.
49+
- Comparisons with missing or invalid package lists fail with exit `3` by
50+
default. `--exit-code-on-api-error` can remap the code, and
51+
`--disable-blocking` takes precedence.
52+
- `--strict-blocking` checks existing Block findings on code-only changes.
53+
GitHub and GitLab pull request comments show those findings under Existing
54+
alerts.
55+
- With `--scm github`, reopened pull requests and pull requests marked ready for
56+
review run the PR scan.
57+
- GitHub pull request comment runs exit `0` and leave the Socket security
58+
comment unchanged when there are no Socket ignore commands to process.
59+
- Under `--strict-blocking --disable-blocking`, the PR/MR comment and console
60+
summary no longer say that existing Block alerts fail the run.
61+
- The "This package" link in GitHub and GitLab security comments opens the
62+
affected package version on socket.dev. License findings for different
63+
namespaces appear in separate rows, and generated ignore commands identify
64+
the package by its scope or namespace.
65+
- Large PR/MR security comments fit within GitHub's size limit and show how many
66+
new or existing findings were omitted. Policy checks and reports use all findings.
67+
68+
### Documentation
69+
70+
- The [CI guide](docs/ci-cd.md#required-github-checks) describes GitHub required
71+
checks and the GitHub Actions workflow migration.
72+
- The README's upgrade notes for 2.13 and 2.14 are combined into one short
73+
[section](README.md#upgrading-from-212-or-earlier).
74+
- Clarified that `--include-module-folders` discovers dependency manifests.
75+
Added a guide to scanning packages installed outside the lockfile with a
76+
CycloneDX SBOM.
1677

1778
## 2.13.2
1879

‎README.md‎

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ JSON:
205205

206206
Prebuilt workflow examples:
207207

208-
- [GitHub Actions](https://github.com/SocketDev/socket-python-cli/blob/main/workflows/github-actions.yml)
208+
- GitHub Actions for [pull requests](https://github.com/SocketDev/socket-python-cli/blob/main/workflows/github-actions.yml), [pushes](https://github.com/SocketDev/socket-python-cli/blob/main/workflows/github-actions-push.yml), and [ignore commands](https://github.com/SocketDev/socket-python-cli/blob/main/workflows/github-actions-comments.yml)
209209
- [Buildkite](https://github.com/SocketDev/socket-python-cli/blob/main/workflows/buildkite.yml)
210210
- [GitLab CI](https://github.com/SocketDev/socket-python-cli/blob/main/workflows/gitlab-ci.yml)
211211
- [Bitbucket Pipelines](https://github.com/SocketDev/socket-python-cli/blob/main/workflows/bitbucket-pipelines.yml)
@@ -268,27 +268,29 @@ scan exit `0` on *both* findings and outages — the `soft_fail: 100` rule would
268268
never match, and real findings would stop blocking. That's usually not what you
269269
want.
270270

271-
### Upgrading to 2.13.0
272-
273-
Update pipeline rules and wrapper scripts that match specific exit codes:
274-
275-
| Outcome | Before 2.13.0 | From 2.13.0 |
276-
|---------|---------------|-------------|
277-
| Invalid flags or configuration | CLI validation: `1`; argparse: `2` | `2` for both; never suppressed by `--disable-blocking` |
278-
| Ctrl+C | `2` | `130`, or `0` with `--disable-blocking` |
279-
| Missing token or other setup failure | Fixed `2` or `3`, depending on the failure | Infrastructure-error code (`3` by default); both exit-code flags now apply |
280-
281-
Blocking findings still exit `1`. With `--strict-blocking`, existing blocking
282-
alerts can now fail jobs that previously passed. GitLab report findings also get
283-
new IDs once; see the [release notes](CHANGELOG.md#2130).
284-
285-
Configuration is validated before credentials or network setup. Use native
286-
JSON/TOML booleans such as `false`, a positive integer `timeout`, and an array of
287-
file paths for `files`. Invalid or unreadable configuration exits `2` even when
288-
credentials are missing or blocking is disabled.
289-
290-
For a compact comparison of failure-handling policies, see
291-
[Exit codes in CI](docs/ci-cd.md#exit-codes-in-ci).
271+
### Upgrading from 2.12 or earlier
272+
273+
2.13 and 2.14 change exit codes and what `--strict-blocking` checks:
274+
275+
- **Exit codes:** invalid flags or configuration exit `2`, Ctrl+C exits `130`,
276+
and setup failures such as a missing token use the infrastructure-error code
277+
(`3` by default). Blocking findings still exit `1`. See
278+
[Exit codes in CI](docs/ci-cd.md#exit-codes-in-ci).
279+
- **Config files** are validated before credentials or network setup. Use native
280+
JSON/TOML booleans, a positive integer `timeout` and an array for `files`.
281+
- **`--strict-blocking`** fails on existing Block alerts, counts each advisory
282+
separately, and compares code-only changes too, so pipelines can fail on
283+
alerts they used to pass. Without `--scm github` or `--scm gitlab`, that
284+
includes default-branch pushes, which need the `full-scans:list` and
285+
`repo:list` token scopes; see
286+
[API token permissions](docs/troubleshooting.md#api-token-permissions).
287+
- **GitHub Actions example:** if you copied it, put the
288+
[PR workflow](workflows/github-actions.yml) at the existing path and add the
289+
[push workflow](workflows/github-actions-push.yml) in the same change. See
290+
[Required GitHub checks](docs/ci-cd.md#required-github-checks).
291+
292+
GitLab report findings get new IDs once. The [release notes](CHANGELOG.md) have
293+
the details.
292294

293295
## Common gotchas
294296

‎docs/ci-cd.md‎

Lines changed: 73 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,13 @@ they also hide findings and usage errors. Even with exit `0`, a setup/API failur
8484
does not mean a clean scan; check the logs for a completed report.
8585

8686
Findings block only when a [diff comparison runs](#scan-type-by-pipeline).
87-
SCM event filters can also skip unsupported events with exit `0`; confirm a report
88-
was created when validating a new workflow.
89-
`--strict-blocking` also checks existing blocking alerts; an incomplete comparison
90-
or incomplete existing-alert data is an infrastructure failure. See the
91-
[2.13.0 migration table](../README.md#upgrading-to-2130) when updating existing CI rules.
87+
SCM event filters can also skip unsupported events with exit `0` and a warning
88+
(see [Skipped events](#skipped-events)); confirm a report was created when
89+
validating a new workflow.
90+
The CLI treats comparisons marked incomplete or returned with missing or
91+
invalid package lists as infrastructure failures. With `--strict-blocking`,
92+
incomplete existing-alert data is also an infrastructure failure. See the
93+
[upgrade notes](../README.md#upgrading-from-212-or-earlier) when updating existing CI rules.
9294

9395
## Config file usage in CI
9496

@@ -137,6 +139,11 @@ Buildkite-specific config-file format is required.
137139
SOCKET_SECURITY_API_TOKEN: ${{ secrets.SOCKET_SECURITY_API_TOKEN }}
138140
```
139141

142+
With `--scm github`, `issue_comment` runs process Socket ignore commands on the
143+
pull request. When there are no commands to process, the run exits `0` and
144+
leaves the security comment unchanged. Use a dedicated `pull_request` scan job
145+
for any required check that gates merges on scan findings.
146+
140147
#### GitHub Actions: scan changed monorepo workspaces independently
141148

142149
GitHub Actions `paths` filters only decide whether a workflow starts. They do not
@@ -499,27 +506,75 @@ pipelines:
499506

500507
## Scan type by pipeline
501508

502-
With `--scm github` or `--scm gitlab`, the detected event decides the scan type:
509+
With `--scm github` or `--scm gitlab`, the adapter uses the event and PR/MR
510+
context to select the scan type. A push given a PR/MR number can use the
511+
comparison path.
503512

504513
| Event | Scan | Blocks the build |
505514
|:------|:-----|:-----------------|
506-
| Pull request / merge request | Diff scan against the repository's baseline | Yes, on new blocking alerts; also existing blockers with `--strict-blocking` |
507-
| Any other pipeline, including default-branch pushes | Full scan | No |
515+
| Supported pull request / merge request events | Diff scan against the repository's baseline when a comparison runs | Yes, on new blocking alerts and on existing blockers with `--strict-blocking` |
516+
| Push without a PR/MR number, including default-branch pushes | Full scan | No blocking on findings |
508517

509-
A full scan has no baseline, so it cannot tell a newly introduced alert from one
510-
that was already there. Rather than block on a number that would mean something
511-
different depending on which output format was enabled, those runs behave as if
512-
`--disable-blocking` was supplied and report through the Dashboard instead. This
513-
matches how the CLI already treats a run with no supported manifest files.
518+
With changed-file detection, a PR/MR with no supported manifest change runs a
519+
full scan by default. Use `--strict-blocking` or `--ignore-commit-files` to
520+
compare it. Full scans report through the Dashboard. A branch pipeline without
521+
PR/MR context stays in full-scan mode even with `--enable-diff`,
522+
`--ignore-commit-files`, or `--strict-blocking`.
514523

515-
The event type is authoritative once `--scm` is set: `--enable-diff` and
516-
`--ignore-commit-files` do not turn a branch pipeline into a comparison. To diff
517-
a branch build, drop `--scm` and use `--enable-diff` with `--integration`, which
518-
runs the comparison without the PR comment adapter.
524+
Without a GitHub or GitLab SCM adapter, `--strict-blocking` runs a comparison
525+
even when no supported manifest changed. This includes default-branch pushes and
526+
scans of non-git paths. A Block finding exits `1`. A comparison infrastructure
527+
error exits `3` by default. Check the [API token scopes for comparison runs](troubleshooting.md#api-token-permissions)
528+
when upgrading a pipeline that previously ran only full scans.
519529

520530
`--generate-license` and `--legal-format fossa` work on both paths; a full scan
521531
fetches the package list for them.
522532

533+
### Skipped events
534+
535+
With `--scm github`, `pull_request` runs scan on the `opened`, `synchronize`,
536+
`reopened` and `ready_for_review` actions. Other actions (`closed`, `labeled`,
537+
`edited`, and others) and unsupported events log a warning and exit `0` without
538+
scanning. `issue_comment` handles ignore commands. With `--scm gitlab`, the
539+
recognized scan sources are `web`, `merge_request_event`, `push`, `api`, and
540+
`pipeline`. Other sources, apart from the comment flow, also warn and exit `0`
541+
without scanning.
542+
543+
- A GitHub merge queue evaluates required checks on the `merge_group` commit.
544+
The CLI skips that event. Use a check that scans the merge group for
545+
[merge queue enforcement](https://docs.github.com/en/pull-requests/how-tos/merge-and-close-pull-requests/troubleshooting-required-status-checks#status-checks-with-github-actions-and-a-merge-queue).
546+
- GitHub runs `pull_request_target` in the base repository context, and the CLI
547+
skips it. Under GitHub's default fork settings, `pull_request` runs cannot
548+
access the Socket API secret. The CLI exits with its infrastructure error code
549+
if the token is missing. See GitHub's guidance for
550+
[securing workflows that handle fork PRs](https://docs.github.com/en/actions/reference/security/securely-using-pull_request_target).
551+
552+
### Required GitHub checks
553+
554+
Use the [PR workflow](../workflows/github-actions.yml) for the required
555+
`socket-security` check. If your workflow skips drafts, include
556+
`ready_for_review` in its `pull_request.types` so marking a PR ready starts the scan.
557+
Use the [push workflow](../workflows/github-actions-push.yml) to update the
558+
default-branch baseline and scan branch pushes. Use the
559+
[ignore-command workflow](../workflows/github-actions-comments.yml) if your
560+
repository handles ignore commands in PR comments.
561+
562+
GitHub normally checks the PR's test merge commit when it has a status and
563+
otherwise checks the head commit. The default PR checkout uses the test merge
564+
commit, while a push run uses the pushed commit. Keep the required job name
565+
exclusive to the PR workflow in either setup. A job skipped by a job-level
566+
`if` in a shared workflow can still report a successful check. See GitHub's
567+
[required status check rules](https://docs.github.com/en/pull-requests/how-tos/merge-and-close-pull-requests/troubleshooting-required-status-checks).
568+
569+
When replacing the combined example, copy the PR workflow to the existing
570+
workflow path and remove any other jobs named `socket-security`. Confirm the
571+
PR job reports the check named in branch protection. Add the push workflow in
572+
the same change: the PR workflow doesn't run on pushes, so without it the
573+
default-branch baseline stops updating and later PR comparisons run against an
574+
old scan. If you use
575+
`--strict-blocking` as a merge gate, verify a reopened PR with an existing
576+
Block alert fails and a completed clean comparison passes.
577+
523578
## Pull request and Dashboard association
524579

525580
The CLI sends the resolved pull request number with each full scan and attaches
@@ -642,7 +697,7 @@ listed thinly or not at all.
642697

643698
Prebuilt examples in this repo:
644699

645-
- [`../workflows/github-actions.yml`](../workflows/github-actions.yml)
700+
- GitHub Actions for [pull requests](../workflows/github-actions.yml), [pushes](../workflows/github-actions-push.yml), and [ignore commands](../workflows/github-actions-comments.yml)
646701
- [`../workflows/buildkite.yml`](../workflows/buildkite.yml)
647702
- [`../workflows/gitlab-ci.yml`](../workflows/gitlab-ci.yml)
648703
- [`../workflows/bitbucket-pipelines.yml`](../workflows/bitbucket-pipelines.yml)

0 commit comments

Comments
 (0)