瀏覽代碼

fix: prevent manage system assignment from manage groups permission

NGPixel 3 年之前
父節點
當前提交
e5cbf6b943
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      server/graph/resolvers/group.js

+ 8 - 0
server/graph/resolvers/group.js

@@ -167,6 +167,14 @@ module.exports = {
         throw new gql.GraphQLError('You are not authorized to manage this group or assign these permissions.')
       }
 
+      // Check assigned permissions for manage:groups
+      if (
+        WIKI.auth.checkExclusiveAccess(req.user, ['manage:groups'], ['manage:system']) &&
+        args.permissions.some(p => _.last(p.split(':')) === 'system')
+      ) {
+        throw new gql.GraphQLError('You are not authorized to manage this group or assign the manage:system permissions.')
+      }
+
       // Update group
       await WIKI.models.groups.query().patch({
         name: args.name,