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

@EnableReactiveMethodSecurity causes premature initialization of the ObservationRegistry and prevents it from being post-processed #12780

Closed
wilkinsona opened this issue Feb 24, 2023 · 2 comments
Assignees
Labels
in: config An issue in spring-security-config type: bug A general bug
Milestone

Comments

@wilkinsona
Copy link
Member

Describe the bug

@EnableReactiveMethodSecurity causes premature initialization of the ObservationRegistry and prevents it from being post-processed.

The preAuthorizeInterceptor bean defined in ReactiveAuthorizationManagerMethodSecurityConfiguration is an Advisor so it's created very early by the AOP infrastructure. It injects an ObjectProvider<ObservationRegistry> which should delay the creation of the ObservationRegistry. Unfortunately, this provider is passed into ReactiveAuthorizationManagerMethodSecurityConfiguration#manager which immediately calls getIfAvailable(). As a result the ObservationRegistry is created very early as part of setting up the AOP infrastructure and this prevents it from being post-processed.

To Reproduce

See the sample provided in spring-projects/spring-boot#34366.

Expected behavior

@EnableReactiveMethodSecurity does not prevent the ObservationRegistry from being post-processed.

Sample

See the sample provided in spring-projects/spring-boot#34366.

@cse050
Copy link

cse050 commented Mar 18, 2023

Hi Josh,

thx for resolving this.

Would you know which spring boot release which will contain this change?

bbd31f0

@philwebb
Copy link
Member

@cse050 The fix will be in Spring Security 6.0.3 (check the milestone of this issue) which has not yet been released. Spring Security 6.0.3 is due to be released on April 17 which means it should be in Spring Boot 3.0.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: config An issue in spring-security-config type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants