Open
Conversation
…nt, card colour, stickerId, theme and user name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for the very quick response to the issue I created earlier, and sorry for my slower one!
sanitizeris currently being used to sanitize card content, but not to sanitize any other client-controlled values. As a result, cross-site scripting (XSS) is still possible through those other values.Example reproduction steps
This creates an arbitrary card with a
rotthat escapes thestyleattribute and injects anonmousemoveevent handler on the card element. This event handler could be used to execute any arbitrary JavaScript code.title="is added at the end so that the following"is paired correctly.4. Move the mouse over the card
5. An alert box with the message "XSS" will appear, confirming that the injected event handler was executed
6. Open the board as another user (e.g. in an incognito window) and move the mouse over the card to confirm that this is not just isolated to the user who created the card
Note that you could also inject more styles, such as to make the card take up the entire screen, to make the payload more impactful.
What this PR fixes
To enable this PR to be merged as quickly as possible, I have only added sanitization client-side and to values that I was able to achieve XSS with (i.e. those that are directly rendered in the DOM).
Specifically, it sanitizes these values (in order of appearance in
script.js):What this PR does not fix
I recommend also making the following changes involving sanitization of client-controlled values, but I don't believe these can be used to achieve XSS so they are not as critical and I have not included them in this PR.
sanitizerdoes not recommend it, and it is no longer maintainedcard-) to prevent a malicious user from creating an ID that matches an existing DOM element's ID, which could corrupt the DOM$(document.getElementById(cardId))instead of$('#' + cardId), to prevent a malicious user from create a card with special characters in its ID which would also cause unexpected behaviour since it could target elements inside the card element instead of the card element itselfcolouris incardColoursbefore loading the corresponding image, to prevent a malicious user from using an invalid colour which results in cards with a missing imagestickerIdbefore loading the corresponding image, to prevent a malicious user from using an invalid stickerId which results in stickers with a missing imagethemebefore loading the corresponding CSS file, to prevent a malicious user from using an invalid theme which results in a missing CSS file and broken styling