How to sanitize and validate user input to pass a Checkmarx scan
in .Net framework > 4.0 use AntiXSS
AntiXssEncoder.HtmlEncode()
HtmlUtils from spring-web
got the job done with:
HtmlUtils.htmlEscape(x)
Maven dependency:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.1.7.RELEASE</version>
</dependency>