You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 06869b4
Browse filesBrowse the repository at this point in the historyBrowse files
Scope the repository lookup to diff-producing runs
Only a diff-producing run that takes its baseline from the repository's
head scan looks the repository up, and so only that run can create it
or exit 2. A full-scan run uploads straight to full-scans, which creates
a missing repository for an organization-wide token. A failed streaming
fallback also only points at full-scans:list when it fails with
Insufficient permissions.
Copy file name to clipboardExpand all lines: docs/troubleshooting.md
+18-12Lines changed: 18 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,9 +12,9 @@ For a least-privilege CI token, grant these:
12
12
13
13
| Scope | Needed for |
14
14
|:---|:---|
15
-
|`repo:list`| Looking up the repository and its head scan, on every run|
16
-
|`repo:create`| Creating the repository on its first scan. Without it, a scan of a repository Socket has not seen yet exits `2`; see [below](#a-missing-repository-permission-can-exit-2)|
17
-
|`full-scans:create`| Creating the scan, on every run. `--reach` also uploads manifests and finalizes the reachability scan under this scope|
15
+
|`repo:list`| Looking up the repository's head scan to compare against, on diff-producing runs without `--base-scan-id` or `--base-commit-sha`|
16
+
|`repo:create`| Creating the repository when that lookup finds none. Without it, the first comparison for a repository Socket has not seen yet exits `2`; see [below](#a-missing-repository-permission-can-exit-2)|
17
+
|`full-scans:create`| Creating the scan, on every run. On a full-scan run with an organization-wide token, the upload also creates a missing repository under this scope. `--reach` also uploads manifests and finalizes the reachability scan under it|
18
18
|`full-scans:list`| Every comparison, the `--base-commit-sha` lookup, and fetching scan contents for `--enable-json`, `--enable-sarif`, `--enable-gitlab-security` and `--generate-license` on a full scan |
19
19
|`diff-scans:create`| Creating the comparison on a diff-producing run |
20
20
|`diff-scans:list`| Polling for the comparison, and finding an existing one |
@@ -53,14 +53,15 @@ Every run:
53
53
|:---|:---|:---|
54
54
|`GET organizations`| none | Resolve the org ID and slug from the token |
55
55
|`GET report/supported`| none | Fetch supported manifest patterns. On failure the CLI uses a bundled list that covers fewer ecosystems |
56
-
|`GET orgs/{org}/repos/{repo}`|`repo:list`| Look up the repository and its head scan |
57
-
|`POST orgs/{org}/repos`|`repo:create`| Create the repository, **only attempted if the lookup above fails**|
58
-
|`POST orgs/{org}/full-scans`|`full-scans:create`| Create the new scan, and the temporary empty baseline on a first scan |
56
+
|`POST orgs/{org}/full-scans`|`full-scans:create`| Create the new scan. With an organization-wide token, the server creates the repository if it does not exist yet |
59
57
60
58
Diff-producing runs (see [which runs compare](#apiaccessdenied-on-the-scan-comparison)) add:
61
59
62
60
| API call | Scope | Purpose |
63
61
|:---|:---|:---|
62
+
|`GET orgs/{org}/repos/{repo}`|`repo:list`| Look up the repository's head scan as the baseline. Skipped with `--base-scan-id` or `--base-commit-sha`|
63
+
|`POST orgs/{org}/repos`|`repo:create`| Create the repository, **only attempted if the lookup above fails**|
64
+
|`POST orgs/{org}/full-scans`|`full-scans:create`| Create a temporary empty baseline when the repository has no head scan yet |
64
65
|`POST orgs/{org}/diff-scans/from-ids`|`diff-scans:create` and `full-scans:list`| Create the comparison (preferred path) |
65
66
|`GET orgs/{org}/diff-scans`|`diff-scans:list`| Find the existing comparison when creation returns 409 |
66
67
|`GET orgs/{org}/diff-scans/{id}`|`diff-scans:list`| Poll for the computed comparison |
@@ -105,7 +106,9 @@ run, that is why the warning can appear in a log with no pull request in sight.
105
106
**Which scope is missing.** The fallback calls `GET orgs/{org}/full-scans/diff`, which
106
107
checks `full-scans:list`. If the fallback produces results, the token already has
107
108
`full-scans:list`, so the missing grant is `diff-scans:create`, `diff-scans:list`, or
108
-
both. If the fallback also fails, `full-scans:list` is missing too.
109
+
both. If the fallback also fails with `Insufficient permissions`, `full-scans:list`
110
+
is missing too. A fallback that fails another way, such as a timeout or a dropped
111
+
connection, says nothing about scopes.
109
112
110
113
**Why the diff-scans path is preferred.** It polls with short, bounded requests rather
111
114
than holding one connection open while the backend computes, which is what lets large
@@ -121,17 +124,20 @@ total before assuming either path is at fault.
121
124
122
125
## A missing repository permission can exit 2
123
126
124
-
If the repository lookup fails, the CLI assumes the repo does not exist yet and tries
127
+
A diff-producing run looks up the repository to find the head scan it compares
128
+
against. If that lookup fails, the CLI assumes the repo does not exist yet and tries
125
129
to create it. When the token cannot do either, the run exits with code **2** — which
126
130
[the exit code table](../README.md#exit-codes) otherwise documents as a keyboard
127
131
interrupt. That exit also bypasses `--disable-blocking` and `--exit-code-on-api-error`,
128
132
so it fails the pipeline even when you have asked for infrastructure errors to be
129
133
non-blocking.
130
134
131
-
This usually happens on the first scan of a repository Socket has not seen, when the
132
-
token lacks `repo:create`. A token without `repo:list` can end up here even for
133
-
a repository that exists, because its lookup fails and the CLI then tries to create it. The log shows `API failure while creating repository`, and on a
134
-
403 adds:
135
+
This usually happens on the first comparison for a repository Socket has not seen,
136
+
when the token lacks `repo:create`. A token without `repo:list` can end up here even
137
+
for a repository that exists, because its lookup fails and the CLI then tries to
138
+
create it. Full-scan runs, such as SCM-integrated branch pushes, and runs with
139
+
`--base-scan-id` or `--base-commit-sha` skip the lookup, so they never take this
140
+
path. The log shows `API failure while creating repository`, and on a 403 adds:
135
141
136
142
```
137
143
A 403 here usually means the API token is missing the repo:create scope.
0 commit comments