Added a sanitizer for replacing newlines.

This commit is contained in:
Joe Farebrother
2024-04-03 16:34:50 +01:00
parent dbbc944f32
commit fa28d94363
2 changed files with 20 additions and 1 deletions

View File

@@ -58,4 +58,13 @@ def flask_make_response_header_arg3():
def flask_make_response_header_arg2():
rfs_header = request.args["rfs_header"]
resp = make_response("hello", {request.args["rfs_header"]: "HeaderValue"}) # BAD
return resp
return resp
@app.route("/flask_escaped")
def flask_escaped():
rfs_header = request.args["rfs_header"]
resp = make_response("hello", {rfs_header.replace("\n", ""): "HeaderValue"}) # GOOD - Newlines are removed from the input.
return resp
# if __name__ == "__main__":
# app.run(debug=True)