Skip to main content

no-angularjs-sce-resource-url-wildcard

Disallow wildcard AngularJS SCE resource URL whitelist entries.

Targeted pattern scopeโ€‹

AngularJS SCE whitelist configurations using wildcard entries.

What this rule reportsโ€‹

resourceUrlWhitelist([...]) entries that contain wildcard values.

Why this rule existsโ€‹

Wildcard resource URL allowlists can over-trust unreviewed remote origins.

โŒ Incorrectโ€‹

$sceDelegateProvider.resourceUrlWhitelist(["self", "*"]);

โœ… Correctโ€‹

$sceDelegateProvider.resourceUrlWhitelist([
"self",
"https://cdn.example.com/app",
]);

ESLint flat config exampleโ€‹

import sdl from "eslint-plugin-sdl-2";

export default [
{
plugins: { sdl },

rules: {
"sdl/no-angularjs-sce-resource-url-wildcard": "error",
},
},
];

When not to use itโ€‹

Disable only if wildcard resource URLs are part of a reviewed legacy exception with strong compensating controls.

Package documentationโ€‹

Further readingโ€‹

Rule catalog ID: R031