MCPcopy Create free account
hub / github.com/angular-ui/ui-router / $SceDelegateProvider

Function $SceDelegateProvider

test/angular/1.2/angular.js:13426–13672  ·  view source on GitHub ↗

* @ngdoc provider * @name $sceDelegateProvider * @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 sourcing An

()

Source from the content-addressed store, hash-verified

13424 */
13425
13426function $SceDelegateProvider() {
13427 this.SCE_CONTEXTS = SCE_CONTEXTS;
13428
13429 // Resource URLs can also be trusted by policy.
13430 var resourceUrlWhitelist = ['self'],
13431 resourceUrlBlacklist = [];
13432
13433 /**
13434 * @ngdoc method
13435 * @name $sceDelegateProvider#resourceUrlWhitelist
13436 * @kind function
13437 *
13438 * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value
13439 * provided. This must be an array or null. A snapshot of this array is used so further
13440 * changes to the array are ignored.
13441 *
13442 * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
13443 * allowed in this array.
13444 *
13445 * Note: **an empty whitelist array will block all URLs**!
13446 *
13447 * @return {Array} the currently set whitelist array.
13448 *
13449 * The **default value** when no whitelist has been explicitly set is `['self']` allowing only
13450 * same origin resource requests.
13451 *
13452 * @description
13453 * Sets/Gets the whitelist of trusted resource URLs.
13454 */
13455 this.resourceUrlWhitelist = function (value) {
13456 if (arguments.length) {
13457 resourceUrlWhitelist = adjustMatchers(value);
13458 }
13459 return resourceUrlWhitelist;
13460 };
13461
13462 /**
13463 * @ngdoc method
13464 * @name $sceDelegateProvider#resourceUrlBlacklist
13465 * @kind function
13466 *
13467 * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value
13468 * provided. This must be an array or null. A snapshot of this array is used so further
13469 * changes to the array are ignored.
13470 *
13471 * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
13472 * allowed in this array.
13473 *
13474 * The typical usage for the blacklist is to **block
13475 * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as
13476 * these would otherwise be trusted but actually return content from the redirected domain.
13477 *
13478 * Finally, **the blacklist overrides the whitelist** and has the final say.
13479 *
13480 * @return {Array} the currently set blacklist array.
13481 *
13482 * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there
13483 * is no blacklist.)

Callers

nothing calls this directly

Calls 2

adjustMatchersFunction · 0.70
generateHolderTypeFunction · 0.70

Tested by

no test coverage detected