clegaspi / saml_reader

A tool to parse and verify SAML response data for MongoDB Cloud.
MIT License
7 stars 2 forks source link

SAML Parser cannot handle multiple attributes with the same name #56

Closed clegaspi closed 2 years ago

clegaspi commented 3 years ago

If instead of having a single attribute with multiple values, there are multiple attributes with the same name, the underlying SAML data parser cannot handle this. We should figure out how we can make it do so. Stack trace:

Traceback (most recent call last):
  File "/opt/miniconda3/envs/saml_dev/bin/saml_reader", line 33, in <module>
    sys.exit(load_entry_point('saml-reader', 'console_scripts', 'saml_reader')())
  File "/Users/christian.legaspi/PycharmProjects/saml_reader/saml_reader/cli.py", line 292, in start_saml_reader
    cli(sys.argv[1:])
  File "/Users/christian.legaspi/PycharmProjects/saml_reader/saml_reader/cli.py", line 96, in cli
    source, parsed_args.input_type, filename=filename)
  File "/Users/christian.legaspi/PycharmProjects/saml_reader/saml_reader/text_reader.py", line 69, in __init__
    self._saml = self._parse_raw_data(input_type, raw_data)
  File "/Users/christian.legaspi/PycharmProjects/saml_reader/saml_reader/text_reader.py", line 206, in _parse_raw_data
    return parser.from_xml(data)
  File "/Users/christian.legaspi/PycharmProjects/saml_reader/saml_reader/saml/parser.py", line 159, in from_xml
    return cls(xml)
  File "/Users/christian.legaspi/PycharmProjects/saml_reader/saml_reader/saml/parser.py", line 38, in __init__
    self._parse_saml_values()
  File "/Users/christian.legaspi/PycharmProjects/saml_reader/saml_reader/saml/parser.py", line 82, in _parse_saml_values
    'attributes': self._saml.get_attributes()
  File "/opt/miniconda3/envs/saml_dev/lib/python3.6/site-packages/onelogin/saml2/response.py", line 583, in get_attributes
    OneLogin_Saml2_ValidationError.DUPLICATED_ATTRIBUTE_NAME_FOUND
onelogin.saml2.errors.OneLogin_Saml2_ValidationError: Found an Attribute element with duplicated Name
clegaspi commented 2 years ago

Also fixing #32 in this