Skip to content

Commit 97ceb80

Browse files
committed
Add the advisory links to the shared 2.16.0 changelog
2 parents 3f3be31 + 2b912ed commit 97ceb80

17 files changed

Lines changed: 984 additions & 50 deletions

‎CHANGELOG.md‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,65 @@
22

33
## 2.16.0
44

5+
### Added
6+
7+
- Use `--no-default-branch` to prevent a scan from changing the repository's
8+
default branch or updating a branch head. It is mutually exclusive with
9+
`--default-branch`.
10+
511
### Changed
612

13+
- Full scans of tracked branches can update branch heads, so findings from
14+
those branches can appear on the organization Alerts page after upgrade.
15+
Use `--no-default-branch` to opt a scan out.
716
- PR and MR security comments link available GHSA and CVE IDs to their public
817
advisory pages.
918

19+
### Fixed
20+
21+
- Automatic default-branch detection checks explicit scan refs against the
22+
default branch. An explicit commit must be available in the checkout for
23+
automatic promotion. When available, the selected commit supplies the commit
24+
message and the Git fallback for the committer. CI actor settings retain
25+
precedence.
26+
27+
## 2.15.10
28+
29+
### Added
30+
31+
- Set `SOCKET_COANA_MIRROR_URL` to download the reachability engine through a
32+
mirror of `storage.googleapis.com/socket-coana-cli`.
33+
34+
### Changed: update the Docker image's PyPy to 8.1.1
35+
36+
- The amd64 Docker image now ships PyPy `8.1.1` (Python 3.12), up from PyPy
37+
`8.0.1`.
38+
39+
### Changed: bump pinned Coana CLI to 15.15.12
40+
41+
- Bumped the pinned reachability engine (the Coana CLI) from `15.15.11` to
42+
`15.15.12`. See the
43+
[reachability analysis changelog](https://docs.socket.dev/docs/reachability-analysis-changelog)
44+
for engine changes.
45+
46+
## 2.15.9
47+
48+
### Changed: bump pinned Coana CLI to 15.15.11
49+
50+
- Bumped the pinned reachability engine (the Coana CLI) from `15.15.10` to
51+
`15.15.11`. See the
52+
[reachability analysis changelog](https://docs.socket.dev/docs/reachability-analysis-changelog)
53+
for engine changes.
54+
55+
## 2.15.8
56+
57+
### Changed: bump pinned Coana CLI to 15.15.10
58+
59+
- Bumped the pinned reachability engine (the Coana CLI) from `15.15.9` to
60+
`15.15.10`. See the
61+
[reachability analysis changelog](https://docs.socket.dev/docs/reachability-analysis-changelog)
62+
for engine changes.
63+
1064
## 2.15.7
1165

1266
### Changed: bump pinned Coana CLI to 15.15.9

‎Dockerfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ RUN if [ "$DOTNET_VERSION" = "6" ]; then \
8989
# This is a custom build of PyPy3.12 for Alpine on x86-64.
9090
ARG TARGETARCH # Passed by Docker buildx
9191
RUN if [ "$TARGETARCH" = "amd64" ]; then \
92-
PYPY_URL="https://github.com/BarrensZeppelin/alpine-pypy/releases/download/alp3.24.2-pypy3.12-8.0.1/pypy3.12-v8.0.1-linux64-alpine3.24.tar.gz" && \
93-
PYPY_SHA256="b6d5dd429c6394f1710a52e3e20d5c9198547caff9528547c457d3f2ed37db09" && \
92+
PYPY_URL="https://github.com/BarrensZeppelin/alpine-pypy/releases/download/alp3.24.4-pypy3.12-8.1.1/pypy3.12-v8.1.1-linux64-alpine3.24.tar.gz" && \
93+
PYPY_SHA256="c6c630c7a37a97977014cdd6252a6331fb2cfccddffe15a0a5590480f4741c2c" && \
9494
curl -L -o /tmp/pypy.tar.gz "$PYPY_URL" && \
9595
echo "$PYPY_SHA256 /tmp/pypy.tar.gz" | sha256sum -c - && \
9696
mkdir -p /opt/pypy && \

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ Prebuilt workflow examples:
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)
212212

213+
When a job scans a different ref than the one that triggered it, such as a release tag, pass `--branch` and `--commit-sha` for that ref. [Default Branch Detection](https://github.com/SocketDev/socket-python-cli/blob/main/docs/cli-reference.md#default-branch-detection) covers when to add `--no-default-branch`.
214+
215+
Full scans of tracked branches can update branch heads and show their findings on the Alerts page. See [Branch heads](https://github.com/SocketDev/socket-python-cli/blob/main/docs/cli-reference.md#branch-heads).
216+
213217
Minimal pattern:
214218

215219
```yaml

‎docs/cli-reference.md‎

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ socketcli [-h] [--api-token API_TOKEN] [--repo REPO] [--workspace WORKSPACE] [--
212212
[--base-scan-id BASE_SCAN_ID | --base-commit-sha BASE_COMMIT_SHA]
213213
[--target-path TARGET_PATH] [--sbom-file SBOM_FILE] [--license-file-name LICENSE_FILE_NAME] [--save-submitted-files-list SAVE_SUBMITTED_FILES_LIST]
214214
[--save-manifest-tar SAVE_MANIFEST_TAR] [--files FILES] [--sub-path SUB_PATH] [--workspace-name WORKSPACE_NAME]
215-
[--excluded-ecosystems EXCLUDED_ECOSYSTEMS] [--exclude-paths EXCLUDE_PATHS] [--include-dirs INCLUDE_DIRS] [--default-branch] [--generate-license] [--enable-debug]
215+
[--excluded-ecosystems EXCLUDED_ECOSYSTEMS] [--exclude-paths EXCLUDE_PATHS] [--include-dirs INCLUDE_DIRS] [--default-branch | --no-default-branch] [--generate-license] [--enable-debug]
216216
[--enable-json] [--enable-sarif] [--sarif-file <path>] [--sarif-scope {diff,full}] [--sarif-grouping {instance,alert}] [--sarif-reachability {all,reachable,potentially,reachable-or-potentially}] [--enable-gitlab-security] [--gitlab-security-file <path>]
217217
[--disable-overview] [--exclude-license-details] [--allow-unverified] [--disable-security-issue]
218218
[--ignore-commit-files] [--disable-blocking] [--disable-ignore] [--enable-diff] [--scm SCM] [--timeout TIMEOUT] [--include-module-folders]
@@ -324,6 +324,7 @@ docs.socket.dev use `SOCKET_SECURITY_API_KEY`. Either works. If both are set,
324324
| Parameter | Required | Default | Description |
325325
|:-------------------------|:---------|:--------|:------------------------------------------------------------------------------------------------------|
326326
| `--default-branch` | False | *auto* | Make this branch the default branch (auto-detected from git and CI environment when not specified) |
327+
| `--no-default-branch` | False | False | Prevent the scan from changing the repository's default branch or updating a branch head, whatever git or the CI environment detects. Mutually exclusive with `--default-branch`. See [Default Branch Detection](#default-branch-detection) |
327328
| `--include-module-folders` | False | False | Includes supported manifests found under `node_modules`, `bower_components`, and `jspm_packages` in manifest discovery. Equivalent to `--include-dirs node_modules,bower_components,jspm_packages`. Other discovery exclusions still apply. For an inventory of installed packages, see [Packages installed outside the lockfile](troubleshooting.md#packages-installed-outside-the-lockfile). |
328329
329330
#### Output Configuration
@@ -353,7 +354,7 @@ docs.socket.dev use `SOCKET_SECURITY_API_KEY`. Either works. If both are set,
353354
| Parameter | Required | Default | Description |
354355
|:---------------------------------|:---------|:--------|:---------------------------------------------------------------------------------------------------------------------------|
355356
| `--reach` | False | False | Enable reachability analysis to identify which vulnerable functions are actually called by your code. Creates a full application reachability scan (`scan_type=socket_tier1`). |
356-
| `--reach-version` | False | 15.15.9 | Version of the Coana CLI to use. Defaults to the pinned version that ships with this CLI release, so the engine only changes when you upgrade the Socket CLI. Pass `latest` to always use the newest published version (opt-in auto-update), or an explicit version (e.g. `1.2.3`) to pin it. |
357+
| `--reach-version` | False | 15.15.12 | Version of the Coana CLI to use. Defaults to the pinned version that ships with this CLI release, so the engine only changes when you upgrade the Socket CLI. Pass `latest` to always use the newest published version (opt-in auto-update), or an explicit version (e.g. `1.2.3`) to pin it. |
357358
| `--reach-analysis-timeout` | False | 10m | Timeout for each reachability analysis run, e.g. `90s`, `10m` or `1h`. Omitted by default, so coana applies its own default (`10m`). Alias: `--reach-timeout` |
358359
| `--reach-analysis-memory-limit` | False | 8GB | Memory limit for each reachability analysis run, e.g. `512MB` or `8GB`. Omitted by default, so coana applies its own default (`8GB`). Alias: `--reach-memory-limit` |
359360
| `--reach-concurrency` | False | 1 | Control parallel analysis execution (must be >= 1). Omitted by default, so coana applies its own default. |
@@ -719,14 +720,43 @@ The CLI now automatically detects repository information from your git environme
719720
> For *octopus merges* (three or more parents), Git only reports changes relative to the first parent. This can lead to incomplete or empty file lists if changes only exist relative to other parents. In these cases, differential scanning may be skipped. To ensure coverage, use `--ignore-commit-files` to compare regardless of the detected changes, or specify files explicitly with `--files`.
720721
### Default Branch Detection
721722

722-
The CLI uses intelligent default branch detection with the following priority:
723+
`--default-branch` always marks the scan as the repository's default branch. `--no-default-branch` never does, and the scan does not update a branch head. The two flags are mutually exclusive, on the command line and in a `--config` file.
723724
724-
1. **Explicit `--default-branch` flag**: Takes highest priority when specified
725-
2. **CI environment detection**: Uses CI platform variables (GitHub Actions, GitLab CI, and Bitbucket Pipelines)
726-
3. **Git repository analysis**: Compares current branch with repository's default branch
727-
4. **Fallback**: Defaults to `false` if none of the above methods succeed
725+
Without either flag, the CLI marks the scan when automatic detection finds the default branch: CI platform variables (GitHub Actions, GitLab CI, Bitbucket Pipelines and Buildkite), the `DEFAULT_BRANCH` variable with `--scm github`, or, outside CI, the local checkout. Otherwise the scan is not marked.
728726
729-
A scan on the default branch also becomes that branch's head scan. `--pending-head` is deprecated and has no effect: it is still accepted so existing pipelines keep working, but it logs a warning. Use `--default-branch` instead.
727+
#### Scanning a different ref than the CI run
728+
729+
When `--branch` or `--commit-sha` names a different ref than the CI variables, automatic detection also checks the ref you passed. The scan is marked only when that branch is the default branch and that commit is in the checkout and reachable from the default branch. An explicit commit that is missing from the checkout disqualifies automatic detection, even when it matches the SHA reported by CI. These flags never turn detection on.
730+
731+
The commit check is reachability, so an older commit already in the default branch's history can still qualify: for example, a release tag that was merged back into the default branch, scanned with `--commit-sha` and no `--branch`. Pass `--no-default-branch` when a scan of such a ref must not change the default branch.
732+
733+
With `--commit-sha`, that commit supplies the commit message (unless `--commit-message` is set) and the git fallback for the committer, when the checkout has it. `--committers` and CI actor values (`GITHUB_ACTOR`, `GITLAB_USER_LOGIN`, `BITBUCKET_STEP_TRIGGERER_UUID`) still take precedence over the commit's committer.
734+
735+
Example: a GitHub Actions job that runs on `develop`, the default branch, after a release and scans the release tag on `main`:
736+
737+
```yaml
738+
- uses: actions/checkout@v4
739+
with:
740+
ref: v1.2.0
741+
fetch-depth: 0
742+
- name: Scan the release tag
743+
run: socketcli --target-path . --branch main --commit-sha "$(git rev-parse HEAD)"
744+
env:
745+
SOCKET_SECURITY_API_TOKEN: ${{ secrets.SOCKET_SECURITY_API_TOKEN }}
746+
```
747+
748+
`GITHUB_REF` and `GITHUB_SHA` describe `develop`, so without `--branch` and `--commit-sha` the scan would be marked as the default branch with `develop`'s commit message. With them, the scan is recorded on `main` with the tag's commit message and is not marked, because `main` is not the default branch. A job that passes only `--commit-sha` gets the reachability check alone; if the tag commit is also in `develop`'s history, that scan still qualifies, so add `--no-default-branch`.
749+
750+
#### Branch heads
751+
752+
The organization Alerts page shows each repository's branch head scans. A full scan asks to become its branch's head, and the API grants it only on the repository's default branch or a branch that matches the organization's tracked branch patterns (**Settings > Alerts > Scans**). The CLI doesn't know which branches are tracked, so it asks on every eligible run and the API decides. Full scans of untracked branches don't become heads.
753+
754+
- A pull request or merge request scan of a non-default branch doesn't ask, even when no PR number is available.
755+
- A scan marked as the default branch asks on any run, including a pull request run with an explicit `--default-branch`, as in earlier releases.
756+
- If a Git checkout lacks the commit named by `--commit-sha`, the scan only requests a head update when `--default-branch` explicitly marks it.
757+
- `--no-default-branch` never asks. Use it for a scan of a tracked branch that shouldn't update that branch's head.
758+
759+
`--pending-head` is deprecated and has no effect: it is still accepted so existing pipelines keep working, but it logs a warning.
730760
731761
## Who can ignore an alert
732762

‎socketsecurity/config.py‎

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ class CliConfig:
167167
pr_number_explicit: bool = False
168168
commit_message: Optional[str] = None
169169
default_branch: bool = False
170+
no_default_branch: bool = False
170171
target_path: str = "./"
171172
scm: str = "api"
172173
sbom_file: Optional[str] = None
@@ -345,6 +346,7 @@ def _from_args(cls, args_list: Optional[List[str]] = None) -> 'CliConfig':
345346
'pr_number_explicit': pr_number_explicit,
346347
'commit_message': commit_message,
347348
'default_branch': args.default_branch,
349+
'no_default_branch': args.no_default_branch,
348350
'target_path': os.path.expanduser(args.target_path),
349351
'scm': args.scm,
350352
'sbom_file': args.sbom_file,
@@ -502,14 +504,17 @@ def _from_args(cls, args_list: Optional[List[str]] = None) -> 'CliConfig':
502504

503505
if args.pending_head:
504506
logging.warning(
505-
"--pending-head is deprecated and has no effect. A scan becomes the head scan "
506-
"when it runs on the default branch; use --default-branch to mark it as such."
507+
"--pending-head is deprecated and has no effect. Full scans ask to become their "
508+
"branch's head, which the API grants on the default branch and on tracked "
509+
"branches (Settings > Alerts > Scans). Use --no-default-branch to opt out."
507510
)
508511

509512
# argparse only enforces the mutually exclusive group for real CLI args;
510513
# this also catches both values arriving via a --config file.
511514
if args.base_scan_id and args.base_commit_sha:
512515
_usage_error("--base-scan-id and --base-commit-sha are mutually exclusive")
516+
if args.default_branch and args.no_default_branch:
517+
_usage_error("--default-branch and --no-default-branch are mutually exclusive")
513518

514519
if args.sarif_scope == "full" and not args.reach:
515520
_usage_error("--sarif-scope full requires --reach to be specified")
@@ -785,18 +790,27 @@ def create_argument_parser() -> argparse.ArgumentParser:
785790

786791
# Branch and Scan Configuration
787792
config_group = parser.add_argument_group('Branch and Scan Configuration')
788-
config_group.add_argument(
793+
default_branch_group = config_group.add_mutually_exclusive_group()
794+
default_branch_group.add_argument(
789795
"--default-branch",
790796
dest="default_branch",
791797
action="store_true",
792798
help="Make this branch the default branch"
793799
)
794-
config_group.add_argument(
800+
default_branch_group.add_argument(
795801
"--default_branch",
796802
dest="default_branch",
797803
action="store_true",
798804
help=argparse.SUPPRESS
799805
)
806+
default_branch_group.add_argument(
807+
"--no-default-branch",
808+
dest="no_default_branch",
809+
action="store_true",
810+
help="Prevent the scan from changing the repository's default branch or updating a "
811+
"branch head, whatever git or the CI environment detects. Mutually exclusive "
812+
"with --default-branch."
813+
)
800814
# Deprecated no-op, still accepted so existing pipelines don't fail to parse.
801815
config_group.add_argument(
802816
"--pending-head",

‎socketsecurity/core/classes.py‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,12 +383,7 @@ def advisory_id(self) -> str:
383383
return ""
384384

385385
def advisory_ids(self) -> List[str]:
386-
"""Every distinct GHSA and CVE identifier on the alert, GHSA first.
387-
388-
IDs keep the spelling the API sent. advisory_id() still returns a single
389-
ID because consolidation_key() depends on it; this list is for display,
390-
where an alert that carries both a GHSA and a CVE should show both.
391-
"""
386+
"""Return distinct advisory IDs for display, using the API spelling and GHSA first."""
392387
props = getattr(self, "props", None) or {}
393388
ids: List[str] = []
394389
seen = set()

0 commit comments

Comments
 (0)