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

Function $SceDelegateProvider

lib/test/angular/1.5.0/angular.js:17447–17700  ·  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

17445 */
17446
17447function $SceDelegateProvider() {
17448 this.SCE_CONTEXTS = SCE_CONTEXTS;
17449
17450 // Resource URLs can also be trusted by policy.
17451 var resourceUrlWhitelist = ['self'],
17452 resourceUrlBlacklist = [];
17453
17454 /**
17455 * @ngdoc method
17456 * @name $sceDelegateProvider#resourceUrlWhitelist
17457 * @kind function
17458 *
17459 * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value
17460 * provided. This must be an array or null. A snapshot of this array is used so further
17461 * changes to the array are ignored.
17462 *
17463 * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
17464 * allowed in this array.
17465 *
17466 * <div class="alert alert-warning">
17467 * **Note:** an empty whitelist array will block all URLs!
17468 * </div>
17469 *
17470 * @return {Array} the currently set whitelist array.
17471 *
17472 * The **default value** when no whitelist has been explicitly set is `['self']` allowing only
17473 * same origin resource requests.
17474 *
17475 * @description
17476 * Sets/Gets the whitelist of trusted resource URLs.
17477 */
17478 this.resourceUrlWhitelist = function(value) {
17479 if (arguments.length) {
17480 resourceUrlWhitelist = adjustMatchers(value);
17481 }
17482 return resourceUrlWhitelist;
17483 };
17484
17485 /**
17486 * @ngdoc method
17487 * @name $sceDelegateProvider#resourceUrlBlacklist
17488 * @kind function
17489 *
17490 * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value
17491 * provided. This must be an array or null. A snapshot of this array is used so further
17492 * changes to the array are ignored.
17493 *
17494 * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
17495 * allowed in this array.
17496 *
17497 * The typical usage for the blacklist is to **block
17498 * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as
17499 * these would otherwise be trusted but actually return content from the redirected domain.
17500 *
17501 * Finally, **the blacklist overrides the whitelist** and has the final say.
17502 *
17503 * @return {Array} the currently set blacklist array.
17504 *

Callers

nothing calls this directly

Calls 2

adjustMatchersFunction · 0.70
generateHolderTypeFunction · 0.70

Tested by

no test coverage detected