Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

chore(backend:users): validate that role is a number in the user guard

johaven033674c77a44
diff --git a/backend/src/applications/users/guards/roles.guard.ts b/backend/src/applications/users/guards/roles.guard.ts
index 4e6e5ff1..e5312cc9 100644
--- a/backend/src/applications/users/guards/roles.guard.ts
+++ b/backend/src/applications/users/guards/roles.guard.ts
@@ -22,7 +22,7 @@ export class UserRolesGuard implements CanActivate {
// used to bypass the check, the guard is called without argument, the value is '{}'
return true
}
- if (role === undefined) {
+ if (role === undefined || !Number.isFinite(role)) {
this.logger.warn(`no role defined on : ${ctx.getClass().name}:${ctx.getHandler().name}`)
return false
}