WIP: ease usage with ember-cli-content-security-policy - #345
Conversation
|
Not fully sure why |
|
Thanks, I like this.
In a case like this one, |
|
I added I can refactor to classical methods to determine if the consuming application has the dependency. I was mostly using |
|
@ef4 Would it be an acceptable path forward for you to not use |
29d4183 to
536ad5f
Compare
536ad5f to
fb36452
Compare
|
|
||
| // fallback to default value, which should be `true` unless application | ||
| // has ember-cli-content-security-policy dependency | ||
| return !dependencySatisfies('ember-cli-content-security-policy', '*'); |
There was a problem hiding this comment.
We don't want this to ever return true when this.isAddon is true, because addons don't get to decide this. Only the Package instance representing the app should decide to maybe return true.
I think the difficulty you're having with @embroider/macros is that they're designed to go in runtime code, not node code. This is node code. Instead, take a look in this same file where we're checking the version of ember-source that the app is using. You can check whether the app is using ember-cli-content-security-policy the same way.
Currently all users of Ember CLI Content Security Policy must explicitly set
forbidEvaltotruein Ember Auto Import's configuration. Unless the very rare case that they allow"unsafe-eval"instyle-srcdirective.This is disruptive for users of both sides. Since Ember CLI blueprints for new application includes Ember Auto Import and many addons depend on it as well nearly all user of Ember CLI Content Security Policy must set that configuration. It does not help with adoption of CSP or testing for CSP compliance in Ember ecosystem.
This pull request propose to change the default value to depend on the presence of ember-cli-content-security-policy depenendency. If the application depends on ember-cli-content-security-policy
forbidEvaldefaults totrue. Otherwise it isfalse.I would not consider this as a breaking change. At least I'm not aware of a meaningful use case to not having
forbidEvalset totrueif CSP is used.