This commit is contained in:
greeneclipse committed 2026-10-27 14:53:19 +01:00
1 parent c347d2418f
commit 1ad180a052
49 files changed
+6339 -89

No files matched your search

+11 -1
View File
@@ -1124,6 +1124,16 @@ func categoryAttrKeysFromCache(cache *jobScopedCache) map[string]map[string]stru
return cache.categoryAttrKeys
}
// persistAllowedAttrKeys is the post-RunSteps allowlist. Uncategorized attrs were
// already limited to core + supplier spec keys inside RunSteps, so they are only
// sanitized here; re-filtering to core keys would drop the supplier's specs.
func persistAllowedAttrKeys(sets map[string]map[string]struct{}, categoryUID string) map[string]struct{} {
if strings.TrimSpace(categoryUID) == "" {
return nil
}
return allowedAttrKeysFromSets(sets, categoryUID)
}
// allowedAttrKeysFromSets picks category keys when present; empty non-nil → core only.
// When sets is nil, returns nil (sanitize-only / unit tests).
func allowedAttrKeysFromSets(sets map[string]map[string]struct{}, categoryUID string) map[string]struct{} {
@@ -1684,7 +1694,7 @@ func (p *Pipeline) processOne(ctx context.Context, companyID, jobID uuid.UUID, i
syncCategoryName(&result, cache.categoryNamesByUID)
}
// Re-apply after category validation so allowlist matches the persisted category.
allowed := allowedAttrKeysForCategory(cache, result.Category)
allowed := persistAllowedAttrKeys(categoryAttrKeysFromCache(cache), result.Category)
result.Attributes = AttrsForPersist(result.Attributes, allowed)
result.ProcessedAttributes = AttrsForPersist(result.ProcessedAttributes, allowed)
if len(result.ProcessedAttributes) == 0 {