test: pin /api/me contract and AuthorityInterceptor authority-source behavior#24497
Merged
Conversation
netroms
marked this pull request as draft
July 19, 2026 02:21
This was referenced Jul 19, 2026
…behavior Characterization tests protecting the security refactoring work: - AuthorityInterceptorTest (new): pins that @RequiresAuthority reads authorities from Authentication.getAuthorities() (the token), never from the principal. Impersonation exit depends on this via SwitchUserGrantedAuthority. Also pins the ALL bypass, method-over-class annotation precedence, and the exact 403 message format. - MeControllerTest: pins the /api/me response shape (username vs display name, exact authorities set, authorization endpoint semantics incl. superuser bypass, impersonation fields absent by default). - ImpersonateUserControllerTest: pins that /api/me 'impersonation' is the impersonator USERNAME (not display name) during impersonation, and the canImpersonate visibility rules. These pins document current behavior; changing any of them must be a deliberate, reviewed decision. AI Assisted
netroms
force-pushed
the
test/auth-fast-layer-pins
branch
from
July 19, 2026 12:20
dfb6a22 to
b6d003b
Compare
netroms
marked this pull request as ready for review
July 20, 2026 11:22
jbee
approved these changes
Jul 20, 2026
|
david-mackessy
approved these changes
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Characterization tests that pin current security behavior.
AuthorityInterceptorTest(new, unit): pins that@RequiresAuthorityreads authorities fromAuthentication.getAuthorities()(the token), never from the principal. Impersonation exit depends on this viaSwitchUserGrantedAuthority. Also pins the implicitALLbypass, method-over-class annotation precedence, and the exact 403 message format.MeControllerTest(+4): pins the/api/meresponse shape —usernamevs displayname, exactauthoritiesset,/me/authorization/{auth}semantics incl. superuser bypass, impersonation fields absent by default.ImpersonateUserControllerTest(+3): pins that/api/meimpersonationcarries the impersonator username (not display name) while impersonating, pluscanImpersonatevisibility rules.These pins document current behavior; changing any of them should be a deliberate, reviewed decision.
Testing
All three classes run locally: 43/43 green (12 + 32 + 11).
AI Assisted