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

feat(a9-insecure-components): adding popular vulnerable package: marked #83

Merged
merged 8 commits into from
Feb 14, 2017
Merged

feat(a9-insecure-components): adding popular vulnerable package: marked #83

merged 8 commits into from
Feb 14, 2017

Conversation

lirantal
Copy link
Collaborator

@lirantal lirantal commented Feb 4, 2017

feat(a9-insecure-components): adding a popular vulnerable package: marked

Adding a vulnerable package called marked for parsing and compiling Markdown syntax in JavaScript.
This is a popular package that has several releases related to XSS issues one in less than a year ago, and a very recent one as well.

  • Adding a /memos section to add memos (notes) which allows free text that is compiled to markdown and uses the marked library
  • Adding documentation to A9 - Insecure Components section
  • Explaining how to exploit the vulnerable Marked package

…rked

Adding a vulnerable package called marked for parsing and compiling Markdown syntax in JavaScript.
This is a popular package that has several releases related to XSS issues one in less than a year ago, and a very recent one as well.

* Adding a `/memos` section to add memos (notes) which allows free text that is compiled to markdown and uses the marked library
* Adding documentation to A9 - Insecure Components section
* Explaining how to exploit the vulnerable Marked package
@binarymist
Copy link
Collaborator

I haven't tested this, but sounds like a good initiative.

It's probably an idea to add a comment in the package.json around the fact that this dependency should not be updated due to the fact of A9, otherwise someone will think they're helping and update it.

Was the development.js change intentional?

"May" also want to mention that snyk although it may be good, is not free. Often this is a show stopper.

@lirantal
Copy link
Collaborator Author

lirantal commented Feb 5, 2017

Good comments.

  • development.js was a local change, I'll commit a fix that comments it out again
  • we can't really add comments in JSON which goes for package.json as well so I'm not sure where else to add it except to just keep an eye on future PRs :-)
  • snyk has some paid plans but they are free and open source as well so I actually view them as a great partner for Node.js security

@binarymist
Copy link
Collaborator

{
"//": "a comment",
"//": "another comment"
}

Maybe snyk has just added the free tier? They seem to go up very fast after that though $49 vs NSP $1 for additional repos.

@lirantal
Copy link
Collaborator Author

lirantal commented Feb 7, 2017

@binarymist fixed both comments

@binarymist
Copy link
Collaborator

Hi @lirantal Could be worth specifying what exactly the purpose is with:
"do not upgrade the marked package version it is set by purpose"

Someone else may be maintaining this code in the future, even if it was you, you may not remember what the purpose was in 2 years time. Just adding a few more words to what the purpose is, could save significant time, by the time several people read the comment and try and work out what the purpose is?

@lirantal
Copy link
Collaborator Author

lirantal commented Feb 7, 2017

Agree, updated.

@ckarande
Copy link
Member

ckarande commented Feb 9, 2017

@lirantal I loved the idea to add an example for A9. Can you please go over comments I added and let me know your thoughts.

@lirantal
Copy link
Collaborator Author

lirantal commented Feb 9, 2017

Great.

Did you possibly not submit your review? I only saw comments for the other PR, not on this one.

package.json Outdated
@@ -14,11 +14,17 @@
"express-session": "^1.13.0",
"forever": "^0.15.1",
"helmet": "^2.0.0",
"marked": "^0.3.5",
Copy link
Member

Choose a reason for hiding this comment

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

The caret (^) sign in front of the version number installs newer minor or patch level versions. It appears that the vulnerability was fixed in marked 0.3.6 and this version would get pulled from npm due to the leading ^. We will need to specify absolute version here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Great catch, totally missed it. I updated it to match an exact 0.3.5 version.

</p>

<p>
This library is so popular that it has been downloaded almost <strong> 3 million </strong> times in the last month and received more than <strong> 11,000 </strong> stars on GitHub.
Copy link
Member

Choose a reason for hiding this comment

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

It is nitpicking but as the download numbers would change each month, would it be possible to rephrase it so that the statement stays true anytime users read it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, would be a bit difficult to predict the future but I tried to make it generic, take a look now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just say millions

The <a href="https://nodesecurity.io/advisories">Node Security project </a> is a great initiative and resource to know about related vulnerabilities.
</li>
<li>
<a href="https://snyk.io/">Snyk.io </a> is another Node.js CLI tool and Platform to scan and detect vulnerable packages
Copy link
Member

Choose a reason for hiding this comment

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

Can we also add there additional popular tools here -

npm-check, david-dm,
requireSafe, and retire.js

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Definitely, will add.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@ckarande
Copy link
Member

ckarande commented Feb 9, 2017

@lirantal You are right.. missed to submit the review earlier. Please check now.

@lirantal
Copy link
Collaborator Author

Pushed all changes.

@lirantal
Copy link
Collaborator Author

@binarymist @ckarande updated the tutorial again with your comments.

@ckarande ckarande merged commit d4685de into OWASP:master Feb 14, 2017
@ckarande
Copy link
Member

👍 @lirantal Thanks for the PR all the updates. @binarymist thanks for your review comments.

@lirantal
Copy link
Collaborator Author

Thank you both guys, much appreciate the feedback and collaboration here ;-)

@binarymist
Copy link
Collaborator

binarymist commented Feb 15, 2017

@lirantal can you please keep your commit comments shorter, aprx 80 characters, as it screws up the git log --graph

If you have long comments, please put line breaks in. Thanks.

longcommitcomments

@lirantal
Copy link
Collaborator Author

I'm such a naughty boy

@binarymist
Copy link
Collaborator

Na, you're probably using one of those graphical editors that handle long lines better :-)

@lirantal
Copy link
Collaborator Author

damn it, caught me! :-)

but seriously I actually tend to use changelog semantic commits, and thus have multilines when need to elaborate for a long commit message. I guess I just went free-style with this repo.

Rest assured however that the problem is solved:

git config --global core.editor "nano -r 70"

@binarymist
Copy link
Collaborator

There seems to be a bug moving from Memos view to Allocations. The user Id is lost.

@lirantal
Copy link
Collaborator Author

yep, definitely the case

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.

3 participants