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

fix(lib): polynomial redos routes #763

Merged
merged 3 commits into from
Oct 28, 2023
Merged

fix(lib): polynomial redos routes #763

merged 3 commits into from
Oct 28, 2023

Conversation

Fdawgs
Copy link
Member

@Fdawgs Fdawgs commented Oct 21, 2023

See fastify/fastify-autoload#330

Checklist

@@ -88,7 +88,7 @@ function normalizeUrl (url, serverUrls, stripBasePath) {

function resolveServerUrls (servers) {
const resolvedUrls = []
const findVariablesRegex = /{(.*?)}/g // As for OpenAPI v3 spec url variables are named in brackets, e.g. {foo}
const findVariablesRegex = /\{(.*?)\}/gu // As for OpenAPI v3 spec url variables are named in brackets, e.g. {foo}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the escape necessary?

Just curious

Copy link
Member Author

@Fdawgs Fdawgs Oct 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without it they are treated as part of a quantifier.

@mcollina
Copy link
Member

@Fdawgs CodeQL is complaining about this regexp, could you take a look?

@Fdawgs Fdawgs changed the title refactor(lib): add u unicode flag to regex fix(lib): polynomial redos route Oct 28, 2023
@Fdawgs
Copy link
Member Author

Fdawgs commented Oct 28, 2023

@Fdawgs CodeQL is complaining about this regexp, could you take a look?

This appears to have been an issue prior to this change (if you look in the Security tab of the repo).

@Fdawgs Fdawgs requested review from gurgunday, a team and mcollina October 28, 2023 11:03
@Fdawgs Fdawgs changed the title fix(lib): polynomial redos route fix(lib): polynomial redos routes Oct 28, 2023
@Fdawgs
Copy link
Member Author

Fdawgs commented Oct 28, 2023

Found another one in 698c66a that CodeQL didn't pick up.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit f62afad into master Oct 28, 2023
19 checks passed
@Fdawgs Fdawgs deleted the refactor/regex branch October 28, 2023 14:08
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 this pull request may close these issues.

None yet

3 participants