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

Prevent a ReDoS vulnerability #335

Merged
merged 2 commits into from Jul 27, 2019
Merged

Conversation

dominykas
Copy link
Contributor

@dominykas dominykas commented May 14, 2019

Closes #331.

Ported from markdown-it/markdown-it@89c8620. The author of the modified file and that commit is the same, so I assume they knew what they were doing.

I will remove the merge of #333 once the build is green. Not sure what happened with older nodes, but I won't bother about it right now. Greenish build: https://travis-ci.org/jonschlinkert/remarkable/builds/532349463

@dominykas dominykas changed the title fix: prevent a ReDoS vulnerability Prevent a ReDoS vulnerability May 14, 2019
@jonschlinkert
Copy link
Owner

Thank you! I’ll merge ASAP, but I’m traveling until Saturday so it might be a couple of days. Sorry for the late reply.

@fernandopasik
Copy link

fernandopasik commented May 29, 2019

@jonschlinkert is there any updates when we could expect this merged?

Also, would it be possible a newly published version after?

@vladikoff
Copy link

Should probably fix the eslint error as part of this PR?

@dominykas
Copy link
Contributor Author

Should probably fix the eslint error as part of this PR?

I have a separate PR for that: #333.

@DanCech
Copy link

DanCech commented Jun 7, 2019

As noted in #331 the same issue impact the comment regex, the same fix would likely work there.

lib/common/html_re.js Outdated Show resolved Hide resolved
@Vadorequest
Copy link

What's the status on this? I'm not familiar with Remarkable but it's my most important security red flag as GitHub shows it as a critical security issue.

image

image

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.537% when pulling 7361070 on dominykas:fix-redos into 4ad13a0 on jonschlinkert:master.

@coveralls
Copy link

coveralls commented Jul 26, 2019

Coverage Status

Coverage remained the same at 98.537% when pulling 0c9d32b on dominykas:fix-redos into 4ad13a0 on jonschlinkert:master.

dominykas added a commit to dominykas/remarkable that referenced this pull request Jul 26, 2019
Copy link

@DanCech DanCech left a comment

Choose a reason for hiding this comment

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

LGTM

@TrySound
Copy link
Collaborator

Great, thanks! Will be a part of v2

@TrySound TrySound merged commit 30e2bf0 into jonschlinkert:master Jul 27, 2019
@Vadorequest
Copy link

Vadorequest commented Jul 28, 2019

Since this is a security issue, I suggest it is released as a patch version, so that NPM packages that use ^/~ will use automatically the patched version.

@dominykas dominykas deleted the fix-redos branch July 28, 2019 18:30
@TrySound
Copy link
Collaborator

I agree. Though it's hard since we already have breaking changes in master branch.

@Vadorequest
Copy link

That's not a real issue, it's often the case in software. The recommended way to handle that is often to cherry-pick the changes to apply the security fix in older version.

I believe the code that was changed in this version is quite old, but applying this PR (cherry-pick) to a branch created from an old tag or commit shouldn't conflict.

I'm not sure if you see what I mean by that, but basically going back to the state the git tree was (tag/commit), then cherry picking this PR commit and releasing a new patch version on NPM should do the trick! :)

@dominykas
Copy link
Contributor Author

I'm happy to cherrypick all changes into the last known version and open a PR - just need someone to hit merge and publish afterwards?

@feruzm
Copy link

feruzm commented Jul 29, 2019

@dominykas Have you done it? Please do... so they can do minor release before v2.

@dominykas
Copy link
Contributor Author

Would just like to hear back from @TrySound (or someone else) that they're interested in that.

TrySound pushed a commit that referenced this pull request Jul 29, 2019
fix: prevent a ReDoS vulnerability

Ported from markdown-it/markdown-it@89c8620.

fix: prevent ReDoS with comments

Once again - prior art: markdown-it/markdown-it@6ab7cc3

Hat tip @DanCech #335 (comment) for pointing out #331 (comment), which I missed initially
@TrySound
Copy link
Collaborator

I cherry picked your commits here. Is it ok to publish now?
https://github.com/jonschlinkert/remarkable/commits/1.7.2

@TrySound
Copy link
Collaborator

Is it ok to have a release in a branch?

@dominykas
Copy link
Contributor Author

Seems OK, and yes - releasing from a branch is perfectly fine from npm perspective (fwiw, you don't even have to have a git repo to release...), although not sure what the release process is for the repo - it also seems the tag names for releases here don't have the v prefix, so the branch name may collide with the tag name. I usually have something like a 1.x branch for backported releases.

@TrySound
Copy link
Collaborator

Ok. Started https://github.com/jonschlinkert/remarkable/tree/v1.x branch. Published 1.7.2. Thanks everybody!

@dominykas
Copy link
Contributor Author

Thank you!

bestlucky0825 pushed a commit to bestlucky0825/remarkable that referenced this pull request May 30, 2022
fix: prevent a ReDoS vulnerability

Ported from markdown-it/markdown-it@89c8620.

fix: prevent ReDoS with comments

Once again - prior art: markdown-it/markdown-it@6ab7cc3

Hat tip @DanCech jonschlinkert/remarkable#335 (comment) for pointing out jonschlinkert/remarkable#331 (comment), which I missed initially
LeSuisse added a commit to LeSuisse/advisory-database that referenced this pull request Mar 20, 2023
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.

[Security] Regex DoS vulnerability in parsing html tag
9 participants