Repository navigation
fix(security): cross-check SAML NameID namespace (GO-2026-6909) - #896
Merged
Merged
Conversation
crewjam/saml (through v0.6.3, no upstream fix) reads Subject.NameID with the bare XML tag xml:"NameID", matching a <NameID> in ANY namespace. A signature-valid assertion omitting <saml:NameID> but carrying a foreign-namespace <NameID> inside <saml:Subject> populates Subject.NameID.Value from the foreign element. mapAssertion trusts that value (provider link id, email fallback) and findOrCreateUser links accounts by email, so the spoofed NameID could reach another account. After ParseResponse, re-parse the raw SAMLResponse namespace-aware and require the extracted NameID to equal a <NameID> in the SAML assertion namespace. Fail closed on a visible mismatch; skip what cannot be inspected (encrypted assertions, absent/undecodable/unparseable response), where ParseResponse remains the authority. Refs #892 (finding 1)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #896 +/- ##
==========================================
- Coverage 90.73% 90.71% -0.02%
==========================================
Files 1370 1370
Lines 140915 140934 +19
==========================================
- Hits 127864 127854 -10
- Misses 13042 13071 +29
Partials 9 9
🚀 New features to boost your workflow:
|
fclairamb
enabled auto-merge (squash)
November 16, 2026 00:15
… runner The slow probes slept a fixed 1.2s, so on a loaded CI runner they finished before the fast results landed and the ordering assertion failed. Sleep 6s so the ordering holds regardless of runner speed. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Merged
fclairamb
added a commit
that referenced
this pull request
Nov 16, 2026
🤖 I have created a release *beep* *boop* --- ## [0.51.0](v0.50.2...v0.51.0) (2026-11-16) ### Features * Pingdom check importer, insights period selector, job retry log levels ([#904](#904)) ([7914164](7914164)) ### Bug Fixes * **security:** bound status page historyDays, mask config tokens in replay, JS websocket redirect policy, docs JWT placeholders ([#903](#903)) ([6b432e0](6b432e0)) * **security:** cap the pre-auth body buffer in ServiceSignature ([#894](#894)) ([c4da4c5](c4da4c5)), closes [#892](#892) * **security:** cross-check SAML NameID namespace (GO-2026-6909) ([#896](#896)) ([df0d7b6](df0d7b6)) * **security:** treat known dev JWT secrets as placeholders ([#895](#895)) ([1cad98a](1cad98a)), closes [#892](#892) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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.
What
Fixes finding 1 of the security review #892 — the reachable half of GO-2026-6909 (
github.com/crewjam/[email protected], no fixed version published).crewjam/saml'sSubjectuses the bare XML tagxml:"NameID", which matches a<NameID>element in any namespace. A signature-valid assertion that omits<saml:NameID>but carries a foreign-namespace<NameID>inside<saml:Subject>populatesSubject.NameID.Valuefrom the foreign element. SolidPing trusts that value:mapAssertionuses it as the provider link id and falls back to it as the account email, andfindOrCreateUserlinks/creates accounts by email — so a spoofed NameID could reach an existing account (including ones that never used SAML).(The advisory's other half — the nil-Issuer panic in
validateAssertion— is not reachable as configured:spBasenever setsExpectedIDPEntityID.govulncheckwill keep flagging the module until upstream ships a fix; this PR removes the reachable exposure.)Fix
New
validateNameIDNamespace, called inHandleACSright afterParseResponse:SAMLResponsewith struct tags spelling out the SAML assertion namespace (encoding/xmlmatches by namespace URI + local name, never by bare local name — verified against the attack shape).<NameID>in the SAML namespace of a visible plaintext assertion; a mismatch (including "no saml:NameID at all" vs a non-empty extracted value) is wrapped intoErrSAMLAssertionInvalid.ParseResponsealready validated signature/conditions/audience there; the guard adds no new rejection reasons for responses it cannot see into.Tests
New
saml_nameid_test.go:TestSAMLHandleACS_HappyPath(real signed assertion from the in-repo fake IdP) still passes through the guard — the wholeauthpackage suite is green.go test ./internal/handlers/auth/green (~60s),golangci-lint0 issues,go build ./...OK.Follow-up (not in this PR)
Track upstream for a fixed
crewjam/saml; the nil-Issuer panic variant would become reachable ifExpectedIDPEntityIDis ever set, so do that together with the upgrade.Refs #892