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

chore(vulnerability): Inefficient Regular Expression - Potential high time complexity leading to ReDoS #10315

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

Sukeerthi31
Copy link
Contributor

@Sukeerthi31 Sukeerthi31 commented Apr 17, 2024

  • const URLPattern = new RegExp(/^(?:http(s)?://)?[\w.-]+(?:.[\w.-]+)+[\w-._~:/?#[]@!$&'()*+,;=.]+$/);

  • This part of the regular expression may cause exponential backtracking on strings starting with '-.' and containing many repetitions of '-.'.

  • References of the Vulnerability and Weaknesses

  • The current expression [\w.-]+ matches any combination of word characters which could potentially lead to inefficient matching, especially on large input strings.

  • The proposed fix limits the characters to letters (both upper and lowercase), digits, dots, and hyphens which are typically valid characters for domain extensions.

  • Also, minimum of 2 characters has been set to ensure a valid domain extension, such as ".com" or ".co.in" or ".org" etc.

@github-actions github-actions bot added product PR or Issue related to the DataHub UI/UX community-contribution PR or Issue raised by member(s) of DataHub Community labels Apr 17, 2024
@jjoyce0510 jjoyce0510 merged commit 1fafc6c into datahub-project:master Jun 28, 2024
36 of 37 checks passed
yoonhyejin pushed a commit that referenced this pull request Jul 16, 2024
aviv-julienjehannet pushed a commit to aviv-julienjehannet/datahub that referenced this pull request Jul 17, 2024
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-contribution PR or Issue raised by member(s) of DataHub Community product PR or Issue related to the DataHub UI/UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants