-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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 gfm extended autolinking requiring multiple backpedals #1293
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't include changes to marked.min.js
in this PR. It is generated automatically on merge.
Other than that LGTM
Add a test and fix that trailing punctuation is omitted in link URLs for markdown like this: (See https://www.example.com/fhqwhgads.) The trailing period and closing parenthesis should not be part of the link URL.
@UziTech I've backed out the change to |
A possessive quantifier to eat all the trailing punctuation in the Suggestion: have you tested the behavior of the current and proposed backpedaling algorithm with maliciously long sequences of trailing punctuation in a gfm autolink? |
test/specs/marked/marked-spec.js
Outdated
describe('Marked Autolinks', function() { | ||
var section = 'Autolinks'; | ||
|
||
// var shouldPassButFails = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this line is here? Seems to duplicate the next line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a copy/paste from elsewhere in the same file. See lines 53 and 68. I'll remove them all.
On the theme suggested by @Feder1co5oave, @Trott can you add tests for a URL inside nested parentheses?
|
@davisjam Done. |
@Feder1co5oave I'm not sure what would constitute "maliciously long" in this instance. Can you provide an example or a description? And would it be reasonable to include one in the specs? |
@Trott Let's see how GH handles that (don't mind the below... meant as a test only... not to annoy... EDIT don't want to overload the url in the demos). (See https://www.example.com/fhqwhgads..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................) Okay that should be enough to test although probably not a ReDoS equivalent (add a few million to see for sure but won't do that here). 😸 |
Interesting... autolinking doesn't appear to work like this right now: Excessive periods(See https://www.example.com/fhqwhgads..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................) Does any markdown work inside HTML tags here? (should be bold) |
@Martii My understanding of markdown specs is that markdown is not expanded inside block elements. |
So it looks like GH GFM may have a bug too since it's bolding and italicizing. Ex. **This is inside a p HTML tag and should not be bolded** Gotta love md implementations sometimes. 😸 Thanks for the tip to look for. |
@Martii Doesn't look buggy to me! Inside a <p> element so should not bold: **Look! No bold!!** Not inside a <p> element so should bold: Very bold! |
Is there anything else that needs to happen to this before it can be merged? Not pushing for it to happen now now now or anything, but if there's something that's waiting on me, I'd like to address it. |
@Trott |
I see now that in the <details> section, there is bolding and italicizing but not autolinking. I suppose that's a bug, although I guess GitHub gets to write whatever rules they want for GFM, so maybe that's the correct spec behavior in some weird way. I'm kidding. Maybe. I guess there's also the fact that <details> is non-standard to begin with, so maybe all bets are off anyway. At this point, though, I'm just making stuff up so maybe it's best if I stop typing since I'm almost certainly wrong about at least four things in this paragraph. Hope this was at least mildly entertaining. EDIT: Yep, I'm wrong about <details> being non-standard, guess that happens when you don't write HTML for about 10 years... |
@davisjam I think your comments were addressed, correct? |
fix gfm extended autolinking requiring multiple backpedals
Marked version:
0.4.0
Markdown flavor:
GitHub Flavored Markdown
Description
Add a test and fix that trailing punctuation is omitted in link URLs for
markdown like this:
(See https://www.example.com/fhqwhgads.)
The trailing period and closing parenthesis should not be part of the
link URL.
Expectation
Result
Note that the trailing period is included as part of the URL. That's the bug.
Contributor
Committer
In most cases, this should be a different person than the contributor.