SAML-Toolkits / python3-saml

MIT License
694 stars 309 forks source link

Malformed XML results in a lxml.etree.XMLSyntaxError exception #27

Closed kjwilcox closed 1 year ago

kjwilcox commented 8 years ago

After creating a OneLogin_Saml2_Auth object with a request that contains malformed XML and calling process_response(), the call will raise a lxml.etree.XMLSyntaxError exception.

This is reasonable behavior, but I think it could be improved. I think that in general, libraries should try to avoid raising exceptions that their dependencies raise. There is already a OneLogin_Saml2_Error exception that is raised in various error cases. What would you think about catching lxml.etree.Error exceptions in OneLogin_Saml2_XML and raising a OneLogin_Saml2_Error exception with a new error code for XML parse failures?

pitbulk commented 8 years ago

I think makes sense. Do you want to collaborate with a PR with unit tests?

kjwilcox commented 8 years ago

Unfortunately, I don't have the available time to submit a PR for this right now. Sorry about that.

We have worked around this issue in our codebase for now by catching lxml.etree.Error exceptions.