Code Monkey home page Code Monkey logo

Comments (8)

EvanHahn avatar EvanHahn commented on May 18, 2024

If you want no CSP, you don't need to include the middleware. Is there a reason why you want this middleware if it's empty?

from helmet.

ibash avatar ibash commented on May 18, 2024

We're using other directives other than the sandbox attribute. This was just to show that sandbox is always added.
You'll have the same problem if you have a config with script-src and others.

from helmet.

EvanHahn avatar EvanHahn commented on May 18, 2024

This brings up a good question about what to do on IE. We've got a few options:

  1. Leave things as is, which @ibash points out has some undesirable behavior.
  2. If you don't supply a sandbox attribute, the header will be useless on IE (and might as well be removed), but won't break IE. We could remove it or include it, it doesn't matter much.
  3. If you don't specify sandbox, try to guess it for IE (and be liberal with what you allow). For example, if your script-src is none, then you shouldn't allow-scripts in the sandbox. To reiterate, this should only happen if (1) you're on IE (2) you didn't specify the sandbox directive.

I feel like the last option is probably what people want, but it has the potential to be buggy and introduce errant behavior. I think option 2 is probably the best.

Thoughts?

@ibash, for now, you can probably do something like this:

app.use(helmet.csp({
  sandbox: ['allow-forms']
})

from helmet.

ibash avatar ibash commented on May 18, 2024

I say ditto on option 2. Since csp is still relatively new I think it makes more sense to let users make the judgement call as to what happens (by making it more configurable).

With some good documentation that shouldn't be a problem, want me to write up a pull request?

On Fri, Apr 25, 2014 at 2:35 PM, Evan Hahn [email protected]
wrote:

This brings up a good question about what to do on IE. We've got a few options:

  1. Leave things as is, which @ibash points out has some undesirable behavior.
  2. If you don't supply a sandbox attribute, the header will be useless on IE (and might as well be removed), but won't break IE. We could remove it or include it, it doesn't matter much.
  3. If you don't specify sandbox, try to guess it for IE (and be liberal with what you allow). For example, if your script-src is none, then you shouldn't allow-scripts in the sandbox. To reiterate, this should only happen if (1) you're on IE (2) you didn't specify the sandbox directive.
    I feel like the last option is probably what people want, but it has the potential to be buggy and introduce errant behavior. I think option 2 is probably the best.

Thoughts?

Reply to this email directly or view it on GitHub:
#42 (comment)

from helmet.

EvanHahn avatar EvanHahn commented on May 18, 2024

Sure! I'd imagine the PR is just removing the code that always adds sandbox to IE.

from helmet.

ibash avatar ibash commented on May 18, 2024

@EvanHahn pull request attached, take a look and let me know what you think.

from helmet.

EvanHahn avatar EvanHahn commented on May 18, 2024

Closing this; let's move discussion to the PR.

from helmet.

ibash avatar ibash commented on May 18, 2024

Okay -- as a side note another common practice is to leave issues open until they're fixed by a commit message: i.e. "fixes #42"

from helmet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.