Skip to content

Commit 72c2f29

Browse files
leliaclaude
andcommitted
Name the token scopes and flag the two the setup guide omits
The permission tables described endpoints but deferred on scope names, since nothing in this repo or the SDK publishes them. The public CI/CD token setup guide does: nine scopes, which the docs now name and map to the calls they cover. That guide omits `diff-scans:create` and `diff-scans:list`. Every diff-producing run tries the diff-scans endpoints first, so a token provisioned exactly as documented always fails that call and falls back to the legacy streaming comparison, with a warning as the only signal. Anyone following the documented setup hits this. The converse is also worth stating: `socketcli` makes no triage or security-policy calls, so three of the nine scopes the guide lists are not exercised by this CLI. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 07b6ed1 commit 72c2f29

2 files changed

Lines changed: 42 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66

77
- Documented the API calls a run actually makes, so a token can be provisioned without
88
trial and error: what every run calls, what diff-producing runs add, and what each
9-
flag adds. Only the diff-scans scope names are published, so the remaining calls are
10-
described by endpoint, with a pointer to support for exact scope identifiers.
9+
flag adds, with the scope names mapped to them.
10+
- Recorded that the published CI/CD token setup guide does not list `diff-scans:create`
11+
or `diff-scans:list`. Every diff-producing run needs both, so a token provisioned
12+
exactly as that guide describes always falls back to the legacy comparison path.
13+
Recorded the converse too: `socketcli` makes no triage or security-policy calls, so
14+
three of the nine scopes that guide lists are not exercised by this CLI.
1115
- Corrected the scan-comparison guidance. The `APIAccessDenied` fallback was documented
1216
as a PR/MR-only condition, but it applies to any run that produces a diff, including
1317
plain pushes on the default branch. The guidance also listed `full-scans:list`

docs/troubleshooting.md

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,42 @@ These are exercised on any invocation, regardless of flags:
2828
| `GET orgs/{org}/full-scans/diff` | Legacy streaming comparison (fallback path) |
2929
| `GET orgs/{org}/full-scans/{id}` | Resolve a baseline for `--base-scan-id` / `--base-commit-sha` |
3030

31-
The diff-scans path is the one with published scope names: `diff-scans:create`,
32-
`diff-scans:list` and `full-scans:list`. For the rest of the calls above, grant the
33-
token access to the corresponding resource; if you need the exact scope identifiers to
34-
provision a least-privilege token, ask Socket support rather than inferring them from
35-
the endpoint paths.
31+
### Which scopes to grant
32+
33+
The [CI/CD token setup guide](https://docs.socket.dev/docs/create-socket-api-key-for-cicd)
34+
tells you to select nine scopes:
35+
36+
`repo:list`, `repo:create`, `repo:update`, `security-policy:read`,
37+
`triage:alerts-list`, `triage:alerts-update`, `full-scans:list`, `full-scans:create`,
38+
`packages:list`
39+
40+
**That list is not sufficient for this CLI.** It does not include `diff-scans:create`
41+
or `diff-scans:list`, which every diff-producing run needs. A token provisioned exactly
42+
as that guide describes will always fall back to the legacy comparison path — see the
43+
next section. Grant those two in addition.
44+
45+
Going the other way, `socketcli` makes no triage or security-policy API calls at all,
46+
so `security-policy:read`, `triage:alerts-list` and `triage:alerts-update` are not
47+
exercised by this CLI. They are on the guide's list for other Socket tooling.
48+
49+
Mapping the remaining scopes to the calls above (inferred from the names; the setup
50+
guide does not publish a per-endpoint mapping):
51+
52+
| Scope | Covers |
53+
|:---|:---|
54+
| `repo:list` | Repository lookup |
55+
| `repo:create` | Repository creation on lookup failure |
56+
| `repo:update` | Setting the scan as repository head / default branch |
57+
| `full-scans:create` | Creating the new scan |
58+
| `full-scans:list` | Reading scans, metadata, streams, and the legacy `full-scans/diff` comparison |
59+
| `diff-scans:create` | Creating the comparison |
60+
| `diff-scans:list` | Resolving and polling the comparison |
61+
| `packages:list` | `POST purl` for license text |
62+
63+
`GET organizations` and `GET report/supported` are not covered by any scope on the
64+
guide's list and appear to be available to any valid org token. If you are provisioning
65+
a least-privilege token and one of these fails, ask Socket support — the scope
66+
identifiers for them are not published.
3667

3768
### What individual flags add
3869

0 commit comments

Comments
 (0)