Repository navigation
ref(auth): Rename dashboard:write scope to dashboard:update - #128801
DominikB2014 merged 1 commit into
Conversation
Dashboards have a separate dashboard:create scope, so dashboard:write read as if it included create. Rename it to dashboard:update so the dashboard scopes map to CRUD: read, create, update and delete. dashboard:write is removed rather than kept as an alias. The scopes are still in GRANULAR_SCOPES and only granted to roles behind organizations:granular-permission-scopes, so few stored tokens hold dashboard:write. Those tokens lose dashboard update access unless they also hold org:read, which the dashboard endpoints still accept. Refs ENG-8891
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d0a00bd. Configure here.
| scope_map = { | ||
| **OrganizationDashboardsPermission.scope_map, | ||
| "POST": ["org:read", "org:write", "org:admin", "dashboard:create", "dashboard:write"], | ||
| "POST": ["org:read", "org:write", "org:admin", "dashboard:create"], |
There was a problem hiding this comment.
Update scope cannot create dashboards
Medium Severity
OrganizationDashboardsCreatePermission POST now accepts only dashboard:create and no longer accepts the renamed dashboard:update. Scope checks do not expand the hierarchy at request time, and token creation stores requested scopes as-is, so a token that holds dashboard:update without dashboard:create is denied on create even though update is documented to imply create.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit d0a00bd. Configure here.
There was a problem hiding this comment.
This is fine, we never released granular scopes, it would only break me, because i created a token with dashboards:write, but that's okay
Sentry Snapshot Testing
Base commit |
dashboard:write was renamed to dashboard:update on master (#128801). Update the org:read translation and tests to match. Refs ENG-8841 Co-Authored-By: Dominik Buszowiecki <[email protected]>
We're starting dashboards with read/write scopes instead of full CRUD, and can make them more granular later. This replaces `dashboard:create`, `dashboard:update` and `dashboard:delete` with `dashboard:write`: - `dashboard:read` lists and views dashboards. - `dashboard:write` creates, updates and deletes dashboards, and implies `dashboard:read`. **Changes** - `SENTRY_SCOPES`, `GRANULAR_SCOPES`, the scope hierarchy, scope sets, `ApiScopes` and the granular roles in `conf/server.py` now list `dashboard:read` and `dashboard:write`. - The `org:read` translation adds `dashboard:read` and `dashboard:write`. - The OAuth consent screen shows Dashboards with Read and Write. - Dashboard endpoints accept `dashboard:write` for POST, PUT and DELETE, and the starred endpoint accepts it for PUT. `OrganizationDashboardsCreatePermission` only existed to accept `dashboard:create`, so it's removed. **Rollout** - Getsentry's granular roles and the granular token UI already use `dashboard:write`. Neither was updated for the `dashboard:update` rename (#128801), so this restores update access for members of flagged orgs and makes the token UI's Write level work again. - Follow-ups: a getsentry PR removes `dashboard:create` and `dashboard:delete` from its granular roles, and a frontend PR offers only Read and Write. Neither is needed for this PR to work. - Stored tokens holding `dashboard:create`, `dashboard:update` or `dashboard:delete` lose dashboard access. The granular scope flags are only enabled for test orgs and users, so these are test tokens. Refs ENG-8922


Renames
dashboard:writetodashboard:update.writeisn't as accurate, and confusing if we also have create/delete.writeshould instead be used to wrap create/update/deleteRefs ENG-8891