This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Commit 04cad41
fix($compile): secure
User-controlled imports or stylesheets can run script in your origin,
which warrants that we require that they are safe `RESOURCE_URL`s.
Closes #14687
BREAKING CHANGE
`link[href]` attributes are now protected via `$sce`, which prevents interpolated
values that fail the `RESOURCE_URL` context tests from being used in interpolation.
For example if the application is running at `https://docs.angularjs.org` then the
following will fail:
```
<link href="{{ 'http://mydomain.org/unsafe.css' }}" rel="stylesheet">
```
By default, `RESOURCE_URL` safe URLs are only allowed from the same domain and protocol
as the application document.
To use URLs from other domains and/or protocols, you may either whitelist them or
wrap it into a trusted value by calling `$sce.trustAsResourceUrl(url)`.link[href] as a RESOURCE_URLs in $sce.1 parent 3b4bfa1 commit 04cad41
2 files changed
+33
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2971 | 2971 | | |
2972 | 2972 | | |
2973 | 2973 | | |
| 2974 | + | |
| 2975 | + | |
2974 | 2976 | | |
2975 | 2977 | | |
2976 | 2978 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10171 | 10171 | | |
10172 | 10172 | | |
10173 | 10173 | | |
| 10174 | + | |
10174 | 10175 | | |
10175 | 10176 | | |
10176 | 10177 | | |
| |||
10181 | 10182 | | |
10182 | 10183 | | |
10183 | 10184 | | |
| 10185 | + | |
| 10186 | + | |
| 10187 | + | |
| 10188 | + | |
| 10189 | + | |
| 10190 | + | |
| 10191 | + | |
| 10192 | + | |
| 10193 | + | |
| 10194 | + | |
| 10195 | + | |
| 10196 | + | |
| 10197 | + | |
| 10198 | + | |
| 10199 | + | |
| 10200 | + | |
| 10201 | + | |
| 10202 | + | |
| 10203 | + | |
| 10204 | + | |
| 10205 | + | |
| 10206 | + | |
| 10207 | + | |
| 10208 | + | |
| 10209 | + | |
| 10210 | + | |
| 10211 | + | |
| 10212 | + | |
| 10213 | + | |
| 10214 | + | |
10184 | 10215 | | |
10185 | 10216 | | |
10186 | 10217 | | |
| |||
0 commit comments