Code Monkey home page Code Monkey logo

Comments (10)

jelhan avatar jelhan commented on June 2, 2024

Just recognized that this isn't runtime configuration but for build and server only. Due to this it should also be moved from config/environment.js to ember-cli-build.js.

from ember-cli-content-security-policy.

lifeart avatar lifeart commented on June 2, 2024

is it possible to have more dummers-frendly and declarative configuration, like

    csp
        policies:
        
            images:
                local: true,
                raw-inline: true,
                fromHosts: [ 'http://...', 'http://...' ]
            fonts:
                local: true,
            styles:
                local: true,
                inline: true
                ...

I think we can replace none, self etc to something more meaningful and less formal

'font-src': ["'self'"] - scares me, comparing policies.fonts.local = true - looks friendly

I think CSP - it's kinda do and forget configuration, and we able to add sugar for it, to not ask developers about formal notation

from ember-cli-content-security-policy.

jelhan avatar jelhan commented on June 2, 2024

@rwjblue I'm willing to provide a PR for this but would like to know beforehand if you are willing to accept such a change of configuration API. Also the status of this addon is unclear to me. It has still a high weekly download numbers on NPM but PRs are open for a long time without feedback and it's missing any test coverage. 😞 Let me know if there is anything I could help with. This addon provides valuable feature for the ecosystem and could provide big value if known limitations (e.g. testing support) are addressed IMO.

from ember-cli-content-security-policy.

sandstrom avatar sandstrom commented on June 2, 2024

@jelhan Looks good overall!

Some thoughts:

  1. Should we use a key for delivery, instead of meta true/false?

and basically only deliver via header or meta, but not both. I think that may avoid some confusion + some issues around the directives that can only be delivered via headers.

  // …
  enabled: true,
  delivery: 'meta', // or 'header'
  // …
  1. How about the directives that don't have a value[1], for example block-all-mixed-content? Perhaps we could use "block-all-mixed-content": true, as the syntax for them

  2. Your example on the transition ENV.contentSecurityPolicyHeader === 'Content-Security-Policy', shouldn't that be ENV.contentSecurityPolicyHeader === 'Content-Security-Policy-Report-Only',?

  3. Do we know how many addons would be affected? It's great that you are thinking about the transition + supporting existing addons. Would very much prefer if this won't need to be a breaking change.

[1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/block-all-mixed-content

I know rwjblue still care about this repo and want to see it progress, but he's a busy person. So I'm certain it's not neglect, it's just a lack of bandwidth. Anyway, I have commit bits to this repo so I can help shepherd it through (though I'll try to get rwjblue to sign off on it first).

from ember-cli-content-security-policy.

jelhan avatar jelhan commented on June 2, 2024

Should we use a key for delivery, instead of meta true/false?

I like that one but would additionally support both as an option to not add a breaking change.

How about the directives that don't have a value[1], for example block-all-mixed-content? Perhaps we could use "block-all-mixed-content": true, as the syntax for them

I like that proposal. Are these ones currently supported?

Your example on the transition ENV.contentSecurityPolicyHeader === 'Content-Security-Policy', shouldn't that be ENV.contentSecurityPolicyHeader === 'Content-Security-Policy-Report-Only',?

💯 Updated first post accordingly.

Do we know how many addons would be affected? It's great that you are thinking about the transition + supporting existing addons. Would very much prefer if this won't need to be a breaking change.

A change here would not only affect addons but also a lot of application. This addon has 24.758 weekly downloads. That's a lot for our ecosystem. For comparison ember-cli has 120.459 weekly downloads. It was part of default blueprint of applications and addons for a long time.

from ember-cli-content-security-policy.

sandstrom avatar sandstrom commented on June 2, 2024
  1. Good point, how about allowing an array for the delivery key, so that the default could be:
// it would accept this (default, for backwards compatibility):
delivery: ['meta', 'header'],

// and also accept a single value
delivery: 'meta',

(in case there would be some future mechanism for CSP delivery)

  1. Not really, right now you could do this and it would kind of work:
block-all-mixed-content: '',
  1. Sounds good!

  2. Yes, that's a lot, we'll have to make sure this won't cause an unnecessary interruption.

from ember-cli-content-security-policy.

jelhan avatar jelhan commented on June 2, 2024

Most of the configuration refactoring discussed here has landed in #94. The policy object isn't refactored yet. @lifeart do you have time to work on that one as it was your suggestion? I'm totally in favor for it but like to focus on other parts of this addon. Would be great to change the configuration in one release only and not in several ones.

from ember-cli-content-security-policy.

lifeart avatar lifeart commented on June 2, 2024

@jelhan sorry, this week I have no time for it(.
I think we need more polishing on proposed config format, to have all items consistent.

from ember-cli-content-security-policy.

sandstrom avatar sandstrom commented on June 2, 2024

@lifeart Although I really appreciate that you'd like to help out improving this addon, I'm not convinced that we should move to something "dummers-frendly". Although I agree that CSP is complicated and sometimes confusing, there are also disadvantages to adding another layer of abstraction.

Happy to discuss further though! I could certainly change my mind if there are good arguments in favor of dumbing it down.

But just wanted to make this note so you don't start working on something that may not be merged in the end.

cc: @jelhan

from ember-cli-content-security-policy.

sandstrom avatar sandstrom commented on June 2, 2024

I'll go ahead and close this issue. But feel free to open a new if you want to discuss more changes to the config format! 😄

Thanks @jelhan for landing the first refactor!

from ember-cli-content-security-policy.

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.