Browse Source

saml connector: fix nil pointer on validate saml (#3793)

Signed-off-by: Siarhei Haurylau <siarhei.haurylau@point-devel.com>
pull/3795/head
siarhei-haurylau 1 year ago committed by GitHub
parent
commit
fe08a08923
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      connector/saml/saml.go

5
connector/saml/saml.go

@ -597,6 +597,9 @@ func verifyResponseSig(validator *dsig.ValidationContext, data []byte) (signed [
}
response := doc.Root()
if response == nil {
return nil, false, fmt.Errorf("parse document: empty root")
}
transformedResponse, err := validator.Validate(response)
if err == nil {
// Root element is verified, return it.
@ -609,7 +612,7 @@ func verifyResponseSig(validator *dsig.ValidationContext, data []byte) (signed [
//
// TODO: Only select from child elements of the root.
assertion, err := etreeutils.NSSelectOne(response, "urn:oasis:names:tc:SAML:2.0:assertion", "Assertion")
if err != nil {
if err != nil || assertion == nil {
return nil, false, fmt.Errorf("response does not contain an Assertion element")
}
transformedAssertion, err := validator.Validate(assertion)

Loading…
Cancel
Save