From ae26d2756f6fe50f99a8d3f9e346032eef5c1cbd Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 16 Sep 2021 10:58:51 +0200 Subject: [PATCH] providers/saml: improved error handling Signed-off-by: Jens Langhammer --- authentik/providers/saml/processors/request_parser.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/authentik/providers/saml/processors/request_parser.py b/authentik/providers/saml/processors/request_parser.py index 7fb51904e..fcfeed25e 100644 --- a/authentik/providers/saml/processors/request_parser.py +++ b/authentik/providers/saml/processors/request_parser.py @@ -59,6 +59,10 @@ class AuthNRequestParser: ) -> AuthNRequest: root = ElementTree.fromstring(decoded_xml) + if "AssertionConsumerServiceURL" not in root.attrib: + msg = "Missing 'AssertionConsumerServiceURL' attribute" + LOGGER.warning(msg) + raise CannotHandleAssertion(msg) request_acs_url = root.attrib["AssertionConsumerServiceURL"] if self.provider.acs_url.lower() != request_acs_url.lower(): @@ -66,7 +70,7 @@ class AuthNRequestParser: f"ACS URL of {request_acs_url} doesn't match Provider " f"ACS URL of {self.provider.acs_url}." ) - LOGGER.info(msg) + LOGGER.warning(msg) raise CannotHandleAssertion(msg) auth_n_request = AuthNRequest(id=root.attrib["ID"], relay_state=relay_state)