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

Parser fix #977

Merged
merged 1 commit into from Jan 5, 2018
Merged

Parser fix #977

merged 1 commit into from Jan 5, 2018

Conversation

KostyaTretyak
Copy link
Contributor

For now, parser not properly parsing this markdown:

Open angle bracket inline with link:

<<http://example.com>

With space: < <http://example.com>

With content: <1 <http://example.com>

Thanks to @thisgeek and #814, I've finalized this issue. This PR may also be included in the release #976

@Feder1co5oave
Copy link
Contributor

Test 39 fails with this pull merged onto the current master 18deb8b:

#39. mangle_xss.sanatize.nomangle.text failed at offset 3. Near: "<p>&lt;<ahref="mailto:svg/onload=".


Got:
<p>&lt;<ahref="mailto:svg/onload=


Expected:
<p><ahref="mailto:&lt;svg/onload=

It looks to me that the new output is correct, because marked shouldn't eat the '<'. Let's hear @UziTech and @matt- since they took care of that XSS issue.
This fix looks overall correct to me.

Copy link
Member

@UziTech UziTech left a comment

Choose a reason for hiding this comment

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

I agree with @Feder1co5oave

The first line in \test\tests\mangle_xss.sanatize.nomangle.html should be

<p>&lt;<a href="mailto:svg/onload=&quot;alert(1)&quot;//@x">svg/onload=&quot;alert(1)&quot;//@x</a></p>

@KostyaTretyak could you rebase with master and change that line so the tests pass?

README.md Outdated
@@ -3,14 +3,20 @@
> A full-featured markdown parser and compiler, written in JavaScript. Built
> for speed.

[![NPM version](https://badge.fury.io/js/marked.png)][badge]
[![NPM version](https://badge.fury.io/js/marked.svg)][badge]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm... I do not understand why this and other changes are shown, since at the moment it already exists in the master.

Copy link
Contributor

Choose a reason for hiding this comment

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

You probably rebased (wrong?)

Copy link
Member

Choose a reason for hiding this comment

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

It looks like you rebased onto 43fc870
instead of the latest commit.

Make sure you fetch the latest chjj/master branch before rebasing on it.

@KostyaTretyak
Copy link
Contributor Author

Done.

@joshbruce
Copy link
Member

LGTM!

@joshbruce
Copy link
Member

ps. Having issues with the bench script, just me?

@joshbruce joshbruce merged commit 08d2512 into markedjs:master Jan 5, 2018
@Feder1co5oave
Copy link
Contributor

What kind?
I've just run this:

$ node test --bench
marked completed in 13002ms.
marked (gfm) completed in 13562ms.
marked (pedantic) completed in 12634ms.
Could not bench robotskirt.
Could not bench showdown.
Could not bench markdown.js.

@joshbruce
Copy link
Member

npm run bench per package.json

screen shot 2018-01-04 at 10 24 07 pm

@Feder1co5oave
Copy link
Contributor

Feder1co5oave commented Jan 5, 2018 via email

@joshbruce
Copy link
Member

Yep. Definitely weird. Also curious why your benches are almost 10 seconds longer than mine...really want to establish some type of baseline expectation - otherwise, why even measure it. ;)

@Feder1co5oave
Copy link
Contributor

Feder1co5oave commented Jan 5, 2018 via email

@joshbruce
Copy link
Member

Celeron!? I haven't heard the processor name since I worked at Office Depot's tech. department in like 2001. In fact, I think the first computer I ever bought myself was a 500mhz Celeron HP mini-tower.

Oh de memories. ::tear::

@Feder1co5oave
Copy link
Contributor

Feder1co5oave commented Jan 5, 2018 via email

@KostyaTretyak KostyaTretyak deleted the parser-fix branch January 5, 2018 08:32
@KostyaTretyak
Copy link
Contributor Author

Issue with npm run bench because this is. Although I did not dig why it is.

@UziTech
Copy link
Member

UziTech commented Jan 5, 2018

It is because the runBench function doesn't return anything (or returns undefined) so marked assumes that it failed.

When running node test --bench the exit code doesn't matter or get displayed but when running npm run bench npm does display it if it is non-zero.

We could just add return true; to the end of the runBench function

@Feder1co5oave
Copy link
Contributor

Thx @UziTech

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

4 participants