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

[feat] Added Lusca middleware for CSRF [fixes #828] #997

Merged
merged 1 commit into from
Feb 20, 2016

Conversation

yilenpan
Copy link
Contributor

Added Lusca middleware for CSRF

// Lusca CSRF config
csrf: {
csrf: false,
csp: { /* ... */},
Copy link
Member

Choose a reason for hiding this comment

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

Why the comment?

@pgrodrigues
Copy link
Contributor

I didn't test but I believe the server route tests might break unless the csrf token is passed. Tests might need to be updated in order to handle the inclusion of this middleware. Just a heads-up before merging this in.

p3p: 'ABCDEF',
hsts: { maxAge: 31536000, // Forces HTTPS for one year
includeSubDomains: true,
preload: true },
Copy link
Member

Choose a reason for hiding this comment

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

newline

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Between line 28/29?

Copy link
Member

Choose a reason for hiding this comment

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

The comment is on 37, the newline should be before the } in 37.

@lirantal lirantal self-assigned this Oct 17, 2015
@lirantal lirantal added this to the 0.4.2 milestone Oct 17, 2015
@lirantal
Copy link
Member

@yilenpan see my comments.

Overall, this is a great addition.
We do need to augment it with a frontend PR to add those tokens for all those API calls that we're making, and then we can enable CSRF protection on too.

@codydaig codydaig modified the milestones: 0.5.0, 0.4.2 Oct 26, 2015
@codydaig
Copy link
Member

Bumping milestone to 0.5.0 so we're not holding up 0.4.2

@jloveland jloveland mentioned this pull request Nov 3, 2015
@ilanbiala
Copy link
Member

@lirantal any progress on this?

@lirantal
Copy link
Member

lirantal commented Jan 2, 2016

I haven't had a chance to try out the changes introduced in this PR yet.
This is till on my to-do list.

@ilanbiala
Copy link
Member

@yilenpan can you rebase this? @lirantal can you review this one more time before we merge?

@lirantal
Copy link
Member

@ilanbiala sure but let's see if @yilenpan wishes to get back to this for the required fixes (been a couple of months since), otherwise I'll take over.

@yilenpan
Copy link
Contributor Author

Hey fellas, sorry for being a little MIA, I've rebased pushed up the new changes. Seems to trip up the linter for some reason, so I'll try and figure that one out too :(

@yilenpan
Copy link
Contributor Author

Hmm.. Looks like there's an error in the changeProfilePicture method in /modules/users/server/controllers/users/users.profile.server.controller.js, could be the config?

@yilenpan
Copy link
Contributor Author

Hey guys, middleware has been added and build is passing.

Best

-Y

@@ -43,6 +43,7 @@
"helmet": "~0.9.1",
"jasmine-core": "~2.3.4",
"lodash": "~3.10.0",
"lusca": "^1.3.0",
Copy link
Member

Choose a reason for hiding this comment

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

~

@codydaig
Copy link
Member

Left a line comment. Also, make sure the commit message matches the guidelines outlined in CONTRIBUTING.md.

Added lusca for CSRF protection as per issue meanjs#828

Fixes meanjs#828
@yilenpan
Copy link
Contributor Author

The Node.js 0.12 macosx build failed when trying to install protractor, all other builds passed. May want to rerun that test?

@ilanbiala
Copy link
Member

Reran it.

@ilanbiala
Copy link
Member

@lirantal LGTM, wanna take a look?

@lirantal
Copy link
Member

Great.
Some follow-up items for afterwards:

  1. Frontend side needs to make use of the CSRF tokens
  2. @yilenpan didn't change the config object from csrf to lusca and I think we should but I'm in favor of merging often, and don't want to delay this PR due to my personal favorites.

lirantal added a commit that referenced this pull request Feb 20, 2016
[feat] Added Lusca middleware for CSRF [fixes #828]
@lirantal lirantal merged commit 35d7501 into meanjs:master Feb 20, 2016
@ilanbiala
Copy link
Member

Who is going to implement the frontend for the tokens?

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

Successfully merging this pull request may close these issues.

5 participants