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

Restrict pattern for space-separated arguments in glob embed regex #92

Merged
merged 3 commits into from
Jan 16, 2024

Conversation

MattIPv4
Copy link
Member

Type of Change

  • Markdown-It Plugins: Glob embed

What issue does this relate to?

N/A

What should this PR do?

The previous implementation of the regex pattern used for the glob embed could result in too much recursion when evaluating a string that had a large number of spaces in the glob, followed by a test on a new line.

This PR restricts the regex pattern being used, so instead of looking for a space followed by any character, we're now looking for a space followed by any non-space character, avoiding the excessive recursion. A test has also been added to confirm that this regex no longer has this ReDoS issue.

What are the acceptance criteria?

All tests continue to pass, including the new one that would previously reproduce the ReDoS.

@MattIPv4 MattIPv4 added bug Something isn't working patch Change is SEMVER patch labels Jan 16, 2024
dbadea-heits
dbadea-heits previously approved these changes Jan 16, 2024
Copy link
Contributor

@dbadea-heits dbadea-heits left a comment

Choose a reason for hiding this comment

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

lgtm

@MattIPv4 MattIPv4 merged commit 39a3836 into master Jan 16, 2024
4 checks passed
@MattIPv4 MattIPv4 deleted the MattIPv4/glob-redos branch January 16, 2024 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working patch Change is SEMVER patch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants