Yuki Takei 2 месяцев назад
Родитель
Сommit
ddc097b07b
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      apps/app/src/client/util/scope-util.ts

+ 4 - 1
apps/app/src/client/util/scope-util.ts

@@ -17,8 +17,9 @@ function parseSubScope(
 
   for (const action of actions) {
     if (typeof subObjForActions[action] === 'string') {
+      // Safe: parseScopes only accepts SCOPE constant which contains valid Scope strings
       result[`${action.toLowerCase()}:${parentKey.toLowerCase()}`] =
-        subObjForActions[action];
+        subObjForActions[action] as Scope;
       subObjForActions[action] = undefined;
     }
   }
@@ -38,6 +39,7 @@ function parseSubScope(
       for (const action of actions) {
         const val = subObjForActions[action]?.[ck];
         if (typeof val === 'string') {
+          // Safe: parseScopes only accepts SCOPE constant which contains valid Scope strings
           result[`${action.toLowerCase()}:${parentKey.toLowerCase()}:all`] =
             val as Scope;
         }
@@ -87,6 +89,7 @@ export function parseScopes({
       for (const action of actions) {
         const val = scopes[action]?.[key];
         if (typeof val === 'string') {
+          // Safe: parseScopes only accepts SCOPE constant which contains valid Scope strings
           allObj[`${action.toLowerCase()}:all`] = val as Scope;
         }
       }