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

Cross-Origin-Resource-Policy #176

Closed
Malvoz opened this issue Jul 23, 2018 · 14 comments · Fixed by #296
Closed

Cross-Origin-Resource-Policy #176

Malvoz opened this issue Jul 23, 2018 · 14 comments · Fixed by #296
Assignees
Milestone

Comments

@Malvoz
Copy link

Malvoz commented Jul 23, 2018

There's a relatively new HTTP header called Cross-Origin-Resource-Policy which Helmet could utilize.

MDN docs:

Now I'm not sure how it affects or if it takes precedence (when applicable) over X-Frame-Options, CSP's frame-ancestors and X-Permitted-Cross-Domain-Policies.

Browser support bugs can be found here: Fyrd/caniuse#4355

@EvanHahn
Copy link
Member

I'll take a look at this! Thank you.

@EvanHahn
Copy link
Member

This is definitely something to keep an eye on, though I want to wait on this in case the spec changes. It seems unstable at the moment.

@EvanHahn
Copy link
Member

Until it's added to Helmet, you can add it to your Express apps with just a few lines:

app.use(function (req, res, next) {
  res.setHeader('Cross-Origin-Resource-Policy', 'same-site')
  next()
})

@EvanHahn
Copy link
Member

EvanHahn commented Sep 8, 2018

I just published cross-origin-resource-policy@0.1.0 to npm, which you can learn more about here. It's not part of mainline Helmet so it'll need to be installed separately for now.

After browser support improves, I'll add it to Helmet.

@mscottnelson
Copy link

I see that you just wrote that on Sep 8. Safari (both desktop and iOS) added support for this policy on Sep 18. Although it is still a new feature on some platforms, all major browsers now support it. Don't know what your threshold is, just wanted to make sure you were aware.

@EvanHahn
Copy link
Member

EvanHahn commented Nov 25, 2018 via email

@mscottnelson
Copy link

My apologies. I was working on implementing a number of security features and somehow conflated this header with the SameSite cookie attribute when I made that comment. Carry on.

@EvanHahn
Copy link
Member

EvanHahn commented Nov 26, 2018 via email

@rajeshsusai
Copy link

rajeshsusai commented Jan 23, 2020

Hi, looks like Chrome 80 is looking to enforce CORP: https://blog.chromium.org/2019/10/developers-get-ready-for-new.html

Are there plans to add Cross-Origin-Resource-Policy to helmet soon?

@Malvoz
Copy link
Author

Malvoz commented Jan 23, 2020

@rajeshsusai that link only talks about SameSite cookies, and not the Cross-Origin-Resource-Policy HTTP header. CORP has been available in Chrome since v73.

@EvanHahn
Copy link
Member

I'm not sure I understand the explainer. Can someone link me to something that can help me understand this header and the kinds of problems it prevents?

@jraoult
Copy link

jraoult commented Apr 8, 2020

@EvanHahn I found this ystd, it might help (https://youtu.be/vfAHa5GBLio?t=1217)

bkimminich added a commit to juice-shop/juice-shop that referenced this issue Dec 23, 2020
@EvanHahn
Copy link
Member

EvanHahn commented Apr 4, 2021

I've added support for Cross-Origin-Resource-Policy (among other Cross-Origin- headers) in v4.5.0-rc.1.

You can install with npm install helmet@4.5.0-rc.1, see the docs for 4.5.x on GitHub, and the pull request at #296.

Please try it and give me feedback! I will plan to release on April 17/18 unless something disrupts that, such as significant errors in my implementation.

@EvanHahn EvanHahn added this to the v4.5.0 milestone Apr 4, 2021
@EvanHahn EvanHahn self-assigned this Apr 4, 2021
@EvanHahn EvanHahn mentioned this issue Apr 11, 2021
@EvanHahn
Copy link
Member

This was released in helmet@4.5.0. Check out the documentation to see how to use the header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

5 participants