fix: complete @RolesAllowed enforcement across microservices#5198
Open
Ma77Ball wants to merge 27 commits into
Open
fix: complete @RolesAllowed enforcement across microservices#5198Ma77Ball wants to merge 27 commits into
Ma77Ball wants to merge 27 commits into
Conversation
… fix/RolesAllowedUnenforced
… fix/RolesAllowedUnenforced
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5198 +/- ##
============================================
- Coverage 47.13% 45.80% -1.34%
+ Complexity 2344 2342 -2
============================================
Files 1042 1046 +4
Lines 39989 40030 +41
Branches 4260 4258 -2
============================================
- Hits 18849 18335 -514
- Misses 20015 20584 +569
+ Partials 1125 1111 -14
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
/request-review @aglinxinyuan @Yicong-Huang |
Contributor
Author
|
@carloea2 please also review and test if available |
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 changes were proposed in this PR?
Finishes wiring JAX-RS role enforcement across every Texera microservice. Each service's Jersey environment now registers the standard three-feature stack:
AuthDynamicFeature(JwtAuthFilter)- authentication (reads the JWT, attaches aSessionUser).AuthValueFactoryProvider.Binder(SessionUser)- injects@Auth userinto resource methods.RolesAllowedDynamicFeature- authorization (enforces@RolesAllowed/@PermitAll/@DenyAll).#5049 added this trio to three services; this PR extends it to
file-serviceandaccess-control-service, fixes the filter priority on the sharedJwtAuthFilterso authentication runs before authorization, and tags every endpoint with the right policy.What this PR adds, and where
common/auth/JwtAuthFilter-@Priority(Priorities.AUTHENTICATION)so it runs beforeRolesAllowedRequestFilter. Addedjakarta.annotation-apidependency.FileService.runandAccessControlService.run- registerRolesAllowedDynamicFeature; the existing@RolesAllowedannotations in those services become live.@PermitAllon endpoints that must serve unauthenticated traffic:ConfigResourcebootstrap endpoints, the six public-dataset endpoints onDatasetResource, andAccessControlResource(the Envoy ExtAuth callback).@RolesAllowed("REGULAR","ADMIN")on the LiteLLM copilot proxies.AuthResource.register- new local signups now default toREGULARinstead ofRESTRICTED, so registered users can immediately use role-gated endpoints.FileService.runreorder - Jersey registration moved before infra init, mirroringConfigService.runand making the registrations unit-testable.Implementation details
HealthCheckResources stay public for k8s probes).getDatasetCoveris@PermitAllbecause it accepts optional auth; the method body re-checks access.Tests added
JwtAuthFilterSpec,ConfigResourceSpec,AccessControlResourcePermissionsSpec,DatasetResourcePermissionsSpec,FileServiceRunSpec, plus an added assertion inAccessControlServiceRunSpec. Together, they pin the priority annotation, the public/private policy to every changed endpoint, and the registration ofRolesAllowedDynamicFeaturein the two newly enforced services.Any related issues, documentation, or discussions?
Closes: #4904
Fixes issue found and addressed in: #5173 and #5049
How was this PR tested?
Added six specs covering the filter priority, the
@PermitAll/@RolesAllowedtags on each affected resource, andRolesAllowedDynamicFeatureregistration in both newly-enforced services.Manually verified end-to-end
Was this PR authored or co-authored using generative AI tooling?
Co-authored with Claude Opus 4.7 in compliance with ASF Generative Tooling Guidance.