Skip to content

✨ Feature / Metadata validation — scaffolding + spec-conformance rules#20

Merged
docJerem merged 2 commits intomainfrom
feature/xml-validation
Apr 24, 2026
Merged

✨ Feature / Metadata validation — scaffolding + spec-conformance rules#20
docJerem merged 2 commits intomainfrom
feature/xml-validation

Conversation

@docJerem
Copy link
Copy Markdown
Owner

Summary

First slice of the metadata-validation effort tracked in #17 (PR 1 of the PLAN).

  • Introduces public ExSaml.Metadata.validate/1,2 and ExSaml.Metadata.ValidationResult — a structured report of violations, with :ok / :error return semantics and an :ignore option.
  • Implements 14 structural / SAML 2.0 spec-conformance rules, all at :error severity: :invalid_xml, :invalid_root_element, :entities_descriptor_not_supported, :missing_entity_id, :entity_id_too_long, :missing_role_descriptor, :missing_saml2_protocol_support, :missing_acs, :missing_sso_service, :invalid_acs_binding, :missing_http_post_acs, :duplicate_acs_index, :multiple_default_acs, :invalid_slo_binding.
  • XML parsing reuses the XXE-safe :xmerl_scan configuration introduced in 48b6fca (allow_entities: false, namespace_conformant: true).
  • Also bumps credo to 1.7.18 (latest).

Best-practice warnings, strict mode, and certificate linting are deferred to follow-up PRs per the #17 PLAN.

Out of scope for this PR

Test plan

  • mix test — 145/145 passing (20 new in test/ex_saml/metadata_test.exs).
  • mix format --check-formatted — clean.
  • mix credo --strict — no issues.
  • mix sobelow — clean.
  • mix deps.unlock --check-unused — clean.
  • mix dialyzer — passed.
  • CI green on GitHub Actions.

Closes part of #17 (PR 1 of 5).

Introduce ExSaml.Metadata.validate/1,2 and ExSaml.Metadata.ValidationResult,
the first slice of the metadata-validation effort tracked in #17.

This slice covers structural and SAML 2.0 spec-conformance checks only.
Every finding is an :error; best-practice warnings, strict mode, and
certificate linting land in follow-up PRs.

Rules: :invalid_xml, :invalid_root_element, :entities_descriptor_not_supported,
:missing_entity_id, :entity_id_too_long, :missing_role_descriptor,
:missing_saml2_protocol_support, :missing_acs, :missing_sso_service,
:invalid_acs_binding, :missing_http_post_acs, :duplicate_acs_index,
:multiple_default_acs, :invalid_slo_binding.

XML parsing reuses the XXE-safe xmerl_scan configuration introduced in
48b6fca (allow_entities: false, namespace_conformant: true).
@docJerem docJerem merged commit fb3f3db into main Apr 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants