Skip to main content

no-angularjs-enable-svg

Disallow enabling AngularJS sanitizer SVG support without strict review.

Targeted pattern scopeโ€‹

This rule targets $sanitizeProvider.enableSvg(true) calls.

What this rule reportsโ€‹

This rule reports code that enables SVG support in AngularJS sanitization configuration.

Why this rule existsโ€‹

SVG content can introduce scriptable surfaces and raise injection risk when enabled in sanitizers.

โŒ Incorrectโ€‹

$sanitizeProvider.enableSvg(true);

โœ… Correctโ€‹

$sanitizeProvider.enableSvg(false);

ESLint flat config exampleโ€‹

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

export default [
{
plugins: { sdl },
rules: {
"sdl/no-angularjs-enable-svg": "error",
},
},
];

When not to use itโ€‹

Disable only when SVG rendering is mandatory and guarded by a reviewed sanitization strategy.

Package documentationโ€‹

Further readingโ€‹

Rule catalog ID: R004