-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Strip HTML tags for gist id to avoid stored XSS on showing error [Security Issue] #1691
Conversation
cc52e8d
to
272904a
Compare
272904a
to
85c76f5
Compare
Hi @jackycute, I think the fix contained on 85c76f5 is incomplete as the code located in https://github.com/hackmdio/codimd/blob/develop/public/js/extra.js#L332 looks for elements that have a code tag with a So if a user created the following note, they would still be able to reach the vulnerable library and get XSS: <code data-gist-id="payload"></code> I think that to fix this issue you will have to make sure that all the attributes of code tags that have a |
85c76f5
to
9e65e7a
Compare
Thanks for heads up @lbherrera. |
I think that works, but there are other attributes that get used by gist embed that also seem to be reflected into error messages and need to be sanitized as well. e = f.data("gist-id") || "";
h = f.data("gist-file");
k = f.data("gist-hide-footer") === true;
d = f.data("gist-hide-line-numbers") === true;
n = f.data("gist-line");
l = f.data("gist-highlight-line");
m = f.data("gist-show-spinner") === true;
[...]
g = f.data("gist-show-loading") !== undefined ? f.data("gist-show-loading") : true I don't see this being exploitable anymore if you also sanitize the |
94ba61b
to
33b1044
Compare
Thanks for the reminder. |
… [Security Issue] Signed-off-by: Max Wu <jackymaxj@gmail.com>
…ist show loading attrtributes Signed-off-by: Max Wu <jackymaxj@gmail.com>
33b1044
to
2eefe77
Compare
Fix #1689
cc @lbherrera
Signed-off-by: Max Wu jackymaxj@gmail.com