Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix XSS vulnerability in HTML utility functions #9

Merged
merged 2 commits into from Dec 6, 2022
Merged

Conversation

0-GEE
Copy link
Contributor

@0-GEE 0-GEE commented Nov 17, 2022

Currently, the HTML utility functions defined in utils/html_utils.py do not perform any escaping/sanitization on the strings passed to them before formatting the strings into the HTML to be returned.
Jinja does not sanitize the strings either as the HTML returned by this function is stored in JSON and eventually rendered in-browser using JavaScript.
This results in a stored cross site scripting (XSS) vulnerability wherein a malicious user may upload a beatmap whose metadata values contain HTML and JavaScript and then add it to their playlist on osulist.

This change will escape all occurrences of < and > characters in the input string, preventing the delineation of any HTML tags within it.

sanitize beatmap metadata retrieved from db
before formatting into html to prevent xss
@yfxu yfxu self-requested a review November 17, 2022 04:53
Copy link
Owner

@yfxu yfxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NGL I haven't tested this but it looks lit and it's no longer in production anyway B)

@yfxu yfxu merged commit f50d332 into yfxu:master Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants