Skip to content

docs: List the API token scopes Socket Basics needs - #140

Open
lelia wants to merge 1 commit into
mainfrom
lelia/api-token-scope-docs
Open

lelia wants to merge 1 commit into
mainfrom
lelia/api-token-scope-docs

Conversation

@lelia

@lelia lelia commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Socket Basics needs two API token scopes: full-scans:create and socket-basics:read. The docs named them full-scans and socket-basics, which aren't valid scope names, and said nothing about Socket Tier 1 or about what a missing scope does. A missing scope never fails the run. It only logs, so a misconfigured token goes unnoticed.

Changes

  • New "API token scopes" subsection under Socket Integration in docs/parameters.md:
    • The least-privilege scope set.
    • Every Socket API call by run type (dashboard configuration, result upload, Tier 1), with the scope each endpoint checks, when it's called, and what a failure logs. Scopes come from the API reference.
    • Three Tier 1 endpoints aren't in the reference. Two check full-scans:create. The engine-download endpoint, coana-cli/artifacts, works with any valid token.
  • Scope names corrected in README.md, docs/github-action.md and docs/local-install-docker.md. The README keeps a short version that links to the new subsection.
  • Things worth knowing that weren't documented:
    • On an Enterprise org, a key without socket-basics:read makes the dashboard-config step fail. That step also throws away the org it discovered, so results don't upload unless SOCKET_ORG is set.
    • The dashboard-config step reads only SOCKET_SECURITY_API_KEY, SOCKET_SECURITY_API_TOKEN and INPUT_SOCKET_SECURITY_API_KEY. A key set only as SOCKET_API_KEY skips it.
    • Tier 1 passes the key to the Socket npm CLI as SOCKET_SECURITY_API_KEY, but that CLI prefers SOCKET_CLI_API_TOKEN, SOCKET_CLI_API_KEY or SOCKET_SECURITY_API_TOKEN when one is set. If several are set to different tokens, Tier 1 can use a different token from the rest of the run.
    • The upload creates a missing repository, and an organization API token needs only full-scans:create for that.
    • The CI/CD key guide includes full-scans:create but not socket-basics:read.
  • For the heavy image's bundled socketcli, the docs link to its permissions guide rather than repeating it. Improve documentation for requisite API token permissions socket-python-cli#353 adds that guide, so merge this after #353, or at the same time.

Questions this answers

  • Does Socket Basics need security-policy:read or the triage:* scopes? No. It makes no triage or security-policy calls, and neither does socketcli. So those three scopes on the CI/CD key guide aren't there for either Python tool. The npm CLI's socket ci uses security-policy:read.
  • Does it share the CLI's silent diff-scans fallback? No. Socket Basics never creates diff scans. It uploads a full scan, and Tier 1 runs socket scan reach, neither of which calls the diff-scans endpoints.
  • Where should the docs live? Socket Basics has no page on docs.socket.dev, so this PR puts the scope docs in the repo (docs/parameters.md, with a short version in the README). A docs-site page would be a separate change.

Related PRs

Testing

Docs only. python3 scripts/check_release_docs.py --check passes. Each call was traced in the source: the direct socketdev SDK calls, and the published Socket npm CLI that runs socket scan reach for Tier 1. Options passed through socket_additional_params can make more calls, and the docs say those aren't covered.

Fixes: CE-463
Refs: CE-384

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
@lelia
lelia marked this pull request as ready for review November 14, 2026 02:45
@lelia
lelia requested a review from a team as a code owner November 14, 2026 02:45
@cursor

cursor Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Documentation-only updates with no runtime or configuration code changes.

Overview
Documentation now uses the actual Socket API token scope names — full-scans:create and socket-basics:read — instead of the invalid full-scans / socket-basics labels. README, github-action, local-install-docker, and parameters are aligned, with troubleshooting text explaining that missing scopes log errors but do not fail the exit code, and that lacking socket-basics:read on Enterprise can drop org discovery so uploads need SOCKET_ORG.

The main addition is a new ### API token scopes section in docs/parameters.md: least-privilege scope table, API calls grouped by dashboard config, result upload, and Socket Tier 1 (with per-endpoint scope requirements and failure behavior), plus notes on which env vars participate in dashboard loading, Tier 1 CLI token precedence, and a link to the Python CLI permissions doc.

Reviewed by Cursor Bugbot for commit 66eba35. Configure here.

@lelia

lelia commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

bugbot run

@lelia lelia added the documentation Improvements or additions to documentation label Nov 14, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 66eba35. Configure here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant