fix(security): close six open GHSA findings from security triage

Harden share-link listing, password rotation, OIDC callback binding,
org invite search, knowledge batch mutations, and connector redirects.
This commit is contained in:
wizardchen
2026-07-02 14:49:27 +08:00
committed by lyingbug
parent fc64751f4e
commit f23c674bad
12 changed files with 400 additions and 34 deletions
+29
View File
@@ -247,6 +247,35 @@ func (h *WikiPageHandler) KBCreatorLookupFromKBPath(c *gin.Context) (string, err
return kb.CreatorID, nil
}
// resolveKBCreatorByKBID resolves a KB id to CreatorID, scoped to the
// caller's tenant. Used by cross-KB handlers whose body carries kb_id
// instead of a URL param (batch-delete, move, etc.).
func resolveKBCreatorByKBID(
c *gin.Context,
kbService interfaces.KnowledgeBaseService,
kbID string,
) (string, error) {
ctx := c.Request.Context()
tenantID, ok := types.TenantIDFromContext(ctx)
if !ok {
return "", errors.New("tenant context missing")
}
kb, err := kbService.GetKnowledgeBaseByID(ctx, kbID)
if err != nil {
if errors.Is(err, apprepo.ErrKnowledgeBaseNotFound) {
return "", middleware.ErrResourceNotFound
}
return "", err
}
if kb == nil {
return "", middleware.ErrResourceNotFound
}
if kb.TenantID != tenantID {
return "", middleware.ErrResourceNotFound
}
return kb.CreatorID, nil
}
// resolveKBCreatorByKnowledgeID is the shared body for the knowledge /
// chunk lookups. The service-layer chain helper does the tenant-scoped
// fetch (knowledge -> KB) and returns repository sentinel errors;