Skip to content

Commit 90d2a40

Browse files
authored
docs: List the API token scopes Socket Basics needs (#140)
* docs: List the API token scopes Socket Basics needs The docs named the scopes `full-scans` and `socket-basics`, which are not scope names; the API checks `full-scans:create` and `socket-basics:read`. They also left out that Socket Tier 1 needs `full-scans:create`, and that a missing scope never fails the run. - Add an API token scopes section to the parameters reference: a least-privilege scope table, then every Socket API call by step (dashboard configuration, result upload, Socket Tier 1) with the scope it checks, when it is called and how a denial shows up in the log - Note that on an Enterprise organization a key without `socket-basics:read` also loses organization discovery, so `SOCKET_ORG` must be set for the upload - Note which token variables each step reads, and that the Socket npm CLI prefers its own variables over the one Tier 1 passes - Correct the scope names in the README, the GitHub Action guide and the Docker guide, and link them to the new section * docs: Correct org discovery, the engine-download scope and the scope names - The organization is discovered from the key without socket-basics:read on non-Enterprise plans, where the settings call is never made. Four places said discovery always needs the scope. - POST coana-cli/artifacts checks full-scans:create or fixes:list in its handler; it was listed as needing no scope. - A denied settings call logs one warning, "Error loading Socket Basics config: Insufficient permissions", not a separate line before it. - full-scans and socket-basics are the scope groups, which also work. socket-basics:read is the only scope in its group, so the API reports it as socket-basics. - The setup-guide paragraph no longer states which scopes that guide lists, since the list is changing. * chore(deps): Lock the Socket Python SDK at 3.6.3 socketdev 3.6.3 fixes settings.integration_events(), which Socket Basics does not call. The lockfile moves so the image runs the current SDK. The >=3.6.2 floor stays, because the bundled Socket Python CLI pins 3.6.2 exactly and installs on the same system interpreter. * chore(deps): Bundle Socket Python CLI 2.13.1 in the heavy image The heavy and app-tests images move the bundled Socket Python CLI from 2.12.0 to 2.13.1. That release pins socketdev 3.6.3 exactly, so the source-install floor moves to >=3.6.3 with it. The changelog carries the upgrade notes that reach heavy-image users: 2.13.0 changed the CLI's exit codes and made --strict-blocking fail on existing blocking alerts. Socket Basics does not run socketcli itself. The bundled CLI also pins the Coana engine 15.15.2, while Socket Tier 1 still runs 15.15.0 through the npm CLI.
1 parent fe2aadc commit 90d2a40

9 files changed

Lines changed: 167 additions & 31 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,25 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
88

99
## [Unreleased]
1010

11+
### Upgrade notes
12+
- **The heavy image's Socket Python CLI changes its exit codes.** It moves from
13+
2.12.0 to 2.13.1, and 2.13.0 exits `2` for invalid flags (was `1`), `130` for
14+
Ctrl+C (was `2`), and applies `--disable-blocking` and
15+
`--exit-code-on-api-error` to missing tokens and other setup failures.
16+
`--strict-blocking` now also fails on existing blocking alerts. Check any
17+
pipeline step that runs `socketcli` from the heavy image and matches on an
18+
exit code; see the CLI's
19+
[upgrade guidance](https://github.com/SocketDev/socket-python-cli#upgrading-to-2130).
20+
Socket Basics does not run `socketcli` itself, so its own exit codes are
21+
unchanged.
22+
23+
### Changed
24+
- Bundled tools: Socket Python CLI 2.12.0 -> 2.13.1.
25+
- The bundled Socket Python CLI now pins the Coana reachability engine 15.15.2.
26+
Socket Tier 1 runs through the Socket npm CLI, which still pins 15.15.0.
27+
- Socket Python SDK (`socketdev`) 3.6.2 -> 3.6.3, which Socket Python CLI
28+
2.13.1 pins exactly. Source installs now require `socketdev>=3.6.3`.
29+
1130
## [3.5.0] - 2026-11-13
1231

1332
Minor rather than patch: Socket Tier 1 parses `socket_additional_params`

‎Dockerfile.heavy‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# hand. See the note at the top of ./Dockerfile for why.
66
ARG OPENGREP_VERSION=v1.33.1
77
ARG SOCKET_NPM_CLI_VERSION=1.15.0
8-
ARG SOCKET_PYTHON_CLI_VERSION=2.12.0
8+
ARG SOCKET_PYTHON_CLI_VERSION=2.13.1
99
# Socket-built Trivy, pinned by digest — see the note in ./Dockerfile.
1010
ARG TRIVY_IMAGE=ghcr.io/socketdev/trivy:0.76.1@sha256:883da3593a60e311b2ed87c3a55241051b27bba15ffc3ce041ae570cd0f00915
1111

‎README.md‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Socket Enterprise customers can configure Socket Basics directly from the [Socke
154154

155155
![Socket Basics Settings](docs/screenshots/socket_basics_settings.png)
156156

157-
Configure scanning policies, notification channels, and rule sets for your entire organization in one place. Socket Basics loads these settings on every run when its API key has the `socket-basics` scope, and they take precedence over the matching workflow inputs, including fields you leave blank. See [Dashboard Settings and Workflow Inputs](docs/github-action.md#dashboard-settings-and-workflow-inputs) for the exceptions and for setting values per repository.
157+
Configure scanning policies, notification channels, and rule sets for your entire organization in one place. Socket Basics loads these settings on every run when its API key has the `socket-basics:read` scope, and they take precedence over the matching workflow inputs, including fields you leave blank. See [Dashboard Settings and Workflow Inputs](docs/github-action.md#dashboard-settings-and-workflow-inputs) for the exceptions and for setting values per repository.
158158

159159
![Socket Basics Section Config](docs/screenshots/socket_basics_section_config.png)
160160

@@ -164,12 +164,16 @@ Create your `SOCKET_SECURITY_API_KEY` in the [Socket Dashboard](https://socket.d
164164

165165
| Scope | Required for |
166166
|-------|--------------|
167-
| `full-scans` | Submitting scan results to your organization |
168-
| `socket-basics` | Loading scanner configuration from the Socket Dashboard |
167+
| `full-scans:create` | Submitting scan results to your organization, and running Socket Tier 1 reachability |
168+
| `socket-basics:read` | Loading scanner configuration from the Socket Dashboard (Enterprise organizations) |
169169

170-
If Socket Basics is configured from the Socket Dashboard, the `socket-basics` scope is required. If it is missing, you will see `Insufficient permissions` when Socket Basics loads dashboard configuration.
170+
If Socket Basics is configured from the Socket Dashboard, `socket-basics:read` is required. If it is missing, the log shows `Error loading Socket Basics config: Insufficient permissions`, and the scan runs with the workflow inputs alone. On an Enterprise organization the organization is then not discovered from the key either, so results are not uploaded unless `SOCKET_ORG` is set.
171171

172-
If Socket Basics is configured with CLI arguments, environment variables, or a JSON config file, only `full-scans` permissions are required for result submission. Set `SOCKET_ORG` explicitly in your workflow when using this mode.
172+
Each scope sits in a group named by its prefix, and granting the group also works: `full-scans` includes `full-scans:create`, and `socket-basics` contains only `socket-basics:read`.
173+
174+
If Socket Basics is configured with CLI arguments, environment variables, or a JSON config file, only `full-scans:create` is required. Set `SOCKET_ORG` explicitly in your workflow when using this mode.
175+
176+
A missing scope does not change the exit code. See [API token scopes](docs/parameters.md#api-token-scopes) for every Socket API call Socket Basics makes and the scope each one checks.
173177

174178
## 💻 Other Usage Methods
175179

@@ -270,7 +274,7 @@ Add new connectors by:
270274

271275
**Socket API errors / results missing from the dashboard:**
272276
- Ensure `SOCKET_SECURITY_API_KEY` and `SOCKET_ORG` are set correctly
273-
- `No Socket organization configured` in the log means nothing was uploaded: set `SOCKET_ORG`, or use a key with the `socket-basics` scope so the organization can be discovered
277+
- `No Socket organization configured` in the log means nothing was uploaded: set `SOCKET_ORG`. The organization is normally discovered from the key, but on an Enterprise organization that also needs the `socket-basics:read` scope
274278
- `Need at least one file to be uploaded` means the facts file was written outside the scanned workspace; keep `--output` inside it (see [Save Results to File](docs/local-install-docker.md#save-results-to-file))
275279
- Verify your Socket Enterprise subscription is active
276280
- If you see `Insufficient permissions`, confirm your API token has the scopes required for your configuration mode (see [Required API Token Scopes](#required-api-token-scopes))

‎app_tests/Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
ARG GOSEC_VERSION=v2.30.0
1111
ARG OPENGREP_VERSION=v1.33.1
1212
ARG SOCKET_NPM_CLI_VERSION=1.15.0
13-
ARG SOCKET_PYTHON_CLI_VERSION=2.12.0
13+
ARG SOCKET_PYTHON_CLI_VERSION=2.13.1
1414
#
1515
# Socket-built Trivy, pinned by digest and deliberately kept out of Dependabot's
1616
# reach; updated by Socket's trivy-dist release process. See the root

‎docs/github-action.md‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,9 @@ Include these in your workflow's `jobs.<job_id>.permissions` section.
210210
- Without it the scan still runs and comments on the PR, but nothing reaches the Socket dashboard.
211211

212212
**`socket_org`** (optional)
213-
- Discovered from the API key when the key has the `socket-basics` scope. Set it
214-
explicitly when configuring the scan from `with:` inputs instead of the dashboard.
213+
- Discovered from the API key. On an Enterprise organization, discovery also needs
214+
the `socket-basics:read` scope. Set it explicitly when configuring the scan from
215+
`with:` inputs instead of the dashboard.
215216
- Outside the action the same value is `SOCKET_ORG` or `--socket-org`. See the
216217
[name mapping](parameters.md#name-mapping) for the equivalents of every input.
217218

@@ -498,7 +499,7 @@ The dashboard configuration loads when all three of these are true:
498499

499500
- The organization is on a Socket Enterprise plan.
500501
- Socket Basics is enabled for the organization.
501-
- The API key has the `socket-basics` scope.
502+
- The API key has the `socket-basics:read` scope.
502503

503504
Fields you leave blank in the dashboard still count. The dashboard sends a blank
504505
field as an empty value and a switched-off toggle as `false`, and either one
@@ -1111,12 +1112,13 @@ env:
11111112

11121113
**Solutions:**
11131114
1. Provide `socket_security_api_key`. Without it the scan runs locally only.
1114-
2. Check the log for `No Socket organization configured`. Either set `socket_org`
1115-
or use an API key with the `socket-basics` scope so the organization can be
1116-
discovered from the key.
1117-
3. Check the token scopes: `full-scans` is required to upload;
1118-
`socket-basics` is required to load dashboard configuration. `Insufficient
1119-
permissions` in the log means a scope is missing.
1115+
2. Check the log for `No Socket organization configured`, and set `socket_org`.
1116+
The organization is normally discovered from the key, but on an Enterprise
1117+
organization that also needs the `socket-basics:read` scope.
1118+
3. Check the token scopes: `full-scans:create` is required to upload;
1119+
`socket-basics:read` is required to load dashboard configuration.
1120+
`Insufficient permissions` in the log means a scope is missing. See
1121+
[API token scopes](parameters.md#api-token-scopes).
11201122
4. `pr_comment_enabled: 'false'` does **not** affect the upload; results still
11211123
reach the dashboard.
11221124

‎docs/local-install-docker.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -784,13 +784,15 @@ security-scan:
784784

785785
1. `Need at least one file to be uploaded` in the log: the facts file was
786786
written outside the workspace. Use a path under `/workspace` for `--output`.
787-
2. `No Socket organization configured` in the log: set `SOCKET_ORG`, or use an
788-
API key with the `socket-basics` scope so the organization can be discovered.
787+
2. `No Socket organization configured` in the log: set `SOCKET_ORG`. The
788+
organization is normally discovered from the key, but on an Enterprise
789+
organization that also needs the `socket-basics:read` scope.
789790
3. `Socket API key not detected - running in free plan mode`: the key did not
790791
reach the container. Check the `.env` file or `-e` flags and the variable
791792
name (`SOCKET_SECURITY_API_KEY`).
792-
4. `Insufficient permissions`: the key is missing the `full-scans` scope (upload)
793-
or the `socket-basics` scope (dashboard configuration).
793+
4. `Insufficient permissions`: the key is missing the `full-scans:create` scope
794+
(upload) or the `socket-basics:read` scope (dashboard configuration). See
795+
[API token scopes](parameters.md#api-token-scopes).
794796

795797
### PR Comment Not Posted
796798

‎docs/parameters.md‎

Lines changed: 114 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ GitHub Action input is delivered to the container as the environment variable
3737
| `--console-tabular-enabled` | `console_tabular_enabled` | `INPUT_CONSOLE_TABULAR_ENABLED` | `console_tabular_enabled` | Print consolidated findings as tables. |
3838
| `--console-json-enabled` | `console_json_enabled` | `INPUT_CONSOLE_JSON_ENABLED` | `console_json_enabled` | Print consolidated findings as JSON. |
3939
| `--socket-org` | `socket_org` | `SOCKET_ORG` (also `SOCKET_ORG_SLUG`, `INPUT_SOCKET_ORG`) | `socket_org` | Socket organization slug. Not the same thing as `--repo`. |
40-
| —<sup>2</sup> | `socket_security_api_key` | `SOCKET_SECURITY_API_KEY` (also `SOCKET_SECURITY_API_TOKEN`, `SOCKET_API_KEY`, `INPUT_SOCKET_SECURITY_API_KEY`) | `socket_api_key`<sup>3</sup> | Socket API key (`full-scans` scope to upload, `socket-basics` scope to load dashboard config). |
40+
| —<sup>2</sup> | `socket_security_api_key` | `SOCKET_SECURITY_API_KEY` (also `SOCKET_SECURITY_API_TOKEN`, `SOCKET_API_KEY`, `INPUT_SOCKET_SECURITY_API_KEY`) | `socket_api_key`<sup>3</sup> | Socket API key (`full-scans:create` scope to upload, `socket-basics:read` scope to load dashboard config; see [API token scopes](#api-token-scopes)). |
4141
| `--repo` | — | `GITHUB_REPOSITORY` | `repo` | `owner/repo` recorded on the scan and used to find the PR. Discovered from git when omitted. |
4242
| `--branch` | — | `GITHUB_HEAD_REF`, `GITHUB_REF_NAME` | `branch` | Branch recorded on the scan. Discovered from git when omitted. |
4343
| `--pull-request` | — | `GITHUB_PR_NUMBER` (also `INPUT_PR_NUMBER`) | — | PR number. The PR notifier reads the environment variable. |
@@ -701,12 +701,121 @@ export SOCKET_SECURITY_API_KEY="scrt_..."
701701
socket-basics --socket-org your-org-slug --python --secrets
702702
```
703703

704-
The key needs the `full-scans` scope to upload results and the `socket-basics`
705-
scope to load dashboard configuration. With the latter the organization is
706-
discovered from the key; otherwise set `SOCKET_ORG` explicitly or the run logs
704+
The key needs `full-scans:create` to upload results and `socket-basics:read`
705+
to load dashboard configuration; see [API token scopes](#api-token-scopes).
706+
When `SOCKET_ORG` is not set, the organization is discovered from the key. On
707+
an Enterprise organization that discovery is lost if the key lacks
708+
`socket-basics:read`, so set `SOCKET_ORG` explicitly or the run logs
707709
`No Socket organization configured` and uploads nothing. `--repo` names the
708710
repository, not the organization.
709711

712+
### API token scopes
713+
714+
Socket Basics authenticates with a single Socket organization API token. A
715+
token missing a scope does **not** fail the run. Each Socket API call that is
716+
denied logs an error or a warning and the scan continues, so check the log
717+
rather than the exit code.
718+
719+
#### Scopes to grant
720+
721+
For a least-privilege token, grant these:
722+
723+
| Scope | Needed for |
724+
|:---|:---|
725+
| `full-scans:create` | Uploading results to the Socket dashboard. Socket Tier 1 also needs it to upload manifests and record the reachability scan |
726+
| `socket-basics:read` | Loading scanner configuration from the Socket dashboard, on Enterprise organizations. Without it on an Enterprise organization, the organization is also not discovered from the key |
727+
728+
Scopes are grouped by their prefix, and granting a group grants every scope in
729+
it. The `full-scans` group covers `full-scans:create`, `full-scans:list` and
730+
`full-scans:delete`, so it works here but holds more than Socket Basics uses.
731+
`socket-basics:read` is the only scope in the `socket-basics` group, so
732+
selecting either one is the same token: the dashboard shows both checked, and
733+
the API reports the scope as `socket-basics`.
734+
735+
The scopes each endpoint checks are listed in the
736+
[API reference](https://docs.socket.dev/reference). A few calls check no scope
737+
and work with any valid token for the organization: `GET organizations` and
738+
`GET orgs/{org}/supported-files`.
739+
740+
Socket Basics does not use the `repo:*`, `full-scans:list`, `diff-scans:*`,
741+
`packages:list`, `security-policy:read` or `triage:*` scopes. It never looks up
742+
or creates the repository with a separate call. The repository name travels as
743+
a parameter of the scan upload.
744+
745+
The [CI/CD token setup guide](https://docs.socket.dev/docs/create-socket-api-key-for-cicd)
746+
lists scopes for several Socket tools. Socket Basics needs only the two above.
747+
A token created for the Socket CLIs can upload results if it has
748+
`full-scans:create`. Check that it also has `socket-basics:read` before relying
749+
on dashboard configuration.
750+
751+
#### API calls by run type
752+
753+
**Dashboard configuration**, at startup on every run where the key is set and
754+
no `--config` file is given:
755+
756+
| API call | Scope | Purpose |
757+
|:---|:---|:---|
758+
| `GET organizations` | none | Find the organization (the one named by `SOCKET_ORG`, or the first one the key belongs to) and its plan |
759+
| `GET orgs/{org}/settings/socket-basics` | `socket-basics:read` | Load the dashboard configuration. **Only called when the plan is Enterprise** |
760+
761+
This step reads the key from `SOCKET_SECURITY_API_KEY`,
762+
`SOCKET_SECURITY_API_TOKEN` or `INPUT_SOCKET_SECURITY_API_KEY` only. A key set
763+
only as `SOCKET_API_KEY` or `INPUT_SOCKET_API_KEY` is used for uploads and
764+
Tier 1 but skips this step.
765+
766+
If either call fails, the log shows one warning,
767+
`Error loading Socket Basics config: ...`, and the run continues with the
768+
environment and workflow inputs alone. When the settings call is denied for a
769+
missing scope, that warning reads
770+
`Error loading Socket Basics config: Insufficient permissions`, followed by the
771+
request path. Nothing from this step is kept, including the discovered
772+
organization, so on an Enterprise organization set `SOCKET_ORG` when the key
773+
lacks `socket-basics:read`. On other plans the settings call is never made, and
774+
the organization is discovered without that scope.
775+
776+
**Result upload**, after the scanners finish:
777+
778+
| API call | Scope | Purpose |
779+
|:---|:---|:---|
780+
| `POST orgs/{org}/full-scans` | `full-scans:create` | Upload `.socket.facts.json` as a full scan |
781+
782+
The upload is skipped, without calling the API, when the facts file has no
783+
components, when no key or organization is configured, or when
784+
`SKIP_SOCKET_SUBMISSION=1`. If the repository does not exist in Socket yet, the
785+
upload creates it, and an organization API token needs no scope beyond
786+
`full-scans:create` for that. A denied upload logs
787+
`Failed to submit socket facts file` and does not change the exit code.
788+
789+
**Socket Tier 1** (`--socket-tier1`), unless `SKIP_SOCKET_REACH=1`. Socket
790+
Basics runs the Socket npm CLI (`socket scan reach --org <org>`), which makes
791+
these calls with the same token:
792+
793+
| API call | Scope | Purpose |
794+
|:---|:---|:---|
795+
| `GET organizations` | none | Check that the organization is on an Enterprise plan |
796+
| `GET orgs/{org}/supported-files` | none | Fetch the supported manifest file patterns |
797+
| `POST orgs/{org}/coana-cli/artifacts` | `full-scans:create` or `fixes:list` | Find the reachability engine download. Only called when the engine is not cached, which is every run in a fresh container (see [Network access for Tier 1](#network-access-for-tier-1)) |
798+
| `POST orgs/{org}/upload-manifest-files` | `full-scans:create` | Upload the manifests for analysis |
799+
| `POST tier1-reachability-scan/finalize` | `full-scans:create` | Mark the reachability scan done. A failure here only logs a warning |
800+
801+
The reachability engine (Coana) runs with the same token, and its calls check
802+
`full-scans:create`. The `coana-cli/artifacts`, `upload-manifest-files` and
803+
`tier1-reachability-scan/finalize` endpoints are not in the public API
804+
reference. Options passed through
805+
`socket_additional_params` can make further calls that this table does not
806+
cover.
807+
808+
A Tier 1 failure logs `Error running connector socket_tier1` and does not
809+
change the exit code. Tier 1 passes the key to the Socket npm CLI as
810+
`SOCKET_SECURITY_API_KEY`, but that CLI prefers `SOCKET_CLI_API_TOKEN`,
811+
`SOCKET_CLI_API_KEY` or `SOCKET_SECURITY_API_TOKEN` when one of them is set in
812+
the environment. If you set more than one of these, give them the same token.
813+
814+
The heavy image's Python CLI (`socketcli`) is a separate tool that Socket
815+
Basics does not run. For the scopes it needs, see
816+
[API token permissions](https://github.com/SocketDev/socket-python-cli/blob/main/docs/troubleshooting.md#api-token-permissions)
817+
in its documentation.
818+
710819
### `--socket-tier1`
711820
Enable Socket Tier 1 reachability analysis for dependency scanning.
712821

@@ -1021,7 +1130,7 @@ Configuration is merged in the following order (later sources override earlier o
10211130

10221131
1. Default values
10231132
2. Environment variables, including GitHub Action inputs (the action passes each `with:` input as an `INPUT_*` variable)
1024-
3. Socket Basics dashboard configuration (when the organization is on an Enterprise plan with Socket Basics enabled, the API key has the `socket-basics` scope, and no `--config` file is used)
1133+
3. Socket Basics dashboard configuration (when the organization is on an Enterprise plan with Socket Basics enabled, the API key has the `socket-basics:read` scope, and no `--config` file is used)
10251134
4. JSON configuration file (via `--config`)
10261135
5. Command-line arguments
10271136

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dependencies = [
2828
"light-s3-client~=0.0.30",
2929
"PyYAML>=6.0.0",
3030
"tomli; python_version < '3.11'",
31-
"socketdev>=3.6.2",
31+
"socketdev>=3.6.3",
3232
"jsonschema>=4.25.1",
3333
# requests' CA bundle; 2026.10.19 drops the roots behind the compromised
3434
# eMudhra intermediates. Covers source installs (`pip install -e .`).

0 commit comments

Comments
 (0)