Dependency graph doesn't load with CSP that blocks inline scripts
See original GitHub issueCurrent Behavior
When generating a static dependency graph with nx dep-graph --file=output/index.html
, index.html
contains the project data as inline scripts (see this and this). If one wants to deploy this page with a Content Security Policy that prohibits inline scripts, the application fails to load.
Expected Behavior
The application should work when deployed with a Content Security Policy that blocks inline scripts.
Steps to Reproduce
git clone https://github.com/nrwl/nx-examples
cd nx-examples
npm install
npm run dep-graph -- --file=output/index.html
cat << EOF >> serve.json
{
"public": "output",
"headers": [{
"source": "*",
"headers": [{
"key": "Content-Security-Policy",
"value": "script-src 'self'"
}]
}]
}
EOF
npx serve@11.3.2
Failure Logs
Content Security Policy: The page's settings blocked the loading of a resource at inline ("script-src").
...
Uncaught TypeError: can't access property "filter", window.affected is undefined
Proposal
Write the project data to a separate script which is loaded from index.html
.
Environment
Node : 14.15.4 OS : darwin x64 yarn : 1.22.10
nx : Not Found @nrwl/angular : 11.0.1-rc.0 @nrwl/cli : 11.0.1-rc.0 @nrwl/cypress : 11.0.1-rc.0 @nrwl/devkit : 11.0.1-rc.0 @nrwl/eslint-plugin-nx : Not Found @nrwl/express : Not Found @nrwl/jest : 11.0.1-rc.0 @nrwl/linter : 11.0.1-rc.0 @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : Not Found @nrwl/react : 11.0.1-rc.0 @nrwl/schematics : Not Found @nrwl/tao : 11.0.1-rc.0 @nrwl/web : 11.0.1-rc.0 @nrwl/workspace : 11.0.1-rc.0 typescript : 4.0.3
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
This issue will be resolved when the merged PR makes it to a release. Look for it soon!
Any chance this issue could be opened again?