spring-security
spring-security copied to clipboard
NPE in ExpressionBasedPreInvocationAdvice
Summary
Get NPE while using @PreFilter before method invocation, if the method accepts more then one argument and annotation attribute filterTarget is not set.
Actual Behavior
java.lang.NullPointerException: null
at org.springframework.security.access.expression.method.ExpressionBasedPreInvocationAdvice.findFilterTarget(ExpressionBasedPreInvocationAdvice.java:86) ~[spring-security-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.security.access.expression.method.ExpressionBasedPreInvocationAdvice.before(ExpressionBasedPreInvocationAdvice.java:50) ~[spring-security-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.security.access.prepost.PreInvocationAuthorizationAdviceVoter.vote(PreInvocationAuthorizationAdviceVoter.java:72) ~[spring-security-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
Expected Behavior
Provide a related exception message.
Version
spring-security-core-5.0.9.RELEASE
Sample
@PutMapping(value = "/test")
@PreFilter("true")
public void update(@RequestBody List<String> listForFilter, @RequestParam String param) {
//some logic
}
Fixed via 59acda0