我遇到了以下代码的强化警报,错误为Mass Assignment: Insecure Binder Configuration
我的控制器类在下面用于异常处理
class MyController {
...
@ExceptionHandler
@ResponseStatus(HttpStatus.NOT_FOUND)
public ErrorResponse handleRequestNotFoundException(RequestNotFoundException exception) {
log.error("The request was not found", exception);
return ErrorResponse.builder().message("Request not found").build();
}
...
}
例外类是
@ResponseStatus(value = HttpStatus.NOT_FOUND, reason = "No such request found")
public class RequestNotFoundException extends RuntimeException {
}
有人可以帮助我们如何摆脱此警报吗?预先感谢