CMckelvey129166 (Community Member) asked a question.

Why does the scan not see the @ControllerAdvice class in Spring Boot framework?

I am here because I have been using the VS Code Veracode Plugin for shifting left. It has been really good so far and helped me mitigate a lot but I am wondering about limitations within the path of the flaw. When a flaw is detected in the code, you can view the details of it and then inspect the path. I am building a Spring Boot app in Java 21 and have put in a @ControllerAdvice for all responses to requests in order to sanitize the result to fix a CWE-80 flaw.

Let me walk through this visually:

  1. After the flaw is found, click the Info icon to View flaw detailsimage478×449 14.7 KB
  2. When you click it, you’ll get a screen like below that starts on the fix but I have navigated to the Remediation Guidance tab. Here you can see the path and as you can tell, it stops at the ApiController and does not recognize the @ControllerAdvice class SanitizingResponseBodyAdvice.image1453×678 40.6 KB

I am curious if other Spring Boot devs that have been trying to mitigate CWE-80s or log neutralization in a one-stop-shop class because I find managing hundreds of locations with sanitation to be exhaustive and a huge time killer. There is a way to mitigate this manually but I thought it would make more sense for Veracode to consider the whole path of the request and maybe this is a limitation of Static Scanning? Anyone else experiencing this?


  • SamHouston (Veracode)

    Hi @CMckelvey129166 (Community Member)​ 

     

    Veracode Static Analysis will not recognize any controls for CWE-80 being done in a @ControllerAdvice annotated class.

     

    Static does look at/consider the full path, but it's possible that the whole path is not being displayed to you

     

    Expand Post
  • CMckelvey129166 (Community Member)

    I do understand that Veracode is having to scan all types of programming languages, frameworks and the like to catch these.

     

    Is it possible that when Veracode recognizes the project as a Spring Boot app that it could consider annotations such as @ControllerAdvice?

     

    I know I am essentially asking if Veracode can broaden their scope (feature request) but I think it is worth while with Spring Boot being a popular framework.

    Expand Post

Topics (1)

No articles found
Loading

Ask the Community

Get answers, share a use case, discuss your favorite features, or get input from the community.