Commit f35f334
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 angular#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 dd4ce50 commit f35f334
2 files changed
+33
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1880 | 1880 | | |
1881 | 1881 | | |
1882 | 1882 | | |
| 1883 | + | |
| 1884 | + | |
1883 | 1885 | | |
1884 | 1886 | | |
1885 | 1887 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4913 | 4913 | | |
4914 | 4914 | | |
4915 | 4915 | | |
| 4916 | + | |
4916 | 4917 | | |
4917 | 4918 | | |
4918 | 4919 | | |
| |||
4923 | 4924 | | |
4924 | 4925 | | |
4925 | 4926 | | |
| 4927 | + | |
| 4928 | + | |
| 4929 | + | |
| 4930 | + | |
| 4931 | + | |
| 4932 | + | |
| 4933 | + | |
| 4934 | + | |
| 4935 | + | |
| 4936 | + | |
| 4937 | + | |
| 4938 | + | |
| 4939 | + | |
| 4940 | + | |
| 4941 | + | |
| 4942 | + | |
| 4943 | + | |
| 4944 | + | |
| 4945 | + | |
| 4946 | + | |
| 4947 | + | |
| 4948 | + | |
| 4949 | + | |
| 4950 | + | |
| 4951 | + | |
| 4952 | + | |
| 4953 | + | |
| 4954 | + | |
| 4955 | + | |
| 4956 | + | |
4926 | 4957 | | |
4927 | 4958 | | |
4928 | 4959 | | |
| |||
0 commit comments