Why it matters
The image optimiser serves SVG files, which can carry script, from this origin.
How to fix it
Remove dangerouslyAllowSVG, or pair it with contentDispositionType: "attachment" and a contentSecurityPolicy of "script-src 'none'".
Example
The rule's own test fixtures, verbatim: the test suite requires the rule to report the first and not the second.
const config: NextConfig = {
images: { dangerouslyAllowSVG: true },
};
export default config;const config: NextConfig = {
images: {
dangerouslyAllowSVG: true,
contentDispositionType: "attachment",
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
},
};
export default config;What TrustIvan reads
Runs on repository scans of TypeScript source once static analysis is turned on (SAST_RULES and the separately built analyzer image); it is off by default.
Weakness classes and references
Related checks
- Next.js image any host (TypeScript)
TypeScriptSeverity: Medium
trustivan-typescript-next-image-any-host - JWT decode unverified (TypeScript)
TypeScriptSeverity: High
trustivan-typescript-jwt-decode-unverified - Next.js public secret (TypeScript)
TypeScriptSeverity: High
trustivan-typescript-next-public-secret - Token in localStorage (TypeScript)
TypeScriptSeverity: Medium
trustivan-typescript-token-in-localstorage - SQL template literal (TypeScript)
TypeScriptSeverity: Medium
trustivan-typescript-sql-template-literal - Target blank noopener (TypeScript)
TypeScriptSeverity: Low
trustivan-typescript-target-blank-noopener
Terms: SAST (static application security testing), Taint analysis, CWE (Common Weakness Enumeration), OWASP Top 10
All static analysis (SAST) checks · The whole catalogue · How this works in TrustIvan · Documentation