How to sanitize and validate user input to pass a Checkmarx scan

前端 未结 2 1812
暖寄归人
暖寄归人 2021-02-20 17:06

I have an endpoint that receives a String from the client as seen below:

@GET
@Path(\"/{x}\")
public Response doSomething(@PathParam(\"x\") String x) {
    Stri         


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-20 17:50

    HtmlUtils from spring-web got the job done with:

    HtmlUtils.htmlEscape(x)

    Maven dependency:

    
        org.springframework
        spring-web
        5.1.7.RELEASE
    
    

提交回复
热议问题