mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
fix: Disallow invalid scopes (#12099)
This commit is contained in:
@@ -347,5 +347,11 @@ describe("OAuthInterface", () => {
|
||||
const result = await OAuthInterface.validateScope(user, client, scope);
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
|
||||
it("should reject if any requested scope is invalid", async () => {
|
||||
const scope = [Scope.Read, "*"];
|
||||
const result = await OAuthInterface.validateScope(user, client, scope);
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -395,7 +395,7 @@ export const OAuthInterface: RefreshTokenModel &
|
||||
const scopes = Array.isArray(scope) ? scope : [scope];
|
||||
const validAccessScopes = Object.values(Scope);
|
||||
|
||||
return scopes.some((s: string) => {
|
||||
return scopes.every((s: string) => {
|
||||
if (validAccessScopes.includes(s as Scope)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user