RProsalik276985 (Community Member) asked a question.

CWE ID 80 Issue with Python Flask API

I have a small Python Flask API where each one of my return statements has been flagged with "Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS) (CWE ID 80)". Sample python code leading up to the flagged return of the response is:

content = request.get_json()

rtnmsg =

some_function(content)

          response = jsonify(rtnmsg)

          response.mimetype = 'application/json'

          response.status_code = 400

          return response

 

My presumption is the flask

request.get_json() does the sanitation of special characters and json

validation? What should be done additionally to satisfy the CWE ID 80 flagging

of this code?


VCode likes this.

Topics (4)

No articles found
Loading

Ask the Community

Get answers, share a use case, discuss your favorite features, or get input from the community.