Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

fix(security): updating vulnerable packages #1802

Merged
merged 3 commits into from
Jul 2, 2017

Conversation

lirantal
Copy link
Member

No description provided.

@lirantal lirantal self-assigned this Jun 28, 2017
@mleanos
Copy link
Member

mleanos commented Jun 28, 2017

These build errors with the Selenium driver 😕

@lirantal
Copy link
Member Author

oh my god, this is terrible :(

@simison
Copy link
Member

simison commented Jun 29, 2017

@lirantal did you go trough helmet's changes ?

You probably need to update at least hsts options from milliseconds to seconds.

Moment.js duration might be useful:

moment.duration(6, 'months').asSeconds();

@lirantal
Copy link
Member Author

you're right, I haven't reviewed it carefully rushed quickly to resolve the vulnerable dependencies first to have a good baseline of packages. I also remembered they also changed the middleware names like contentSecurityPolicy to csp and such.
With the build failing on the E2E it's a painful process to push changes and get quick feedback, we need to fix them.

@simison
Copy link
Member

simison commented Jun 29, 2017

I updated Helmet stuff for Trustroots, you might be able to just copypaste from there: https://github.com/Trustroots/trustroots/blob/master/config/lib/express.js#L197-L449

@lirantal
Copy link
Member Author

@simison you guys also use milliseconds representation for the SIX_MONTHS period so you need to adjust it, or did I miss something?

@simison
Copy link
Member

simison commented Jun 29, 2017

@lirantal correct, I noticed that too and that's how I looked up that moment.duration code bit. :-)

Thanks!

@lirantal
Copy link
Member Author

np, great comment, thanks for checking in on us!

@@ -141,7 +141,7 @@ module.exports.initModulesConfiguration = function (app, db) {
*/
module.exports.initHelmetHeaders = function (app) {
// Use helmet to secure Express headers
var SIX_MONTHS = 15778476000;
var SIX_MONTHS = 15778476;
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to just use 15778476 directly in hsts settings object since this variable isn't used anywhere else?

Copy link
Member

Choose a reason for hiding this comment

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

Also it'll be useful for anyone modifying this to have a short comment mentioning it's seconds.

Copy link
Member Author

Choose a reason for hiding this comment

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

nah because then it's just magic number, very unreadable.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah I wasn't sure if to add that comment or not because someone who would change it will probably be aware of helmet

Copy link
Member

Choose a reason for hiding this comment

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

FWIW, I prefer having a note that it's in seconds here. Even those that understand that Helmet expects seconds, it may be easy to forget or be overlooked by others coming in.

To me it looks less like a "magic" number when I see a comment about seconds.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, updated.

@mleanos
Copy link
Member

mleanos commented Jul 1, 2017

LGTM. Love seeing those green check marks!

@simison
Copy link
Member

simison commented Jul 1, 2017

LGTM

@lirantal lirantal merged commit 57c63e6 into meanjs:master Jul 2, 2017
GulajavaMinistudio added a commit to GulajavaMinistudio/mean that referenced this pull request Jul 2, 2017
fix(security): updating vulnerable packages (meanjs#1802)
cicorias pushed a commit to JavaScriptExpert/mean that referenced this pull request Sep 12, 2017
* fix(security): updating vulnerable packages

* fix(helmet): updating to support latest changes, transition from ms to seconds represntation

* comment on SIX_MONTHS variable
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants