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

Function $SceDelegateProvider

lib/test/angular/1.8.0/angular.js:20152–20436  ·  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

20150 */
20151
20152function $SceDelegateProvider() {
20153 this.SCE_CONTEXTS = SCE_CONTEXTS;
20154
20155 // Resource URLs can also be trusted by policy.
20156 var resourceUrlWhitelist = ['self'],
20157 resourceUrlBlacklist = [];
20158
20159 /**
20160 * @ngdoc method
20161 * @name $sceDelegateProvider#resourceUrlWhitelist
20162 * @kind function
20163 *
20164 * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value
20165 * provided. This must be an array or null. A snapshot of this array is used so further
20166 * changes to the array are ignored.
20167 * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
20168 * allowed in this array.
20169 *
20170 * @return {Array} The currently set whitelist array.
20171 *
20172 * @description
20173 * Sets/Gets the whitelist of trusted resource URLs.
20174 *
20175 * The **default value** when no whitelist has been explicitly set is `['self']` allowing only
20176 * same origin resource requests.
20177 *
20178 * <div class="alert alert-warning">
20179 * **Note:** the default whitelist of 'self' is not recommended if your app shares its origin
20180 * with other apps! It is a good idea to limit it to only your application's directory.
20181 * </div>
20182 */
20183 this.resourceUrlWhitelist = function(value) {
20184 if (arguments.length) {
20185 resourceUrlWhitelist = adjustMatchers(value);
20186 }
20187 return resourceUrlWhitelist;
20188 };
20189
20190 /**
20191 * @ngdoc method
20192 * @name $sceDelegateProvider#resourceUrlBlacklist
20193 * @kind function
20194 *
20195 * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value
20196 * provided. This must be an array or null. A snapshot of this array is used so further
20197 * changes to the array are ignored.</p><p>
20198 * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
20199 * allowed in this array.</p><p>
20200 * The typical usage for the blacklist is to **block
20201 * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as
20202 * these would otherwise be trusted but actually return content from the redirected domain.
20203 * </p><p>
20204 * Finally, **the blacklist overrides the whitelist** and has the final say.
20205 *
20206 * @return {Array} The currently set blacklist array.
20207 *
20208 * @description
20209 * 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