-
Notifications
You must be signed in to change notification settings - Fork 109
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
WIP: ease usage with ember-cli-content-security-policy #345
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
forbidEval
totrue
in Ember Auto Import's configuration. Unless the very rare case that they allow"unsafe-eval"
instyle-src
directive.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
forbidEval
defaults 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
forbidEval
set totrue
if CSP is used.