REF-11 Harden metadata directory handling (#25, #24) - #82
Open
thomasnymand wants to merge 2 commits into
Open
Conversation
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
This was referenced Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ParseFilereturnsnullfor a file that isn't SAML 2.0 metadata, butHandleCreateIdp/HandleUpdateIdpdereferenced it immediately, throwing aNullReferenceExceptionthat aborted configuration loading (e.g. aREADMEplaced in the metadata directory). Such files are now skipped gracefully;ParseFilealready traces the reason. Also resolves the intermittent NRE in Metadata document missing causing NullpointerException #72.idleaves the configured endpoint'smetadatanull; when selected as the default,RetrieveIDPreturned it and the caller hit an opaqueNullReferenceException. Now throws a descriptiveSaml20Exceptionnaming the id, reusing the previously-unusedMetadataNotFoundresource (reworded to point at the likely misspelling).Notes
RetrieveIDP) rather than inIDPEndpoints.Initialize(): the test config intentionally declares endpoints without matching metadata files, andInitialize()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