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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Redact action verification audit details
rcourtman3a7efda5f25a
diff --git a/internal/unifiedresources/audit_redaction.go b/internal/unifiedresources/audit_redaction.goindex f8d2eb12da..27b29581b4 100644--- a/internal/unifiedresources/audit_redaction.go+++ b/internal/unifiedresources/audit_redaction.go@@ -2,6 +2,13 @@ package unifiedresourcesimport ("regexp"+ "strings"+)++const (+ auditVerificationCommandRedacted = "[redacted-verification-command]"+ auditVerificationOutputRedacted = "[redacted-verification-output]"+ auditVerificationNoteRedacted = "[redacted-verification-note]")// auditSecretRedactors scrubs well-known credential shapes from audit-log@@ -65,23 +72,32 @@ func RedactAuditText(s string) string {return s}+func redactActionAuditDetailText(s string, replacement string) string {+ if strings.TrimSpace(RedactAuditText(s)) == "" {+ return ""+ }+ return replacement+}+func redactActionVerificationResult(result *ActionVerificationResult) *ActionVerificationResult {redacted := NormalizeActionVerificationResult(result)if redacted == nil {return nil}- redacted.Command = RedactAuditText(redacted.Command)- redacted.Output = RedactAuditText(redacted.Output)- redacted.Note = RedactAuditText(redacted.Note)+ redacted.Command = redactActionAuditDetailText(redacted.Command, auditVerificationCommandRedacted)+ redacted.Output = redactActionAuditDetailText(redacted.Output, auditVerificationOutputRedacted)+ redacted.Note = redactActionAuditDetailText(redacted.Note, auditVerificationNoteRedacted)return redacted}// RedactAuditRecord returns a copy of the input ActionAuditRecord with// known secret shapes scrubbed from the operator-authored reason, the-// params map's string values, execution output, and verification command-// fields. The canonical Plan, Approvals, and identity fields are left-// alone — they are produced by Pulse, not by operators or external-// command output.+// params map's string values, execution output, and error text. Verification+// command/output/note details are policy-hidden as stable markers because+// they can expose sensitive execution context even when no recognizable+// secret pattern is present. The canonical Plan, Approvals, and identity+// fields are left alone — they are produced by Pulse, not by operators or+// external command output.func RedactAuditRecord(record ActionAuditRecord) ActionAuditRecord {record.Request.Reason = RedactAuditText(record.Request.Reason)if len(record.Request.Params) > 0 {diff --git a/internal/unifiedresources/audit_redaction_test.go b/internal/unifiedresources/audit_redaction_test.goindex 105a147b95..be41398cad 100644--- a/internal/unifiedresources/audit_redaction_test.go+++ b/internal/unifiedresources/audit_redaction_test.go@@ -156,25 +156,25 @@ func TestRedactAuditRecord_ScrubsRequestAndResultStringFields(t *testing.T) {if redacted.Verification == nil {t.Fatal("expected top-level verification to remain present")}- if strings.Contains(redacted.Verification.Command, "top-command-secret") || !strings.Contains(redacted.Verification.Command, "systemctl status nginx") {+ if redacted.Verification.Command != auditVerificationCommandRedacted {t.Fatalf("top-level verification command redaction failed: %s", redacted.Verification.Command)}- if strings.Contains(redacted.Verification.Output, "top-output-secret") || !strings.Contains(redacted.Verification.Output, "ActiveState=active") {+ if redacted.Verification.Output != auditVerificationOutputRedacted {t.Fatalf("top-level verification output redaction failed: %s", redacted.Verification.Output)}- if strings.Contains(redacted.Verification.Note, "top-note-secret") || !strings.Contains(redacted.Verification.Note, "verified active") {+ if redacted.Verification.Note != auditVerificationNoteRedacted {t.Fatalf("top-level verification note redaction failed: %s", redacted.Verification.Note)}if redacted.Result.Verification == nil {t.Fatal("expected result verification to remain present")}- if strings.Contains(redacted.Result.Verification.Command, "nested-command-secret") || !strings.Contains(redacted.Result.Verification.Command, "curl -H") {+ if redacted.Result.Verification.Command != auditVerificationCommandRedacted {t.Fatalf("nested verification command redaction failed: %s", redacted.Result.Verification.Command)}- if strings.Contains(redacted.Result.Verification.Output, "nested-output-secret") || !strings.Contains(redacted.Result.Verification.Output, "state") {+ if redacted.Result.Verification.Output != auditVerificationOutputRedacted {t.Fatalf("nested verification output redaction failed: %s", redacted.Result.Verification.Output)}- if strings.Contains(redacted.Result.Verification.Note, "nested-note-secret") || !strings.Contains(redacted.Result.Verification.Note, "nested check") {+ if redacted.Result.Verification.Note != auditVerificationNoteRedacted {t.Fatalf("nested verification note redaction failed: %s", redacted.Result.Verification.Note)}if strings.Contains(redacted.VerificationOutcome.EvidenceSummary, "evidence-secret") {@@ -182,6 +182,68 @@ func TestRedactAuditRecord_ScrubsRequestAndResultStringFields(t *testing.T) {}}+func TestRedactAuditRecord_RedactsVerificationDetailsButPreservesStatusSemantics(t *testing.T) {+ ranAt := time.Date(2026, 5, 6, 12, 30, 0, 0, time.UTC)+ record := ActionAuditRecord{+ ID: "act-detail-redaction",+ CreatedAt: ranAt.Add(-time.Minute),+ UpdatedAt: ranAt,+ State: ActionStateCompleted,+ Request: ActionRequest{+ RequestID: "req-detail-redaction",+ ResourceID: "vm-detail-redaction",+ CapabilityName: "restart",+ Reason: "restart for maintenance",+ RequestedBy: "[email protected]",+ },+ Plan: ActionPlan{+ ActionID: "act-detail-redaction",+ RequestID: "req-detail-redaction",+ Allowed: true,+ Message: "preflight passed",+ },+ Result: &ExecutionResult{+ Success: true,+ Verification: &ActionVerificationResult{+ Ran: true,+ Command: "systemctl is-active customer-service",+ Output: "active since 2026-05-06 with internal unit metadata",+ Success: true,+ RanAt: ranAt,+ Note: "read-back matched expected active state after restart",+ },+ },+ VerificationOutcome: VerificationOutcome{+ Status: VerificationVerified,+ EvidenceSummary: "service active after restart",+ },+ }++ redacted := RedactAuditRecord(record)+ verification := CanonicalActionVerification(redacted)+ if verification == nil {+ t.Fatal("expected verification to remain present")+ }+ if !verification.Ran || !verification.Success || !verification.RanAt.Equal(ranAt) {+ t.Fatalf("verification status semantics were not preserved: %#v", verification)+ }+ if verification.Command != auditVerificationCommandRedacted {+ t.Fatalf("verification command retained raw detail: %q", verification.Command)+ }+ if verification.Output != auditVerificationOutputRedacted {+ t.Fatalf("verification output retained raw detail: %q", verification.Output)+ }+ if verification.Note != auditVerificationNoteRedacted {+ t.Fatalf("verification note retained raw detail: %q", verification.Note)+ }+ if redacted.State != ActionStateCompleted || redacted.Result == nil || !redacted.Result.Success {+ t.Fatalf("action completion semantics were not preserved: state=%q result=%#v", redacted.State, redacted.Result)+ }+ if redacted.Plan.Message != "preflight passed" || redacted.VerificationOutcome.Status != VerificationVerified || redacted.VerificationOutcome.EvidenceSummary != "service active after restart" {+ t.Fatalf("allowed summary/status fields were not preserved: plan=%#v outcome=%#v", redacted.Plan, redacted.VerificationOutcome)+ }+}+func TestRedactAuditRecord_PreservesUnrunVerificationNormalization(t *testing.T) {now := time.Now().UTC()record := ActionAuditRecord{diff --git a/internal/unifiedresources/store_test.go b/internal/unifiedresources/store_test.goindex 316870c7fc..f9fb2417a5 100644--- a/internal/unifiedresources/store_test.go+++ b/internal/unifiedresources/store_test.go@@ -1324,13 +1324,13 @@ func TestActionAuditRecord_RoundTrip(t *testing.T) {if verification == nil || !verification.Ran {t.Fatalf("canonical verification round-trip failed: %+v", verification)}- if strings.Contains(verification.Command, "verify-command-secret") || !strings.Contains(verification.Command, "systemctl is-active 'nginx'") {+ if verification.Command != auditVerificationCommandRedacted {t.Fatalf("canonical verification command redaction failed: %+v", verification)}- if strings.Contains(verification.Output, "verify-output-secret") || !strings.Contains(verification.Output, "active") {+ if verification.Output != auditVerificationOutputRedacted {t.Fatalf("canonical verification output redaction failed: %+v", verification)}- if strings.Contains(verification.Note, "verify-note-secret") || !strings.Contains(verification.Note, "verified via") {+ if verification.Note != auditVerificationNoteRedacted {t.Fatalf("canonical verification note redaction failed: %+v", verification)}if got.Verification == nil || got.Verification.Command != verification.Command {