Title: Remove eval and Function from build to support strict CSP · Issue #6872 · angular/angular-cli · GitHub
Open Graph Title: Remove eval and Function from build to support strict CSP · Issue #6872 · angular/angular-cli
X Title: Remove eval and Function from build to support strict CSP · Issue #6872 · angular/angular-cli
Description: Bug Report or Feature Request (mark with an x) - [ ] bug report -> please search issues before submitting - [x] feature request Versions. @angular/cli: 1.2.0 node: 8.1.0 os: darwin x64 @angular/animations: 4.2.5 @angular/common: 4.2.5 @a...
Open Graph Description: Bug Report or Feature Request (mark with an x) - [ ] bug report -> please search issues before submitting - [x] feature request Versions. @angular/cli: 1.2.0 node: 8.1.0 os: darwin x64 @angular/ani...
X Description: Bug Report or Feature Request (mark with an x) - [ ] bug report -> please search issues before submitting - [x] feature request Versions. @angular/cli: 1.2.0 node: 8.1.0 os: darwin x64 @angular/...
Opengraph URL: https://github.com/angular/angular-cli/issues/6872
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Remove eval and Function from build to support strict CSP","articleBody":"### Bug Report or Feature Request (mark with an `x`)\r\n```\r\n- [ ] bug report -> please search issues before submitting\r\n- [x] feature request\r\n```\r\n\r\n### Versions.\r\n\r\n```\r\n@angular/cli: 1.2.0\r\nnode: 8.1.0\r\nos: darwin x64\r\n@angular/animations: 4.2.5\r\n@angular/common: 4.2.5\r\n@angular/compiler: 4.2.5\r\n@angular/core: 4.2.5\r\n@angular/forms: 4.2.5\r\n@angular/http: 4.2.5\r\n@angular/platform-browser: 4.2.5\r\n@angular/platform-browser-dynamic: 4.2.5\r\n@angular/router: 4.2.5\r\n@angular/cli: 1.2.0\r\n@angular/compiler-cli: 4.2.5\r\n@angular/language-service: 4.2.5\r\n```\r\n\r\n### Repro steps.\r\n\r\n```bash\r\n$ ng new test-csp\r\n$ yarn add web-ext\r\n```\r\n\r\nCreate `src/manifest.json` with:\r\n\r\n```json\r\n{\r\n \"manifest_version\": 2,\r\n \"name\": \"test-csp\",\r\n \"version\": \"1.0\",\r\n \"browser_action\": {\r\n \"default_title\": \"test-csp\",\r\n \"default_popup\": \"/index.html\"\r\n }\r\n}\r\n```\r\n\r\nAdd `manifest.json` to the `apps[0].assets` in the `.angular-cli.json`.\r\n\r\nRepo available here https://github.com/saulshanabrook/test-csp\r\n\r\n\r\n### The log given by the failure.\r\nRegular build:\r\n\r\n```\r\n$ ng build\r\n$ ./node_modules/.bin/web-ext lint -s dist\r\nValidation Summary:\r\n\r\nerrors 0\r\nnotices 0\r\nwarnings 11\r\n\r\nWARNINGS:\r\n\r\nCode Message Description File Line Column\r\nDANGEROUS_EVAL The Function constructor is Evaluation of strings as code can lead to security polyfills.bundle.js 286 22\r\n eval. vulnerabilities and performance issues, even in the most\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nDANGEROUS_EVAL The Function constructor is Evaluation of strings as code can lead to security polyfills.bundle.js 850 71\r\n eval. vulnerabilities and performance issues, even in the most\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nDANGEROUS_EVAL The Function constructor is Evaluation of strings as code can lead to security polyfills.bundle.js 2397 11\r\n eval. vulnerabilities and performance issues, even in the most\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nDANGEROUS_EVAL eval can be harmful. Evaluation of strings as code can lead to security polyfills.bundle.js 2397 43\r\n vulnerabilities and performance issues, even in the most\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nDANGEROUS_EVAL The Function constructor is Evaluation of strings as code can lead to security vendor.bundle.js 2576 11\r\n eval. vulnerabilities and performance issues, even in the most\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nDANGEROUS_EVAL eval can be harmful. Evaluation of strings as code can lead to security vendor.bundle.js 2576 43\r\n vulnerabilities and performance issues, even in the most\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nDANGEROUS_EVAL The Function constructor is Evaluation of strings as code can lead to security vendor.bundle.js 36267 73\r\n eval. vulnerabilities and performance issues, even in the most\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nDANGEROUS_EVAL The Function constructor is Evaluation of strings as code can lead to security vendor.bundle.js 36273 17\r\n eval. vulnerabilities and performance issues, even in the most\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nDANGEROUS_EVAL The Function constructor is Evaluation of strings as code can lead to security vendor.bundle.js 36281 17\r\n eval. vulnerabilities and performance issues, even in the most\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nUNSAFE_VAR_ASSIGNMENT Unsafe assignment to innerHTML Due to both security and performance concerns, this may not vendor.bundle.js 50833 71\r\n be set using dynamic values which have not been adequately\r\n sanitized. This can lead to security issues or fairly serious\r\n performance degradation.\r\nUNSAFE_VAR_ASSIGNMENT Unsafe assignment to innerHTML Due to both security and performance concerns, this may not vendor.bundle.js 50878 9\r\n be set using dynamic values which have not been adequately\r\n sanitized. This can lead to security issues or fairly serious\r\n performance degradation.\r\n```\r\n\r\nProduction build:\r\n\r\n```\r\n$ ng build --prod\r\n$ ./node_modules/.bin/web-ext lint -s dist\r\nValidation Summary:\r\n\r\nerrors 0\r\nnotices 0\r\nwarnings 11\r\n\r\nWARNINGS:\r\n\r\nCode Message Description File Line Column\r\nDANGEROUS_EVAL The Function constructor is Evaluation of strings as code can lead to security polyfills.35d6fc6174fa08d451d6… 1 52746\r\n eval. vulnerabilities and performance issues, even in the most .bundle.js\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nDANGEROUS_EVAL eval can be harmful. Evaluation of strings as code can lead to security polyfills.35d6fc6174fa08d451d6… 1 52776\r\n vulnerabilities and performance issues, even in the most .bundle.js\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nDANGEROUS_EVAL The Function constructor is Evaluation of strings as code can lead to security polyfills.35d6fc6174fa08d451d6… 1 55491\r\n eval. vulnerabilities and performance issues, even in the most .bundle.js\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nDANGEROUS_EVAL The Function constructor is Evaluation of strings as code can lead to security polyfills.35d6fc6174fa08d451d6… 1 56434\r\n eval. vulnerabilities and performance issues, even in the most .bundle.js\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nDANGEROUS_EVAL The Function constructor is Evaluation of strings as code can lead to security vendor.7157c5dcd45d72de6187.bu… 1 54515\r\n eval. vulnerabilities and performance issues, even in the most ndle.js\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nDANGEROUS_EVAL The Function constructor is Evaluation of strings as code can lead to security vendor.7157c5dcd45d72de6187.bu… 1 54590\r\n eval. vulnerabilities and performance issues, even in the most ndle.js\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nDANGEROUS_EVAL The Function constructor is Evaluation of strings as code can lead to security vendor.7157c5dcd45d72de6187.bu… 1 54778\r\n eval. vulnerabilities and performance issues, even in the most ndle.js\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nDANGEROUS_EVAL The Function constructor is Evaluation of strings as code can lead to security vendor.7157c5dcd45d72de6187.bu… 1 127089\r\n eval. vulnerabilities and performance issues, even in the most ndle.js\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nDANGEROUS_EVAL eval can be harmful. Evaluation of strings as code can lead to security vendor.7157c5dcd45d72de6187.bu… 1 127119\r\n vulnerabilities and performance issues, even in the most ndle.js\r\n innocuous of circumstances. Please avoid using `eval` and the\r\n `Function` constructor when at all possible.'\r\nUNSAFE_VAR_ASSIGNMENT Unsafe assignment to innerHTML Due to both security and performance concerns, this may not vendor.7157c5dcd45d72de6187.bu… 1 141593\r\n be set using dynamic values which have not been adequately ndle.js\r\n sanitized. This can lead to security issues or fairly serious\r\n performance degradation.\r\nUNSAFE_VAR_ASSIGNMENT Unsafe assignment to innerHTML Due to both security and performance concerns, this may not vendor.7157c5dcd45d72de6187.bu… 1 142070\r\n be set using dynamic values which have not been adequately ndle.js\r\n sanitized. This can lead to security issues or fairly serious\r\n performance degradation.\r\n```\r\n\r\n\r\n### Desired functionality.\r\n\r\nWe should be able to build the project with no CSP errors. That means eliminating all uses of `eval` and `Function`. This is needed in order for Mozilla to let any Angular 2 apps be submitted as extensions on their store. For example, I got this response when trying to submit an extension:\r\n\r\n> This version didn't pass review because of the following problems:\r\n>\r\n> 1) 'unsafe-eval' usage into Content Security Policy.\r\n> \r\n> We generally don't accept using the 'eval' function. There are many reasons not to use 'eval', and there are alternatives available. You can read more about it here: https://developer.mozilla.org/en/XUL_School/Appendix_C:_Avoid_using_eval_in_Add-ons\r\n\r\n\r\n### Mention any other details that might be useful.\r\nMoved from https://github.com/angular/angular-cli/issues/1279#issuecomment-312618535.\r\n\r\n\r\nThis might be blocked on Angular core https://github.com/angular/angular/issues/6361 https://github.com/angular/angular/issues/1744.","author":{"url":"https://github.com/saulshanabrook","@type":"Person","name":"saulshanabrook"},"datePublished":"2017-07-03T14:34:33Z","url":"https://github.com/angular/angular-cli/issues/6872"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e479ad09-ddc9-061c-8349-db7b486bc5c0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B106:7F641:19DFF18:22108B5:6B055B60 |
| html-safe-nonce | 1bf4027e82d238850f3f291b01550a009dc7913177fd96a2bce6c969adda8d1a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMTA2OjdGNjQxOjE5REZGMTg6MjIxMDhCNTo2QjA1NUI2MCIsInZpc2l0b3JfaWQiOiIzODQ4MTY5MTI0NjQ2OTgyMDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 852124aa9708f6dee89f94dea1c3739b120b9ca376c3ee9e50edca96f7886004 |
| hovercard-subject-tag | issue:240191031 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/6872/issue_layout |
| twitter:image | https://opengraph.githubassets.com/410ae24a4eaaa9f7e24ce2c0228f042971e2bea249e9162102fd36e496ade8e0/angular/angular-cli/issues/6872 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/410ae24a4eaaa9f7e24ce2c0228f042971e2bea249e9162102fd36e496ade8e0/angular/angular-cli/issues/6872 |
| og:image:alt | Bug Report or Feature Request (mark with an x) - [ ] bug report -> please search issues before submitting - [x] feature request Versions. @angular/cli: 1.2.0 node: 8.1.0 os: darwin x64 @angular/ani... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | saulshanabrook |
| hostname | github.com |
| expected-hostname | github.com |
| None | a79a02b7e7546ea306864e922ed2103ef4c04fac63168e11c2b2d4d816793080 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 10dff83edfd4f3617a7792a152d44991587b434c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width