Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AuthorizationAnnotationUtils.findUniqueAnnotation broken for synthetic methods #13132

Closed
f-cramer opened this issue May 4, 2023 · 1 comment · Fixed by #13148
Closed

AuthorizationAnnotationUtils.findUniqueAnnotation broken for synthetic methods #13132

f-cramer opened this issue May 4, 2023 · 1 comment · Fixed by #13148
Assignees
Labels
in: core An issue in spring-security-core type: bug A general bug
Milestone

Comments

@f-cramer
Copy link

f-cramer commented May 4, 2023

Describe the bug
When annotating a method that causes a synthetic method to be created (for example when overriding Spring Datas ListCrudRepository#findAllById which in turn overrides CrudRepository#findAllById) both the original and the synthetic method will contain this annotation when checking at runtime. This leads to a AnnotationConfigurationException being thrown when trying to call the overridden method although the annotation is only present once in the source code

To Reproduce
Check out https://github.com/f-cramer/spring-security-synthetic-methods an call http://localhost:8080/books with username admin and password abc123.

Expected behavior
Synthetic methods should be ignored when validating the uniqueness of security annotations

@f-cramer f-cramer added status: waiting-for-triage An issue we've not yet triaged type: bug A general bug labels May 4, 2023
@jzheaux
Copy link
Contributor

jzheaux commented May 8, 2023

Good catch, @f-cramer. Are you able to provide a PR against the 5.8.x branch that includes a test to address the issue?

@jzheaux jzheaux self-assigned this May 8, 2023
@jzheaux jzheaux added in: core An issue in spring-security-core and removed status: waiting-for-triage An issue we've not yet triaged labels May 8, 2023
@jzheaux jzheaux added this to the 5.8.x milestone May 8, 2023
jzheaux added a commit that referenced this issue May 11, 2023

Verified

This commit was signed with the committer’s verified signature.
W-A-James Warren James
Issue gh-13132
@jzheaux jzheaux modified the milestones: 5.8.x, 5.8.4 May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core An issue in spring-security-core type: bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants