test(ledger): assert full scope matrix per endpoint - #139
Merged
Conversation
Upgrade ScopeAuthorizationMatrixIT to assert, per ledger endpoint, that the matching scope grants a genuine 2xx, the opposite scope returns 403, and a request with no token returns 401. Seed real accounts and a dedicated reversal target so the correct-scope path executes against existing state instead of a not-forbidden proxy. The single data-driven table is the only extension point for new endpoints. Closes #60
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.
What
Upgrades
ScopeAuthorizationMatrixITto a full per-endpoint authorization contract: for every ledger endpoint it asserts the matching scope grants a genuine 2xx, the opposite scope returns 403, and a request with no token returns 401.Why
The prior matrix only checked wrong-scope 403 and a weak
!= 403/401proxy against unseeded ids, so it could never observe a real 2xx and had no no-token case. This guards against authorization regressions when endpoints are added.How
@BeforeEachseeds two accounts, a read-target transaction, and a dedicated POSTED reversal target via the application services, so the correct-scope path executes against real state.alg=noneJwtDecoder maps the bearer value to the scope claim, exercising the realSecurityConfigmatchers without a live Keycloak.@AfterEach; hikari pool capped at 2; UUID correlation id on every request.Test-only slice, no production code changed. integrationTest runs on CI (no Docker in the dev WSL).
Closes #60