-
Notifications
You must be signed in to change notification settings - Fork 27.4k
CSP not working by default (Chrome App) #7391
Comments
Hi, |
If I include the CSS and do not add ng-csp almost everything is broken. If I had ng-csp, the page works fine. How does Angular detect it needs to use the ng-csp directive? |
http://w3c.github.io/webappsec/specs/content-security-policy/csp-specification.dev.html this is something which is changing on an ongoing basis. While some things have been more or less settled, not everything has, Chrome does not necessarily ship all of this perfectly (although two of the chrome/blink guys are editors of that draft, this doesn't actually mean that they ship everything in the specs immediately, they usually need interest from other vendors to ship stuff). Basically, the situation with living standards can be a bit problematic early on in their lives. This is just my own opinion and does not necessarily reflect the opinions of anyone on the Chrome, Blink, or Angular teams, but you're probably better off /not/ ignoring ng-csp, in order to be sure that you get a workable Chrome app regardless of device. We should eventually be able to consistently detect CSP mode, but unfortunately that day is not today. If you want to dig into the spec and browser implementations, you can help us fix problems with our CSP detection, too. |
Ok, thanks. |
thanks, so we have to include ng-csp directive, angular-cap.css and angular-cap.css! |
I'm using Angular 1.2.16 and I'm getting a bunch of the following error when launching my app as a chrome app:
The Angular Chrome App documentation states that the
ng-csp
is no longer necessary:I've tried setting the
ng-csp
directive in my HTML to see if it would help and it does fix those errors (but most of myng-if
s andng-show
s are still broken 👎). That being said, I'd rather avoid ng-csp if it is not necessary (since it's slower I'd rather only use it on my chrome packaged app).Any tips? Is this a known bug?
Update: I also tested with Angular 1.3, same bug
Update: I just fixed the ng-if/ng-show problem by manually including
angular-csp.css
:<link rel="stylesheet" href="bower_components/angular/angular-csp.css" />
.Adding ng-csp directive now fixed the obvious bugs. That being said, I'm a bit worried that this will degrade performance on the hosted version of my app. Is my worry justified? Is there any easy way to conditionally enable ng-csp/angular-csp.css without having to maintain 2 different
index.html
files?The text was updated successfully, but these errors were encountered: