getsentry / getsentry/sentry

Add audit-only token scope without org:write

Open
#120,692 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Auth Feature
Dominant language
Python
Stars
44.8k
Forks
4.9k
Avg merge
21h 23m
Merged PRs (30d)
607

Description

SIEM and compliance integrations that only need management-plane audit logs currently require org:write because OrganizationAuditPermission gates GET /api/0/organizations/{org_slug}/audit-logs/ on that scope. That forces over-privileged tokens for a read-only use case.

Current behavior

Gap

Customers pulling audit logs into a SIEM cannot mint a least-privilege token limited to audit-log read access. Any token that can call the endpoint also carries broader org write capability.

Requested capability

  • Add a purpose-built audit-only scope (or equivalent token permission) that can read org audit logs.
  • Ensure that scope does not grant org:write or other write/admin org capabilities.
  • Allow auth tokens / org tokens using only that scope to call the audit-logs endpoint.

Requested by Gene Wright via Junior.

--

View Junior Session in Sentry

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading OrganizationAuditPermission in src/sentry/api/bases/organization.py and the request handling in src/sentry/core/endpoints/organization_auditlogs.py. Trace how auth-token and organization-token scopes are represented and checked, then identify the relevant permission tests. Done means an audit-only scope can read the audit-log endpoint without granting org:write or other write/admin capabilities.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, authorization, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.