Skip to content

Commit

Permalink
docs: update CSP section to mention Angular's minimum requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
dgp1130 committed Sep 24, 2021
1 parent 49d29e1 commit 081d108
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion aio/content/guide/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,25 @@ Angular to allow binding into `<iframe src>`:

Content Security Policy (CSP) is a defense-in-depth
technique to prevent XSS. To enable CSP, configure your web server to return an appropriate
`Content-Security-Policy` HTTP header. Read more about content security policy at the
`Content-Security-Policy` HTTP header. Read more about content security policy at the
[Web Fundamentals guide](https://developers.google.com/web/fundamentals/security/csp) on the
Google Developers website.

The minimal policy required for brand new Angular is:

```
default-src 'self'; style-src 'self' 'unsafe-inline';
```

* The `default-src 'self';` section allows the page to load all its required resources from the same
origin.
* `style-src 'self' 'unsafe-inline';` allows the page to load global styles from the same origin
(`'self'`) and enables components to load their styles (`'unsafe-inline'` - see
[`angular/angular#6361`](https://github.com/angular/angular/issues/6361)).

As projects grow and evolve, it is often necessary to expand the policy to enable other features,
however this is all that is required by Angular for a new app.

{@a trusted-types}
### Enforcing Trusted Types

Expand Down

0 comments on commit 081d108

Please sign in to comment.