spring-security icon indicating copy to clipboard operation
spring-security copied to clipboard

NPE in ExpressionBasedPreInvocationAdvice

Open maxploter opened this issue 7 years ago • 1 comments

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
    }

maxploter avatar Apr 20 '19 20:04 maxploter

Fixed via 59acda0

jzheaux avatar Jun 13 '19 14:06 jzheaux