Repository navigation
Conversation
prashantpiyush1111
left a comment
There was a problem hiding this comment.
LGTM. Verified independently — confirmed the enclosing JakartaSecurityServletFilterConfiguration already has @AutoConfigureAfter(SecurityFilterAutoConfiguration), so the new @ConditionalOnBean(SecurityFilterChain.class) correctly sees Spring Boot's own security autoconfiguration after it's run (avoids the classic ordering pitfall with cross-autoconfig @ConditionalOnBean checks). Also checked that this codebase targets Spring Security 6.x (jakarta.servlet namespace), so gating on SecurityFilterChain doesn't break anyone still on the deprecated WebSecurityConfigurerAdapter style — that API isn't even available in this version range. Both new tests (shouldRegisterSecureLogbookFilterWhenSecurityFilterChainIsPresent / shouldNotRegisterSecureLogbookFilterWithoutSecurityFilterChain) directly cover the regression being fixed. Docs/metadata updates accurately reflect the new gating behavior. No concerns
|
👍 |
|
@arimu1 the PR has conflicts now, could you resolve? |
Register secureLogbookFilter only when a SecurityFilterChain bean exists, not merely when spring-security-web is on the classpath. Document the two-filter precondition on logbook.secure-filter.enabled. Fixes zalando#2369
7cddcff to
1e24626
Compare
|
|
@kasmarian Conflicts are resolved — rebased |
…Test Isolated WebApplicationContextRunner must register the wrapper bean that secureLogbookFilter requires after zalando#2345.
|
Post-#2345, |
|
@arimu1 ☝️ |
markdown-toc rewrites the TOC block to LF. The update-toc job then tries to commit that result and fails because the PR branch is not on zalando/logbook. Commit the generated bytes so the check is a no-op.
|
Summary
@ConditionalOnBean(SecurityFilterChain.class)to thesecureLogbookFilterbean registration so the filter is not auto-enabled whenspring-security-webis only present transitively on the classpath without an actual security filter chain.logbook.secure-filter.enabledin configuration metadata and the README (apps that produce 401/403 in the dispatcher must set the property tofalse).SecurityFilterTestto useWebApplicationContextRunner, covering both the presence and absence of aSecurityFilterChainbean.Fixes #2369
Test plan
./mvnw testinlogbook-spring-boot-autoconfigure(99 tests, all passing)SecurityFilterTestverifiessecureLogbookFilteris registered when aSecurityFilterChainbean existsSecurityFilterTestverifiessecureLogbookFilteris not registered without aSecurityFilterChainbean