monuelo / cast-sh

:pager: An instance of your terminal in your browser
Apache License 2.0
161 stars 26 forks source link

Replace return response for wrong password. #117

Closed PabloLec closed 3 years ago

PabloLec commented 3 years ago

LGTM reported a XSS vulnerability for return json.dumps(request.get_json()). As returning the password given by the user in a XHR response has no particular purpose, it can be replaced by a standard message.

Description

When the password provided by the user is wrong, the server no longer returns the password field value in the XHR response body but returns a regular "Wrong password." message.

Fixes issue \

114

Motivation and Context

The previous combo json.dumps() + user provided string can indeed be used for XSS. Although I'm not sure in this case how a malicious code could be used since the response would not be included in the DOM, thus never possibly executed. I guess better safe than sorry :wink:

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

Checklist:

monuelo commented 3 years ago

Thank you! :)