Skip to content

AttributeError: 'NoneType' object has no attribute 'version' #603

@spaceone

Description

@spaceone

The error handling for invalid SAML messages is broken:

Traceback (most recent call last):
    response = self.sp.parse_authn_request_response(message, binding, self.outstanding_queries)
  File "/usr/lib/python2.7/dist-packages/saml2/client_base.py", line 711, in parse_authn_request_response
    binding, **kwargs)
  File "/usr/lib/python2.7/dist-packages/saml2/entity.py", line 1202, in _parse_response
    response = response.verify(keys)
  File "/usr/lib/python2.7/dist-packages/saml2/response.py", line 1041, in verify
    res = self._verify()
  File "/usr/lib/python2.7/dist-packages/saml2/response.py", line 400, in _verify
    assert self.response.version == "2.0"
AttributeError: 'NoneType' object has no attribute 'version'

We would like to present a user friendly error message instead of this traceback in case of errors. Would be nice to mask this better, there are exceptions for signature error etc.

Reproducible by e.g. prepending anything invalid to the SAML message. e.g.:
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE saml2p:response [<!ELEMENT saml2p:response ANY ><!ENTITY xxe SYSTEM "file:///etc/shadow" >] ><saml2p:response>&xxe;</saml2p:response>

Code Version

v4.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions