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 Detection regex too loose #2522

Closed
R4c00n opened this issue Nov 6, 2019 · 3 comments
Closed

XSS Detection regex too loose #2522

R4c00n opened this issue Nov 6, 2019 · 3 comments

Comments

@R4c00n
Copy link

R4c00n commented Nov 6, 2019

Hello,
it seems like the latest master branch has a too loose XSS regex in lib/helpers/isValidXss.js
/(\b)(on\S+)(\s*)=|javascript|(<\s*)(\/*)script/gi Matches URLs like /one/?foo=bar or /online?foo=bar
https://www.regexpal.com/?fam=112339

This results in a JavaScript error that can break the entire page.

Also, I don't quite understand why this check is performed without performing a request, but on require('axios') with the current pages URL.
Why does axios care about the pages URL and not just the URL used for an actual axios request?

@Ghost-J
Copy link

Ghost-J commented Nov 6, 2019

Noticed the same error. example.com/onyx/registration?foo=bar

@ghost
Copy link

ghost commented Jan 16, 2020

Hi, im using contentful, that use axios and when my slug contains 'javascript' entire page not loading because of 'Uncaught Error: URL contains XSS injection attempt' :)
So, is 'isValidXss' function really helping to prevent XSS and why check URL pages?

@yasuf
Copy link
Collaborator

yasuf commented Jan 16, 2020

@abzalzhumabaev plenty of people are having this same issue, I haven't had the time to push a fix but there are a few issues about it #2646

@axios axios locked and limited conversation to collaborators May 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants