mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-20 07:12:18 +00:00
🔒️(backend) enhance scope manipulation
Enhance scope manipulation by normalizing and sanitizing scope values before processing. Scopes are now converted to lowercase to ensure consistent behavior, deduplicated while preserving their original order, and handled in a deterministic way aligned with the intended authorization model.
This commit is contained in:
committed by
aleb_the_flash
parent
44d68a9c80
commit
5d6ad3f3f6
@@ -57,6 +57,9 @@ class BaseScopePermission(permissions.BasePermission):
|
||||
if isinstance(token_scopes, str):
|
||||
token_scopes = token_scopes.split()
|
||||
|
||||
# Ensure scopes is a deduplicated list (preserving order) and lowercase all scopes
|
||||
token_scopes = list(dict.fromkeys(scope.lower() for scope in token_scopes))
|
||||
|
||||
if settings.OIDC_RS_SCOPES_PREFIX:
|
||||
token_scopes = [
|
||||
scope.removeprefix(f"{settings.OIDC_RS_SCOPES_PREFIX}:")
|
||||
|
||||
Reference in New Issue
Block a user