Description
Juha Komulainen opened SPR-13015 and commented
When an element is annotated with multiple composed annotations that are meta-annotated with the target annotation, the first meta-annotation is returned, and the rest are silently discarded. This seems quite dangerous.
Consider the following example using Spring Security:
@Retention(RUNTIME)
@PreAuthorize("isAuthenticated()")
public @interface RequireAuthenticated { }
@Retention(RUNTIME)
@PreAuthorize("hasRole('FROBNICATION')")
public @interface RequireFrobnication { }
Now consider a method annoted with both:
@RequireAuthenticated
@RequireFrobnication
public void myMethod() { }
Spring Security will query the annotation with AnnotationUtils.getAnnotation(method, PreAuthorize.class)
, but the call will silently ignore the second annotation and produce a security vulnerability.
Of course there are probably other similar issues in Spring that have nothing to do with Spring Security.
Affects: 4.1.6
Reference URL: https://gist.github.com/komu/cadd2e1d3ce9b193fe55
Issue Links:
- Explicit failure if multiple @BootstrapWith annotations are used on the same test [SPR-12602] #17203 Explicit failure if multiple
@BootstrapWith
annotations are used on the same test
1 votes, 7 watchers