feat(seer): Gate Seer agent write requests behind user approval#118223
Draft
gricha wants to merge 1 commit into
Draft
feat(seer): Gate Seer agent write requests behind user approval#118223gricha wants to merge 1 commit into
gricha wants to merge 1 commit into
Conversation
Add a server-side permission gate so the Seer agent cannot perform mutating Sentry API requests without explicit user approval. Agent requests (X-Is-Agent header + trusted viewer-context auth) have their effective scopes masked to read-only, mirroring the demo-mode read-only path, unless an approved SeerAgentWriteGrant covers the required scope. A masked-out write returns a structured 403 challenge with a nonce and approval endpoint; the user approves via a first-party, user-authenticated API. Approval is IDOR-safe: bound to the acting user and organization, and blocked for viewer-context (agent) sessions so the agent cannot self-approve. Flag-gated (organizations:seer-agent-write-gate), default off. Covers OrganizationPermission-derived endpoints; broader coverage is deferred. Co-Authored-By: Claude <noreply@anthropic.com>
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.
What
A server-side gate so the Seer agent can't make mutating Sentry API calls without explicit user approval. Prototype, flag-gated (
organizations:seer-agent-write-gate), default off.How
X-Is-Agentheader + trusted viewer-context auth) has its scopes masked to read-only — the same trick demo mode already uses. Reads pass; writes fail the normal scope check.403with a nonce + approval endpoint, and records a pendingSeerAgentWriteGrant.GET/POST /api/0/organizations/{org}/agent/approve/{nonce}/from their own session. Once approved, the matching scope is unmasked and the agent's retry goes through.Security (IDOR)
Scope / not yet
OrganizationPermission-derived endpoints. Project-scoped and non-ScopedPermissionendpoints aren't gated yet (deferred).Tests
19 tests: masking, challenge, grant unmask/expiry, flag-off no-op, plus the IDOR cases above. Planning artifacts under
openspec/changes/add-agent-write-permission-gate/.