spring-projects / spring-projects/spring-security

SEC-1671: AnnotationSecurityAspect is missing pointcuts for JSR 250 annotations (@RolesAllowed etc.)

Open
#1,910 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: core type: enhancement type: jira
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

Torben Knerr (Migrated from SEC-1671) said:

With the spring-security-aspects 3.0.5.RELEASE the AnnotationSecurityAspect only defines pointcuts for @Secured, @PreAuthorize, @PostAuthorize, etc., but support for the JSR250 annotations (@RolesAllowed etc.) is missing. As a result you can not transparently switch between Spring AOP and AspectJ (mode="aspectj") when using JSR 250 annotations.

Attached is a preliminary implementation of Jsr250AnnotationSecurityAspect.aj.

As Jsr250MethodSecurityMetadataSource.java only supports @RolesAllowed, @DenyAll and @PermitAll (but not @RunAs and @DeclareRoles) until now the pointcuts are defined only for the prior annotations. Also note that it is based in javax.annotation:jsr250-api:1.0, which does not allow for @DenyAll on a type (has been corrected in 1.1 maintenance release of the specification, but I couldn't find it in the maven repository).

Not sure though whether it makes sense to put the jsr250-related aspects into a separate .aj file or add it to the existing AnnotationSecurityAspect.aj.

Feedback and reviews are welcome.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing AnnotationSecurityAspect.aj and Jsr250MethodSecurityMetadataSource.java, then inspect the attached preliminary Jsr250AnnotationSecurityAspect.aj implementation. Confirm which supported JSR 250 annotations need pointcuts and whether the aspects belong in one file or separate files; done means JSR 250 security works consistently with Spring AOP and AspectJ mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.