Following are checkmarx issue details Unrestricted File Upload
Source Object : req (Line No - 39)
target Object : getInputStream (Line No -41)
public class JWTLoginFilter extends AbstractAuthenticationProcessingFilter
{
//...
38 public Authentication attemptAuthentication(HttpServletRequest req, HttpServletResponse res)
39 throws AuthenticationException, IOException, ServletException
40 {
41 Entitlements creds = new ObjectMapper().readValue(req.getInputStream(), Entitlements.class);
return getAuthenticationManager().authenticate(
new UsernamePasswordAuthenticationToken(creds.getId(), "", Collections.emptyList()));
}
//...
}
request objects get highlighted in checkmarx tool -
How do I properly validate, filter, escape, and/or encode user-controllable input to pass a Checkmarx scan?
This worked for me - checkmarx pass this high vulnerability
I used combination of @reflexdemon ans and @tgdavies comment