fix: Disallow invalid scopes (#12099)

This commit is contained in:
Tom Moor authored and GitHub committed 2026-04-18 03:26:08 +00:00
1 parent 505082b196
commit 04debcb607
2 files changed
+7 -1

No files matched your search

@@ -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);
});
});
});
+1 -1
View File
@@ -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;
}