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

Function $SceDelegateProvider

lib/test/angular/1.6.7/angular.js:19196–19461  ·  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

19194 */
19195
19196function $SceDelegateProvider() {
19197 this.SCE_CONTEXTS = SCE_CONTEXTS;
19198
19199 // Resource URLs can also be trusted by policy.
19200 var resourceUrlWhitelist = ['self'],
19201 resourceUrlBlacklist = [];
19202
19203 /**
19204 * @ngdoc method
19205 * @name $sceDelegateProvider#resourceUrlWhitelist
19206 * @kind function
19207 *
19208 * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value
19209 * provided. This must be an array or null. A snapshot of this array is used so further
19210 * changes to the array are ignored.
19211 * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
19212 * allowed in this array.
19213 *
19214 * @return {Array} The currently set whitelist array.
19215 *
19216 * @description
19217 * Sets/Gets the whitelist of trusted resource URLs.
19218 *
19219 * The **default value** when no whitelist has been explicitly set is `['self']` allowing only
19220 * same origin resource requests.
19221 *
19222 * <div class="alert alert-warning">
19223 * **Note:** the default whitelist of 'self' is not recommended if your app shares its origin
19224 * with other apps! It is a good idea to limit it to only your application's directory.
19225 * </div>
19226 */
19227 this.resourceUrlWhitelist = function(value) {
19228 if (arguments.length) {
19229 resourceUrlWhitelist = adjustMatchers(value);
19230 }
19231 return resourceUrlWhitelist;
19232 };
19233
19234 /**
19235 * @ngdoc method
19236 * @name $sceDelegateProvider#resourceUrlBlacklist
19237 * @kind function
19238 *
19239 * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value
19240 * provided. This must be an array or null. A snapshot of this array is used so further
19241 * changes to the array are ignored.</p><p>
19242 * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
19243 * allowed in this array.</p><p>
19244 * The typical usage for the blacklist is to **block
19245 * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as
19246 * these would otherwise be trusted but actually return content from the redirected domain.
19247 * </p><p>
19248 * Finally, **the blacklist overrides the whitelist** and has the final say.
19249 *
19250 * @return {Array} The currently set blacklist array.
19251 *
19252 * @description
19253 * 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