You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java.lang.NullPointerException at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011) at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006) at org.springframework.expression.spel.support.StandardEvaluationContext.setVariable(StandardEvaluationContext.java:234) at org.springframework.security.access.expression.method.MethodSecurityEvaluationContext.addArgumentsAsVariables(MethodSecurityEvaluationContext.java:115) at org.springframework.security.access.expression.method.MethodSecurityEvaluationContext.lookupVariable(MethodSecurityEvaluationContext.java:70) at org.springframework.expression.spel.ExpressionState.lookupVariable(ExpressionState.java:146) at org.springframework.expression.spel.ast.VariableReference.getValueInternal(VariableReference.java:76) at org.springframework.expression.spel.ast.OpEQ.getValueInternal(OpEQ.java:42) at org.springframework.expression.spel.ast.OpEQ.getValueInternal(OpEQ.java:32) at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:116) at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:300) at org.springframework.security.access.expression.ExpressionUtils.evaluateAsBoolean(ExpressionUtils.java:26) at org.springframework.security.access.expression.method.ExpressionBasedPreInvocationAdvice.before(ExpressionBasedPreInvocationAdvice.java:59) at org.springframework.security.access.prepost.PreInvocationAuthorizationAdviceVoter.vote(PreInvocationAuthorizationAdviceVoter.java:72) at org.springframework.security.access.prepost.PreInvocationAuthorizationAdviceVoter.vote(PreInvocationAuthorizationAdviceVoter.java:40) at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:63) at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:233) at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:65) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) at com.example.SampleService$$EnhancerBySpringCGLIB$$712d7bb4.sample(<generated>) at com.example.SampleServiceTest.test(SampleServiceTest.java:23) ...
MethodSecurityEvaluationContext avoid to set null variable.
Because looking at StandardEvaluationContext#setVariable(String name, @Nullable Object value), name parameter must not null.
Thanks for the report. This is a duplicate of https://jira.spring.io/browse/SPR-17565 You can either switch to a different version of Spring Framework or you can ensure to annotate all of the parameters.
Summary
This method authorization code works fine with Spring Security 5.0.7.RELEASE.
But provides NPE with Spring Security 5.1.2.RELEASE,
Actual Behavior
Provices NPE...
This exception caused by StandardEvaluationContext supports concurrent variable modification (SPR-17448).
AnnotationParameterNameDiscoverer
find parameter names with@P
using Method#getParameterAnnotations. But not annotated parameter name will benull
and MethodSecurityEvaluationContext setnull
variable toStandardEvaluationContext
(ConcurrentHashMap
)...Expected Behavior
MethodSecurityEvaluationContext avoid to set
null
variable.Because looking at
StandardEvaluationContext#setVariable(String name, @Nullable Object value)
,name
parameter must notnull
.Configuration
Version
Sample
The text was updated successfully, but these errors were encountered: