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

XSS vulnerabilities in comments marked as safe #254

Closed
redyaffle opened this issue Apr 10, 2017 · 1 comment · Fixed by #558
Closed

XSS vulnerabilities in comments marked as safe #254

redyaffle opened this issue Apr 10, 2017 · 1 comment · Fixed by #558
Milestone

Comments

@redyaffle
Copy link

Since all comments are marked as safe in markdown-rendered.html, someone could write Javascript as a comment and it gets interpreted as raw JS, opening up an XSS vulnerability. It seems like this is done so comments can be written in markdown, possibly for LaTeX as well (though removing |safe still seems to render LaTeX correctly). Do you consider the XSS vulnerability a problem? Would you accept a PR to fix it? If so, I was thinking that script tags could be stripped at time of submission, prior to posting to the database. You could also potentially strip all HTML period. It's not clear whether raw HTML should be necessary for any of the supported comment types.

Thank you!

Auto-reviewers: @NiharikaRay @matthewwardrop @earthmancash ancash @danfrankj

@matthewwardrop
Copy link
Collaborator

Hi @redyaffle,

I suspect that this is just one in a myriad of security vulnerabilities that exist throughout the knowledge repo codebase. In the past, this was not considered to be a particularly serious problem, since we internally used the knowledge repo in a trusted computing environment, but as it grows and matures, this sort of thing will be a big deal. I haven't yet personally reviewed much of the code pertaining to comments, so I cannot say exactly why we mark comment content as safe, but my guess is that as you say we render the content server-side before displaying it. It seems, therefore, reasonable to think about adding some functionality to strip unwanted tags/etc from the comment pre-rendering, and if you want to submit a patch that does this, it will be more than welcome!

Many things for getting involved!

@matthewwardrop matthewwardrop modified the milestone: Next Jul 17, 2017
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 a pull request may close this issue.

2 participants