Repository navigation
feat(cli): Add a permission class and an MCP exposure to every command - #1916
Open
sentry-junior[bot] wants to merge 5 commits into
Open
sentry-junior[bot] wants to merge 5 commits into
sentry-junior[bot] wants to merge 5 commits into
Conversation
Every command now declares where agents may run it (`exposure`: exposed, stdio-only, or hidden), and introspection reports its permission class (read, write, destructive, or `method` for `sentry api`). The class comes from the Sentry API requests that `generate:command-api` finds, so commands declare `permission` only where those requests can't settle it. `check:command-access` fails when a command has no exposure or a declaration contradicts its requests. Closes #1880 Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
…etadata Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…etadata Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
This was referenced Nov 3, 2026
3 of 38 tasks
…etadata # Conflicts: # packages/cli/script/generate-command-api.ts # packages/cli/src/lib/introspect.ts Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1880 (
cli-first-mcptasks 1.1 and 1.2). With this,execute_sentry_readandexecute_sentry_write(#1890) andcommand-catalog.json(#1881) can tell what each command may do and where it may run.Permission class: derived, declared only where needed
generate:command-apinow also writessrc/generated/command-api-access.json, which records whether each command's Sentry API requests are read-only (GET/HEAD/OPTIONS) or include writes. These are the same requests behindcommand-api.json, plus the 23 requests outside the public catalog thatcommand-api.jsonleaves out. Without those,dashboard restoreandbuild uploadwould come out as read.lib/introspect.tscombines that file withdestructiveand any declaredpermissionto get each command'spermission:read,write,destructive, ormethod.I derive the class instead of declaring it on all 144 commands because a declaration that only repeats what the requests show can drift.
check:command-accessaccepts apermissiondeclaration only where the requests can't decide the class:event send(DSN ingest) declareswrite;docs list/docs query(POST to the docs service) declareread;sentry apideclaresmethod, meaning each call gets the class of its--method. GET/HEAD/OPTIONS is read and anything else is write; Expose sentry api and sentry schema through the MCP #1893 resolves it per call.The check rejects any other declaration. A GET-only command marked
write, a write command markedread, a declaration that repeats the derived class, andpermissionon a destructive command all fail, and so does a missing exposure. The tests plant each case. Hidden commands need no declaration, but any declaration they make is still checked. A request whose method can't be read counts aswriteat runtime.Exposure
The builder types require
exposure:buildCommand,buildListCommand,buildDeleteCommand, andbuildOrgListCommand(which setsexposed). The check also walks hidden routes.hidden:
auth login,auth logout,cli upgrade,cli setup,cli uninstall,local(all 16),monitor run, plus these, for review:auth refresh,auth switch,auth token,auth(hidden default): session management;auth tokenprints the raw tokenmcp: serves MCP on stdoutsend-envelope,bash-hook: hidden legacy aliasesstdio-only:
init,wasm-split,event send(sends env vars and logfiles),build upload/download,code-mappings upload,dart-symbol-map upload,debug-files(all 6),proguard upload/uuid,react-native gradle/xcode,replay download,snapshots diff/download/upload,sourcemap inject/upload/resolve, and these, for review:release propose-version,release set-commits: local gitauth list,auth status(local credential store;auth status --show-token),info(local config)cli completion,cli defaults,cli feedback,cli fix,cli importEverything else is exposed, including
api,schema,help,docs,status show, andplatform list.Flags that take local paths
FlagInfo.localPathis set for flags whose parser isparseFilePath/parseDirectoryPath, so #1890 can reject them outside stdio. No per-flag declaration is needed. The only exposed command with one issentry api --input.Open for #1890 (not handled here):
issue resolve --in @commitneeds local git. It is a flag value, not a flag, so the execute path has to reject it.cwdwhen the target is omitted. On hosted they need an explicit or session-pinned org/project.event view --web/log view --webopen a browser.The permission class covers effects on Sentry only. Local side effects (config, credentials, files) are what exposure handles.
via @BYK.
--
View Session in Sentry