Skip to content

Require Synapse OAuth scopes on user routes - #5

Merged
anshg1214 merged 2 commits into
mainfrom
feat/oauth-scope
Nov 14, 2026
Merged

anshg1214 merged 2 commits into
mainfrom
feat/oauth-scope

Conversation

@anshg1214

@anshg1214 anshg1214 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Synapse now checks the MetaBrainz OAuth scopes added in metabrainz/metabrainz.org#656.

Scope Routes
synapse:notifications:inbox notification routes (list, unread count, mark read, dismiss) and streams
synapse:notifications every route, including channels, subscriptions and preferences

A browser can hold an inbox-only token: if it leaks, it can't add a webhook channel and receive copies of a user's notifications.

  • Introspection reads scope and caches it with the claims.
  • The user auth middleware picks the scope from the path (middleware.RequiredScope) and returns 403 insufficient_scope naming the missing one.
  • Each /v1/me operation documents its scope in the OpenAPI spec; TestDocumentedScopesMatchEnforced keeps the spec and the middleware in sync.

Deploy after the ListenBrainz client is granted the scopes. Tokens without them get 403.

@anshg1214
anshg1214 merged commit 2d4e0fb into main Nov 14, 2026
1 check passed
@anshg1214
anshg1214 deleted the feat/oauth-scope branch November 14, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant