fix: enforce group file upload governance

This commit is contained in:
richjohnrambo
2026-10-17 17:08:52 +08:00
parent 178ecff21f
commit 4c2c35b55b
3 changed files with 634 additions and 0 deletions
+13
View File
@@ -518,9 +518,22 @@ func authorizeUploadTopicLink(tenantID types.TenantID, uid types.Uid, topic stri
if !sub.ModeWant.IsReader() || !sub.ModeGiven.IsReader() {
return types.ErrPermissionDenied
}
if types.GetTopicCat(topic) == types.TopicCatGrp {
settings, err := store.GroupBusiness.GetSettings(tenantID, topic)
if err != nil {
return err
}
if settings != nil && !canUploadGroupFile(settings, sub.ModeGiven) {
return types.ErrPermissionDenied
}
}
return nil
}
func canUploadGroupFile(settings *types.GroupSettings, mode types.AccessMode) bool {
return settings == nil || settings.MemberUploadFiles || mode.IsAdmin()
}
func authorizeLargeFileDownload(tenantID types.TenantID, uid types.Uid, rawURL string, fd *types.FileDef) error {
if fd == nil {
return types.ErrNotFound