Skip to content

Commit 7159bbe

Browse files
Reject unsigned LogoutRequest when signature validation is enabled
Previously, ValidateEncodedLogoutRequestPOST silently accepted unsigned SAML LogoutRequest messages when SkipSignatureValidation was false. When validateElementSignature returned ErrMissingSignature, the code fell through and processed the unverified element. Unlike Response handling, LogoutRequest has no secondary assertion signature check, so this allowed completely unsigned requests to be accepted. Return an error instead of falling through when the signature is missing.
1 parent 4ddcc82 commit 7159bbe

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

decode_logout_request.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (sp *SAMLServiceProvider) ValidateEncodedLogoutRequestPOST(encodedRequest s
4949
}
5050

5151
// Parse the raw request - parseResponse is generic
52-
doc, el, err := parseResponse(raw, sp.MaximumDecompressedBodySize)
52+
_, el, err := parseResponse(raw, sp.MaximumDecompressedBodySize)
5353
if err != nil {
5454
return nil, err
5555
}
@@ -58,8 +58,7 @@ func (sp *SAMLServiceProvider) ValidateEncodedLogoutRequestPOST(encodedRequest s
5858
if !sp.SkipSignatureValidation {
5959
el, err = sp.validateElementSignature(el)
6060
if err == dsig.ErrMissingSignature {
61-
// Unfortunately we just blew away our Response
62-
el = doc.Root()
61+
return nil, fmt.Errorf("logout request is not signed")
6362
} else if err != nil {
6463
return nil, err
6564
} else if el == nil {

0 commit comments

Comments
 (0)