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

LGTM-Alert Polynomial regular expression used on uncontrolled data #42

Closed
2 tasks done
Uzlopak opened this issue Jun 15, 2022 · 8 comments · Fixed by #44
Closed
2 tasks done

LGTM-Alert Polynomial regular expression used on uncontrolled data #42

Uzlopak opened this issue Jun 15, 2022 · 8 comments · Fixed by #44

Comments

@Uzlopak
Copy link
Contributor

Uzlopak commented Jun 15, 2022

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

see:
https://lgtm.com/projects/g/fastify/fast-uri/snapshot/a91fe052eb5fc4f8831c7fee0131457289db14a9/files/index.js?sort=name&dir=ASC&mode=list#x852651248d66d755:1

@mcollina
Copy link
Member

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@Uzlopak
Copy link
Contributor Author

Uzlopak commented Jun 15, 2022

I dont have a laptop the next 4 days, so if you want to wait that long, i could try. But i am not quite sure why you call match on not test.

I assume that you can fix it by doing, as the s-flag means that dot also matches newline
/\/\/(?:.)*:(?:\/|\?|#|$)/s

Or why do you need the non matching groups anyway,

Maybe the original writer of that regex can give more insights?

@mcollina
Copy link
Member

Totally, take your time. cc @zekth

@zekth
Copy link
Member

zekth commented Jun 15, 2022

I'll try to investigate

@zekth
Copy link
Member

zekth commented Jun 15, 2022

This is relative to an old IE fix. I think we can drop the whole statement IMO

@mcollina
Copy link
Member

Let's do it.

@Fdawgs
Copy link
Member

Fdawgs commented Jun 16, 2022

This is relative to an old IE fix. I think we can drop the whole statement IMO

Got a link or some additional info on that @zekth? Just curious as to what it was fixing (I still have to support IE forever unfortunately).

@zekth
Copy link
Member

zekth commented Jun 16, 2022

I think this is related to this behavior https://stackoverflow.com/questions/28857067/regex-not-working-for-ie-but-works-for-other-browsers

@zekth zekth mentioned this issue Jun 16, 2022
4 tasks
@zekth zekth closed this as completed in #44 Jun 16, 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 a pull request may close this issue.

4 participants