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

Function $SceDelegateProvider

lib/test/angular/1.4.3/angular.js:16454–16700  ·  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

16452 */
16453
16454function $SceDelegateProvider() {
16455 this.SCE_CONTEXTS = SCE_CONTEXTS;
16456
16457 // Resource URLs can also be trusted by policy.
16458 var resourceUrlWhitelist = ['self'],
16459 resourceUrlBlacklist = [];
16460
16461 /**
16462 * @ngdoc method
16463 * @name $sceDelegateProvider#resourceUrlWhitelist
16464 * @kind function
16465 *
16466 * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value
16467 * provided. This must be an array or null. A snapshot of this array is used so further
16468 * changes to the array are ignored.
16469 *
16470 * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
16471 * allowed in this array.
16472 *
16473 * Note: **an empty whitelist array will block all URLs**!
16474 *
16475 * @return {Array} the currently set whitelist array.
16476 *
16477 * The **default value** when no whitelist has been explicitly set is `['self']` allowing only
16478 * same origin resource requests.
16479 *
16480 * @description
16481 * Sets/Gets the whitelist of trusted resource URLs.
16482 */
16483 this.resourceUrlWhitelist = function(value) {
16484 if (arguments.length) {
16485 resourceUrlWhitelist = adjustMatchers(value);
16486 }
16487 return resourceUrlWhitelist;
16488 };
16489
16490 /**
16491 * @ngdoc method
16492 * @name $sceDelegateProvider#resourceUrlBlacklist
16493 * @kind function
16494 *
16495 * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value
16496 * provided. This must be an array or null. A snapshot of this array is used so further
16497 * changes to the array are ignored.
16498 *
16499 * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
16500 * allowed in this array.
16501 *
16502 * The typical usage for the blacklist is to **block
16503 * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as
16504 * these would otherwise be trusted but actually return content from the redirected domain.
16505 *
16506 * Finally, **the blacklist overrides the whitelist** and has the final say.
16507 *
16508 * @return {Array} the currently set blacklist array.
16509 *
16510 * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there
16511 * is no blacklist.)

Callers

nothing calls this directly

Calls 2

adjustMatchersFunction · 0.70
generateHolderTypeFunction · 0.70

Tested by

no test coverage detected