-
Notifications
You must be signed in to change notification settings - Fork 51
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
Throws in FastBoot if disabled or delivery does not include header #117
Comments
This also shows an issue with the test coverage. There are tests that the CSP header is not set for these scenarios but that tests do not assert the FastBoot build was successful: ember-cli-content-security-policy/node-tests/e2e/fastboot-support-test.js Lines 93 to 121 in 7c7031f
|
This was referenced Oct 10, 2019
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The run-time configuration is only present if addon is enabled and delivery contains
"header"
:ember-cli-content-security-policy/index.js
Lines 85 to 90 in 7c7031f
This is by design to prevent unnecessary bloat.
This run-time configuration is consumed by an instance initializer which is only present if the application depends on
ember-cli-fastboot
. It assert that the run-time configuration is present:ember-cli-content-security-policy/fastboot/instance-initializers/content-security-policy.js
Lines 10 to 13 in 7c7031f
If that assertion is stripped in a production build, the next line will throw with a
TypeError
causeconfig
is undefined:ember-cli-content-security-policy/fastboot/instance-initializers/content-security-policy.js
Line 15 in 7c7031f
The instance initializer is present even if addon is disabled or delivery does not include
"header"
. Since the run-time configuration is not available, it will throw.This should be fixed by only including the instance initalizier in the build if required. This would also prevent us from pushing code to the consuming application that is not needed.
The text was updated successfully, but these errors were encountered: