fix(oauth): require security scopes to list and revoke tokens
/api/oauth_tokens skipped the scope check, so a token with any scope could list the user's sessions and revoke them.
This commit is contained in:
parent
9edce3a0a6
commit
c686b701dd
4 changed files with 50 additions and 22 deletions
|
|
@ -13,7 +13,8 @@ defmodule Pleroma.Web.OAuth.TokenController do
|
|||
require Logger
|
||||
|
||||
plug(:skip_auth when action == :confirm_email)
|
||||
plug(:skip_plug, OAuthScopesPlug when action in [:oauth_tokens, :revoke_token])
|
||||
plug(OAuthScopesPlug, %{scopes: ["read:security"]} when action == :oauth_tokens)
|
||||
plug(OAuthScopesPlug, %{scopes: ["write:security"]} when action == :revoke_token)
|
||||
|
||||
action_fallback(:errors)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue