* @ngdoc provider * @name $sceDelegateProvider * @this * * @description * * The `$sceDelegateProvider` provider allows developers to configure the ng.$sceDelegate * $sceDelegate service. This allows one to get/set the whitelists and blacklists used to ensure * that the URLs used for
()
| 18629 | */ |
| 18630 | |
| 18631 | function $SceDelegateProvider() { |
| 18632 | this.SCE_CONTEXTS = SCE_CONTEXTS; |
| 18633 | |
| 18634 | // Resource URLs can also be trusted by policy. |
| 18635 | var resourceUrlWhitelist = ['self'], |
| 18636 | resourceUrlBlacklist = []; |
| 18637 | |
| 18638 | /** |
| 18639 | * @ngdoc method |
| 18640 | * @name $sceDelegateProvider#resourceUrlWhitelist |
| 18641 | * @kind function |
| 18642 | * |
| 18643 | * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value |
| 18644 | * provided. This must be an array or null. A snapshot of this array is used so further |
| 18645 | * changes to the array are ignored. |
| 18646 | * |
| 18647 | * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items |
| 18648 | * allowed in this array. |
| 18649 | * |
| 18650 | * <div class="alert alert-warning"> |
| 18651 | * **Note:** an empty whitelist array will block all URLs! |
| 18652 | * </div> |
| 18653 | * |
| 18654 | * @return {Array} the currently set whitelist array. |
| 18655 | * |
| 18656 | * The **default value** when no whitelist has been explicitly set is `['self']` allowing only |
| 18657 | * same origin resource requests. |
| 18658 | * |
| 18659 | * @description |
| 18660 | * Sets/Gets the whitelist of trusted resource URLs. |
| 18661 | */ |
| 18662 | this.resourceUrlWhitelist = function(value) { |
| 18663 | if (arguments.length) { |
| 18664 | resourceUrlWhitelist = adjustMatchers(value); |
| 18665 | } |
| 18666 | return resourceUrlWhitelist; |
| 18667 | }; |
| 18668 | |
| 18669 | /** |
| 18670 | * @ngdoc method |
| 18671 | * @name $sceDelegateProvider#resourceUrlBlacklist |
| 18672 | * @kind function |
| 18673 | * |
| 18674 | * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value |
| 18675 | * provided. This must be an array or null. A snapshot of this array is used so further |
| 18676 | * changes to the array are ignored. |
| 18677 | * |
| 18678 | * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items |
| 18679 | * allowed in this array. |
| 18680 | * |
| 18681 | * The typical usage for the blacklist is to **block |
| 18682 | * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as |
| 18683 | * these would otherwise be trusted but actually return content from the redirected domain. |
| 18684 | * |
| 18685 | * Finally, **the blacklist overrides the whitelist** and has the final say. |
| 18686 | * |
| 18687 | * @return {Array} the currently set blacklist array. |
| 18688 | * |
nothing calls this directly
no test coverage detected