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.

Preserve existing SAML parser failure categories in evidence tests

pulse-triage[bot]c44b176ee595
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 2043fb1d2b..68e089bf85 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -10566,3 +10566,5 @@ only diagnostic evidence, not agent credentials, enrolment, saved provider
settings, certificate trust or authentication. The adjacent
`TestContractSSOSAMLDiagnosticConsumer` proves read-only authenticated results,
correct audit verdicts and unchanged saved secrets/local administrator recovery.
+Existing XML-parser failures keep their original categories; this evidence
+check only runs after that parser succeeds.
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 6b2f59a680..3a31da0796 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -13005,15 +13005,17 @@ are not a claim of an installed leak or native identity-provider recovery.
### SAML Test reports metadata evidence, not sign-in acceptance
-The existing SSO diagnostic on `internal/api/identity_sso_handlers.go` requires
-nonblank IdP identity and an HTTP(S) SSO endpoint in a supported binding before
+After the existing XML parser succeeds, the SSO diagnostic on
+`internal/api/identity_sso_handlers.go` requires nonblank IdP identity and an HTTP(S) SSO endpoint in a supported binding before
returning metadata success. Incomplete, unsupported or credential-bearing
endpoints return `metadata_incomplete` without success details; selected metadata
cannot fall back to manual settings. Success says only that identity and an SSO
URL were found, explicitly not that sign-in was tested. The manual path checks
URL format only and explicitly leaves certificates and sign-in untested.
Certificate information remains informational; no new trust, save or login
-policy is introduced. `TestSAMLConnectionRequiresMetadataEvidence` covers format
+policy is introduced. The existing parser still rejects malformed endpoint URLs
+as `parse_failed` (or `fetch_failed` for fetched XML), before evidence checking.
+`TestSAMLConnectionRequiresMetadataEvidence` covers format
and evidence boundaries; `TestContractSSOSAMLDiagnosticConsumer` exercises the
authenticated route, exact wire results, audit verdicts and unchanged settings,
files, saved secrets and local administrator recovery. Existing fetch/parse
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index b373b88867..900e1c4532 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -7996,3 +7996,5 @@ authority, saves no configuration and changes no sign-in service policy.
`TestContractSSOSAMLDiagnosticConsumer` binds the real authenticated diagnostic,
audit success/failure and preserved settings/files/secrets/admin access. Actual
native sign-in and installed recovery remain distinct evidence.
+Existing XML-parser failures keep their original categories; this evidence
+check only runs after that parser succeeds.
diff --git a/internal/api/sso_saml_test_evidence_test.go b/internal/api/sso_saml_test_evidence_test.go
index 96aaebe14c..894be4fa70 100644
--- a/internal/api/sso_saml_test_evidence_test.go
+++ b/internal/api/sso_saml_test_evidence_test.go
@@ -30,19 +30,19 @@ func samlDiagnosticDescriptor(binding, endpoint, keys string) string {
}
func TestSAMLConnectionRequiresMetadataEvidence(t *testing.T) {
- for _, tt := range []struct{ name, entity, descriptor string }{
- {"empty metadata", "", ""},
- {"no IdP descriptor", "urn:synthetic:idp", ""},
- {"SP only", "urn:synthetic:idp", `<SPSSODescriptor/>`},
- {"missing identity", "", samlDiagnosticDescriptor(saml.HTTPRedirectBinding, "https://idp.example.test/sso", "")},
- {"blank identity", " &#x9;&#x2003;", samlDiagnosticDescriptor(saml.HTTPRedirectBinding, "https://idp.example.test/sso", "")},
- {"missing endpoint", "urn:synthetic:idp", samlDiagnosticDescriptor(saml.HTTPRedirectBinding, "", "")},
- {"no endpoints", "urn:synthetic:idp", `<IDPSSODescriptor/>`},
- {"unsupported binding", "urn:synthetic:idp", samlDiagnosticDescriptor("urn:unsupported:binding", "https://idp.example.test/sso", "")},
- {"relative endpoint", "urn:synthetic:idp", samlDiagnosticDescriptor(saml.HTTPRedirectBinding, "/sso", "")},
- {"unsafe endpoint", "urn:synthetic:idp", samlDiagnosticDescriptor(saml.HTTPPostBinding, "javascript:SYNTHETIC_PRIVATE", "")},
- {"credentialled endpoint", "urn:synthetic:idp", samlDiagnosticDescriptor(saml.HTTPPostBinding, "https://synthetic:[email protected]/sso", "")},
- {"blank endpoint", "urn:synthetic:idp", samlDiagnosticDescriptor(saml.HTTPPostBinding, " &#x9;", "")},
+ for _, tt := range []struct{ name, entity, descriptor, code string }{
+ {"empty metadata", "", "", "metadata_incomplete"},
+ {"no IdP descriptor", "urn:synthetic:idp", "", "metadata_incomplete"},
+ {"SP only", "urn:synthetic:idp", `<SPSSODescriptor/>`, "metadata_incomplete"},
+ {"missing identity", "", samlDiagnosticDescriptor(saml.HTTPRedirectBinding, "https://idp.example.test/sso", ""), "metadata_incomplete"},
+ {"blank identity", " &#x9;&#x2003;", samlDiagnosticDescriptor(saml.HTTPRedirectBinding, "https://idp.example.test/sso", ""), "metadata_incomplete"},
+ {"missing endpoint", "urn:synthetic:idp", samlDiagnosticDescriptor(saml.HTTPRedirectBinding, "", ""), "parse_failed"},
+ {"no endpoints", "urn:synthetic:idp", `<IDPSSODescriptor/>`, "metadata_incomplete"},
+ {"unsupported binding", "urn:synthetic:idp", samlDiagnosticDescriptor("urn:unsupported:binding", "https://idp.example.test/sso", ""), "metadata_incomplete"},
+ {"relative endpoint", "urn:synthetic:idp", samlDiagnosticDescriptor(saml.HTTPRedirectBinding, "/sso", ""), "parse_failed"},
+ {"unsafe endpoint", "urn:synthetic:idp", samlDiagnosticDescriptor(saml.HTTPPostBinding, "javascript:SYNTHETIC_PRIVATE", ""), "parse_failed"},
+ {"credentialled endpoint", "urn:synthetic:idp", samlDiagnosticDescriptor(saml.HTTPPostBinding, "https://synthetic:[email protected]/sso", ""), "metadata_incomplete"},
+ {"blank endpoint", "urn:synthetic:idp", samlDiagnosticDescriptor(saml.HTTPPostBinding, " &#x9;", ""), "parse_failed"},
} {
t.Run(tt.name, func(t *testing.T) {
result := (&Router{}).testSAMLConnection(t.Context(), &SAMLTestConfig{
@@ -51,10 +51,12 @@ func TestSAMLConnectionRequiresMetadataEvidence(t *testing.T) {
IDPSSOURL: "https://manual.example.test/sso",
})
require.False(t, result.Success)
- require.Equal(t, "metadata_incomplete", result.Error)
+ require.Equal(t, tt.code, result.Error)
require.Nil(t, result.Details, "incomplete evidence must not be presented as validated details")
- require.Contains(t, result.Message, "test again")
- require.Contains(t, result.Message, "Sign-in has not been tested.")
+ if tt.code == "metadata_incomplete" {
+ require.Contains(t, result.Message, "test again")
+ require.Contains(t, result.Message, "Sign-in has not been tested.")
+ }
require.NotContains(t, result.Message, "SYNTHETIC_PRIVATE")
})
}