AuthZ: log incomplete folder tree (#112151)

This commit is contained in:
Gabriel MABILLE
2025-10-08 21:41:44 +02:00
committed by GitHub
parent d247f3ef4a
commit 1cbe7c8848
+8
View File
@@ -678,6 +678,11 @@ func (s *Service) checkInheritedPermissions(ctx context.Context, scopeMap map[st
ctxLogger.Error("could not build folder and dashboard tree", "error", err)
return false, err
}
if !s.isFolderInTree(tree, req.ParentFolder) {
// Not erroring here as the permission might exist but the folder wasn't synchronized yet
// Once in mode 5 we can deny access here
ctxLogger.Error("parent folder not found in folder tree", "folder", req.ParentFolder)
}
}
if scopeMap["folders:uid:"+req.ParentFolder] {
@@ -724,6 +729,9 @@ func (s *Service) buildFolderTree(ctx context.Context, ns types.NamespaceInfo) (
span.SetAttributes(attribute.Int("num_folders", len(folders)))
tree := newFolderTree(folders)
if len(tree.Nodes) != len(folders) {
s.logger.FromContext(ctx).Warn("mismatched folder count when building tree", "namespace", ns.Value, "expected", len(folders), "got", len(tree.Nodes))
}
s.folderCache.Set(ctx, folderCacheKey(ns.Value), tree)
return tree, nil