fix: enforce @RolesAllowed on microservice resources#5049
Open
Ma77Ball wants to merge 13 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5049 +/- ##
============================================
- Coverage 43.06% 42.95% -0.12%
- Complexity 2211 2218 +7
============================================
Files 1045 1045
Lines 40216 40143 -73
Branches 4243 4244 +1
============================================
- Hits 17321 17243 -78
+ Misses 21829 21826 -3
- Partials 1066 1074 +8
*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 @Yicong-Huang |
… fix/RolesAllowedUnenforced
Contributor
Author
|
@Yicong-Huang please review |
… fix/RolesAllowedUnenforced
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?
@RolesAllowedannotations onconfig-service,computing-unit-managing-service, andworkflow-compiling-serviceresources were decorative because none of these services registered Jersey'sRolesAllowedDynamicFeature. This PR registers that feature in each service'srun(...). Forworkflow-compiling-service, which was not registering JWT auth at all, this PR also registersAuthDynamicFeature(JwtAuthFilter)and theSessionUserAuthValueFactoryProvider.Binder, and addsAuthas an sbt dependency for the module.access-control-serviceandfile-serviceuse no@RolesAllowedtoday and were intentionally left alone to keep the change minimal.Any related issues, documentation, or discussions?
Closes: #4904
How was this PR tested?
Added
ConfigServiceRunSpec(mirrorsAccessControlServiceRunSpec) that mocks the Jersey environment and verifiesRolesAllowedDynamicFeatureis registered whenConfigService.runruns. The same one-line registration applies to the other two services; tests there would require either refactoringSqlServer.initConnectionout ofrunor static-mocking the ScalaSqlServerobject, both of which are larger than the fix itself, so they are out of scope. Manual verification via the reproduction in the issue (low-role JWT against an annotated endpoint should now return 403; unauthenticated request toWorkflowCompilationResourceshould now return 401).Was this PR authored or co-authored using generative AI tooling?
Co-authored with Claude Opus 4.7 in compliance with ASF