Skip to content

REF-11 Harden metadata directory handling (#25, #24) - #82

Open
thomasnymand wants to merge 2 commits into
mainfrom
feature/REF-11-fix-github-issues
Open

REF-11 Harden metadata directory handling (#25, #24)#82
thomasnymand wants to merge 2 commits into
mainfrom
feature/REF-11-fix-github-issues

Conversation

@thomasnymand

Copy link
Copy Markdown
Collaborator

Follow-up to #81, which was merged before these two commits landed on the branch. This PR carries the remaining metadata-directory robustness fixes.

Changes

  • Allow README.TXT files in metadata directory #25 — Non-metadata files break config load. ParseFile returns null for a file that isn't SAML 2.0 metadata, but HandleCreateIdp/HandleUpdateIdp dereferenced it immediately, throwing a NullReferenceException that aborted configuration loading (e.g. a README placed in the metadata directory). Such files are now skipped gracefully; ParseFile already traces the reason. Also resolves the intermittent NRE in Metadata document missing causing NullpointerException #72.
  • Improved error handling of misspelled IDPEndpoint ID #24 — Misspelled default IDPEndpoint id. A misspelled id leaves the configured endpoint's metadata null; when selected as the default, RetrieveIDP returned it and the caller hit an opaque NullReferenceException. Now throws a descriptive Saml20Exception naming the id, reusing the previously-unused MetadataNotFound resource (reworded to point at the likely misspelling).

Notes

  • The Improved error handling of misspelled IDPEndpoint ID #24 check is placed at point-of-use (RetrieveIDP) rather than in IDPEndpoints.Initialize(): the test config intentionally declares endpoints without matching metadata files, and Initialize() runs on every config load, so a load-time throw would break the test suite.

Testing

CI (build-and-test) passing on the head commit. No cross-platform build path exists locally (Windows/msbuild only).

🤖 Generated with Claude Code

thomasnymand and others added 2 commits July 1, 2026 19:32
ParseFile returns null for a file that is not SAML 2.0 metadata, but
HandleCreateIdp/HandleUpdateIdp dereferenced the result immediately,
throwing a NullReferenceException that aborted configuration loading
(e.g. when a README is placed in the metadata directory). Skip such
files gracefully; ParseFile already traces why the file was rejected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XFEHBfb5PM63Qi8idztJYG
…ed (#24)

A misspelled id on a configured IDPEndpoint means no metadata file
matches it, leaving metadata null. When such an endpoint was selected
as the default, RetrieveIDP returned it and the caller hit an opaque
NullReferenceException. Throw a descriptive Saml20Exception naming the
id instead. Reuses the previously unused MetadataNotFound resource,
reworded to point at the likely misspelling.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XFEHBfb5PM63Qi8idztJYG
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.

1 participant