Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Harden governed resource labels

rcourtman18e998acae6a
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index e1fb592891..16182d6494 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -257,6 +257,10 @@ shared unified-resource contract, and their governed labels now flow through
shared `ResourcePolicyLabel(...)` and `ResourcePolicyRedactedValue(...)`
helpers instead of through AI-local presentation shims, so policy copying and
policy-bound labels both stay centralized in the resource model.
+If a governed resource reaches those callers without an AI-safe summary, the
+shared label helper now falls back to the canonical redacted label instead of
+the raw resource name, so missing summary data does not leak governed identity
+through a local fallback path.
The frontend unified-resource hook now trusts backend canonical `policy` and
`aiSafeSummary` values directly, so the canonical summary value stays
aligned with the same policy-aware contract that governs sensitivity and
diff --git a/internal/unifiedresources/code_standards_test.go b/internal/unifiedresources/code_standards_test.go
index 4e36278d6f..28b80da1b4 100644
--- a/internal/unifiedresources/code_standards_test.go
+++ b/internal/unifiedresources/code_standards_test.go
@@ -439,6 +439,8 @@ func TestResourcePolicyLabelHelpersUsedByAIConsumers(t *testing.T) {
},
filepath.Join(".", "policy_presentation.go"): {
"func ResourcePolicyLabel(name, aiSafeSummary string, policy *ResourcePolicy) string",
+ "if ResourcePolicyRequiresGovernedSummary(policy) {",
+ "return ResourcePolicyRedactedLabel",
"func ResourcePolicyRedactedValue(value string, policy *ResourcePolicy, hints ...ResourceRedactionHint) string",
"const ResourcePolicyRedactedLabel = \"redacted by policy\"",
"func ResourceRedactionLabelsFromHints(hints []ResourceRedactionHint) []string",
diff --git a/internal/unifiedresources/policy_metadata_test.go b/internal/unifiedresources/policy_metadata_test.go
index 74feeadce7..8fc637b0a2 100644
--- a/internal/unifiedresources/policy_metadata_test.go
+++ b/internal/unifiedresources/policy_metadata_test.go
@@ -398,6 +398,9 @@ func TestResourcePolicyLabelHelpers(t *testing.T) {
if got := ResourcePolicyLabel(" fallback-name ", " governed summary ", policy); got != "governed summary" {
t.Fatalf("ResourcePolicyLabel() = %q, want governed summary", got)
}
+ if got := ResourcePolicyLabel(" fallback-name ", "", policy); got != ResourcePolicyRedactedLabel {
+ t.Fatalf("ResourcePolicyLabel() with governed policy and empty summary = %q, want redacted label", got)
+ }
if got := ResourcePolicyLabel(" fallback-name ", " governed summary ", nil); got != "fallback-name" {
t.Fatalf("ResourcePolicyLabel() with nil policy = %q, want fallback-name", got)
}
diff --git a/internal/unifiedresources/policy_presentation.go b/internal/unifiedresources/policy_presentation.go
index 8dca922c0b..77aa804c37 100644
--- a/internal/unifiedresources/policy_presentation.go
+++ b/internal/unifiedresources/policy_presentation.go
@@ -247,6 +247,9 @@ func ResourcePolicyLabel(name, aiSafeSummary string, policy *ResourcePolicy) str
if ResourcePolicyUsesAISafeSummary(aiSafeSummary, policy) {
return strings.TrimSpace(aiSafeSummary)
}
+ if ResourcePolicyRequiresGovernedSummary(policy) {
+ return ResourcePolicyRedactedLabel
+ }
return strings.TrimSpace(name)
}