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

Function $SceDelegateProvider

lib/test/angular/1.7.0/angular.js:19507–19791  ·  view source on GitHub ↗

* @ngdoc provider * @name $sceDelegateProvider * @this * * @description * * The `$sceDelegateProvider` provider allows developers to configure the ng.$sceDelegate * $sceDelegate service, used as a delegate for ng.$sce Strict Contextual Escaping (SCE). * * The `$sceDelegatePr

()

Source from the content-addressed store, hash-verified

19505 */
19506
19507function $SceDelegateProvider() {
19508 this.SCE_CONTEXTS = SCE_CONTEXTS;
19509
19510 // Resource URLs can also be trusted by policy.
19511 var resourceUrlWhitelist = ['self'],
19512 resourceUrlBlacklist = [];
19513
19514 /**
19515 * @ngdoc method
19516 * @name $sceDelegateProvider#resourceUrlWhitelist
19517 * @kind function
19518 *
19519 * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value
19520 * provided. This must be an array or null. A snapshot of this array is used so further
19521 * changes to the array are ignored.
19522 * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
19523 * allowed in this array.
19524 *
19525 * @return {Array} The currently set whitelist array.
19526 *
19527 * @description
19528 * Sets/Gets the whitelist of trusted resource URLs.
19529 *
19530 * The **default value** when no whitelist has been explicitly set is `['self']` allowing only
19531 * same origin resource requests.
19532 *
19533 * <div class="alert alert-warning">
19534 * **Note:** the default whitelist of 'self' is not recommended if your app shares its origin
19535 * with other apps! It is a good idea to limit it to only your application's directory.
19536 * </div>
19537 */
19538 this.resourceUrlWhitelist = function(value) {
19539 if (arguments.length) {
19540 resourceUrlWhitelist = adjustMatchers(value);
19541 }
19542 return resourceUrlWhitelist;
19543 };
19544
19545 /**
19546 * @ngdoc method
19547 * @name $sceDelegateProvider#resourceUrlBlacklist
19548 * @kind function
19549 *
19550 * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value
19551 * provided. This must be an array or null. A snapshot of this array is used so further
19552 * changes to the array are ignored.</p><p>
19553 * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
19554 * allowed in this array.</p><p>
19555 * The typical usage for the blacklist is to **block
19556 * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as
19557 * these would otherwise be trusted but actually return content from the redirected domain.
19558 * </p><p>
19559 * Finally, **the blacklist overrides the whitelist** and has the final say.
19560 *
19561 * @return {Array} The currently set blacklist array.
19562 *
19563 * @description
19564 * Sets/Gets the blacklist of trusted resource URLs.

Callers

nothing calls this directly

Calls 2

adjustMatchersFunction · 0.70
generateHolderTypeFunction · 0.70

Tested by

no test coverage detected