Files
codeql/python/ql/test/experimental/CWE-074/xslt.py
Porcupiney Hairs 1ceb963d4c Python : Add support for detecting XSLT Injection
This PR adds support for detecting XSLT injection in Python.
I have included the ql files as well as the tests with this.
2020-06-07 03:05:50 +05:30

15 lines
335 B
Python

from lxml import etree
from io import StringIO
from flask import Flask, request
app = Flask(__name__)
@app.route("/xslt")
def bad():
xsltQuery = request.args.get('xml', '')
xslt_root = etree.XML(xsltQuery)
f = StringIO('<foo><bar></bar></foo>')
tree = etree.parse(f)
result_tree = tree.xslt(xslt_root) # Not OK