Skip to content

Commit

Permalink
Show key in pathToPayload
Browse files Browse the repository at this point in the history
  • Loading branch information
Wout Feys committed Aug 21, 2024
1 parent e96017b commit 4479b0d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions aikido_firewall/sources/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,21 @@

def process_xml(user_input, root_element):
"""Extracts all attributes from the xml and adds them to context"""
extracted_xml_attrs = []
for el in root_element:
extracted_xml_attrs += el.items()
context = get_current_context()
if not isinstance(context.body, str) or user_input != context.body:
return

extracted_xml_attrs = dict()
for el in root_element:
for k, v in el.items():
if not extracted_xml_attrs.get(k):
extracted_xml_attrs[k] = set()
extracted_xml_attrs[k].add(v)
extracted_xml_attrs.update(set(el.items()))

reset_userinput_cache_for_given_source("xml")
context.xml += extracted_xml_attrs
context.xml.append(extracted_xml_attrs)
context.set_as_current_context()


@importhook.on_import("xml.etree.ElementTree")
Expand Down

0 comments on commit 4479b0d

Please sign in to comment.