no-angular-sanitization-trusted-urls
Disallow AngularJS trusted URL list mutations that weaken sanitizer defaults.
Targeted pattern scopeโ
This rule targets calls that mutate AngularJS trusted URL list settings:
$compileProvider.aHrefSanitizationTrustedUrlList(...)$compileProvider.imgSrcSanitizationTrustedUrlList(...).
What this rule reportsโ
This rule reports direct calls that broaden which URL patterns AngularJS treats as trusted for links and image sources.
Why this rule existsโ
Relaxing trusted URL lists can enable unsafe protocols or domains and increase XSS and data exfiltration risk.
โ Incorrectโ
$compileProvider.aHrefSanitizationTrustedUrlList(/.*/);
$compileProvider.imgSrcSanitizationTrustedUrlList(/.*/);
โ Correctโ
// Keep framework defaults unless a narrow, reviewed allow-list is required.
ESLint flat config exampleโ
import sdl from "eslint-plugin-sdl-2";
export default [
{
plugins: { sdl },
rules: {
"sdl/no-angular-sanitization-trusted-urls": "error",
},
},
];
When not to use itโ
Disable only for legacy AngularJS deployments where URL list updates are strictly reviewed and monitored.
Package documentationโ
Further readingโ
Rule catalog ID: R002