Skip to content

Require Destination on all SAML responses#660

Open
aashh wants to merge 1 commit intocrewjam:mainfrom
aashh:fix/issue-12
Open

Require Destination on all SAML responses#660
aashh wants to merge 1 commit intocrewjam:mainfrom
aashh:fix/issue-12

Conversation

@aashh
Copy link

@aashh aashh commented Feb 9, 2026

The Destination check in parseResponse is gated on responseHasSignature || response.Destination != "". When the response envelope is unsigned (common - many IdPs only sign the assertion) and Destination is absent, validation is not performed. This allows captured responses to be replayed to different SPs.

For unsigned responses, Destination is the only non-cryptographic binding to the intended SP. Without this check, an attacker who captures a response can replay it to any SP that trusts the same IdP.

Fix: Require Destination unconditionally. The SAML spec says Destination MUST be present for signed responses and SHOULD be present otherwise. This PR enforces MUST in both cases for defense-in-depth.

Breaking Change: This is technically breaking - unsigned responses without Destination that were previously accepted will now be rejected. However, this configuration is spec non-compliant, represents a real security gap, and most IdPs include Destination by default.

Changes:

  • service_provider.go: Remove conditional, always require Destination
  • service_provider_test.go: Update tests, add unsigned-without-Destination test

Testing:

  • Signed response with Destination: accepted
  • Unsigned response with Destination: accepted
  • Unsigned response without Destination: now rejected (breaking)
  • All existing tests pass (all had Destination)

Fixes aashh#12

Previously, unsigned responses with an empty Destination were accepted
without any Destination validation. This allowed an attacker to replay
a captured response to a different SP, since the Destination was the
only non-cryptographic binding to the intended recipient.

Now Destination is always required and validated, regardless of whether
the response is signed. The SAML spec says Destination MUST be present
on signed responses and SHOULD be present otherwise — we upgrade the
SHOULD to a MUST for defense in depth.

Fixes #12
@aashh aashh requested a review from crewjam as a code owner February 9, 2026 19:35
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.

Empty Destination accepted on unsigned responses

1 participant