Rule Definition
Ensure that users cannot add unchecked HTML string. It helps detect and mitigate certain types of attacks, including Cross Site Scripting (XSS) and data injection attacks.
Remediation
Ensure you do not specify dangerous protocols like http(s) nor javascript in whitelist APIs
Violation Code Sample
// http or javascript URI are possible
myModule.config(function($compileProvider){
$compileProvider.imgSrcSanitizationWhitelist(/^(http(s)?|javascript):.*/);
});
Fixed Code Sample
// http or javascript URI are possible
myModule.config(function($compileProvider){
$compileProvider.imgSrcSanitizationWhitelist(/*);
});
Reference
https://docs.angularjs.org/api/ng/provider/$compileProvider#imgSrcSanitizationWhitelist
https://docs.angularjs.org/api/ng/provider/$compileProvider#aHrefSanitizationWhitelist
Related Technologies
Technical Criterion
CWE-79 - Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.