Repository navigation
fix(auth): enforce @RolesAllowed in file-service by registering RolesAllowedDynamicFeature - #5198
Merged
Merged
Conversation
… fix/RolesAllowedUnenforced
… fix/RolesAllowedUnenforced
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5198 +/- ##
=========================================
Coverage 52.32% 52.32%
- Complexity 2484 2485 +1
=========================================
Files 1068 1068
Lines 41353 41357 +4
Branches 4441 4441
=========================================
+ Hits 21639 21642 +3
- Misses 18444 18445 +1
Partials 1270 1270
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…olesAllowedDynamicFeature
Yicong-Huang
reviewed
Jun 7, 2026
Yicong-Huang
approved these changes
Jun 7, 2026
Contributor
|
I suggest we backport this as well cc @xuang7 |
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jun 7, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jun 7, 2026
Yicong-Huang
enabled auto-merge
June 7, 2026 19:38
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jun 7, 2026
Contributor
Author
|
@Yicong-Huang / @xuang7 I fixed the CI issue. Please add to the merge queue when available. |
Yicong-Huang
added a commit
that referenced
this pull request
Jun 9, 2026
…AllowedDynamicFeature (#5198) ### What changes were proposed in this PR? Registers Jersey's `RolesAllowedDynamicFeature` in `file-service`'s Jersey environment so the `@RolesAllowed` / `@PermitAll` annotations already present on `DatasetResource` are actually enforced. `file-service` registered `JwtAuthFilter` (authentication) and the `AuthValueFactoryProvider.Binder` (so `@Auth user` injects), but never `RolesAllowedDynamicFeature` (authorization). The ~20 `@RolesAllowed(Array("REGULAR", "ADMIN"))` annotations on `DatasetResource` were therefore decorative: any valid JWT reached the resource method regardless of role. This adds the one missing registration. ```scala // Enforce @RolesAllowed annotations on resource methods environment.jersey.register(classOf[RolesAllowedDynamicFeature]) ``` Once enforcement is live, the six public-dataset endpoints (`getPublicPresignedUrl`, `getPublicPresignedUrlWithS3`, `getPublicDatasetVersionList`, `retrievePublicDatasetVersionRootFileNodes`, `getPublicDataset`, `getDatasetCover`) must stay reachable without a JWT for anonymous hub visitors. They are already `@PermitAll` on `main`; the new spec pins that so a future refactor cannot silently lock them out. ### Scope note This PR was originally "complete @RolesAllowed enforcement across microservices." Since then the rest of that work has landed or is in flight on `main`, so this PR has been narrowed to the one remaining gap: - `config-service`, `computing-unit-managing-service`, `workflow-compiling-service`: done in #5049 / #5199. - `JwtAuthFilter` priority + eager-401 + `@PermitAll` opt-out: done in #5404. - `access-control-service` (LiteLLM proxy hardening + feature registration): handled by #5421 (@Yicong-Huang). - **`file-service`: this PR.** With this and #5421, every microservice that uses `@RolesAllowed` enforces it, closing out #4904. ### Any related issues, documentation, or discussions? Closes #5433. Follow-up to #4904; companion to #5421. ### How was this PR tested? Added `DatasetResourcePermissionsSpec`, which verifies the six public-dataset endpoints carry `@PermitAll` so they remain anonymous-accessible after enforcement is enabled. `file-service` and the auth modules compile clean. Existing `DatasetResource` `@RolesAllowed` annotations are unchanged. ### Was this PR authored or co-authored using generative AI tooling? Co-authored with Claude Opus 4.8 in compliance with ASF Generative Tooling Guidance. --------- (backported from commit 7b7a5c6) Co-authored-by: Yicong Huang <[email protected]>
Contributor
|
Backport to |
ELin2025
pushed a commit
to ELin2025/texera
that referenced
this pull request
Jun 16, 2026
…AllowedDynamicFeature (apache#5198) ### What changes were proposed in this PR? Registers Jersey's `RolesAllowedDynamicFeature` in `file-service`'s Jersey environment so the `@RolesAllowed` / `@PermitAll` annotations already present on `DatasetResource` are actually enforced. `file-service` registered `JwtAuthFilter` (authentication) and the `AuthValueFactoryProvider.Binder` (so `@Auth user` injects), but never `RolesAllowedDynamicFeature` (authorization). The ~20 `@RolesAllowed(Array("REGULAR", "ADMIN"))` annotations on `DatasetResource` were therefore decorative: any valid JWT reached the resource method regardless of role. This adds the one missing registration. ```scala // Enforce @RolesAllowed annotations on resource methods environment.jersey.register(classOf[RolesAllowedDynamicFeature]) ``` Once enforcement is live, the six public-dataset endpoints (`getPublicPresignedUrl`, `getPublicPresignedUrlWithS3`, `getPublicDatasetVersionList`, `retrievePublicDatasetVersionRootFileNodes`, `getPublicDataset`, `getDatasetCover`) must stay reachable without a JWT for anonymous hub visitors. They are already `@PermitAll` on `main`; the new spec pins that so a future refactor cannot silently lock them out. ### Scope note This PR was originally "complete @RolesAllowed enforcement across microservices." Since then the rest of that work has landed or is in flight on `main`, so this PR has been narrowed to the one remaining gap: - `config-service`, `computing-unit-managing-service`, `workflow-compiling-service`: done in apache#5049 / apache#5199. - `JwtAuthFilter` priority + eager-401 + `@PermitAll` opt-out: done in apache#5404. - `access-control-service` (LiteLLM proxy hardening + feature registration): handled by apache#5421 (@Yicong-Huang). - **`file-service`: this PR.** With this and apache#5421, every microservice that uses `@RolesAllowed` enforces it, closing out apache#4904. ### Any related issues, documentation, or discussions? Closes apache#5433. Follow-up to apache#4904; companion to apache#5421. ### How was this PR tested? Added `DatasetResourcePermissionsSpec`, which verifies the six public-dataset endpoints carry `@PermitAll` so they remain anonymous-accessible after enforcement is enabled. `file-service` and the auth modules compile clean. Existing `DatasetResource` `@RolesAllowed` annotations are unchanged. ### Was this PR authored or co-authored using generative AI tooling? Co-authored with Claude Opus 4.8 in compliance with ASF Generative Tooling Guidance. --------- Co-authored-by: Yicong Huang <[email protected]>
yangzhang75
pushed a commit
to yangzhang75/texera
that referenced
this pull request
Jun 22, 2026
…AllowedDynamicFeature (apache#5198) ### What changes were proposed in this PR? Registers Jersey's `RolesAllowedDynamicFeature` in `file-service`'s Jersey environment so the `@RolesAllowed` / `@PermitAll` annotations already present on `DatasetResource` are actually enforced. `file-service` registered `JwtAuthFilter` (authentication) and the `AuthValueFactoryProvider.Binder` (so `@Auth user` injects), but never `RolesAllowedDynamicFeature` (authorization). The ~20 `@RolesAllowed(Array("REGULAR", "ADMIN"))` annotations on `DatasetResource` were therefore decorative: any valid JWT reached the resource method regardless of role. This adds the one missing registration. ```scala // Enforce @RolesAllowed annotations on resource methods environment.jersey.register(classOf[RolesAllowedDynamicFeature]) ``` Once enforcement is live, the six public-dataset endpoints (`getPublicPresignedUrl`, `getPublicPresignedUrlWithS3`, `getPublicDatasetVersionList`, `retrievePublicDatasetVersionRootFileNodes`, `getPublicDataset`, `getDatasetCover`) must stay reachable without a JWT for anonymous hub visitors. They are already `@PermitAll` on `main`; the new spec pins that so a future refactor cannot silently lock them out. ### Scope note This PR was originally "complete @RolesAllowed enforcement across microservices." Since then the rest of that work has landed or is in flight on `main`, so this PR has been narrowed to the one remaining gap: - `config-service`, `computing-unit-managing-service`, `workflow-compiling-service`: done in apache#5049 / apache#5199. - `JwtAuthFilter` priority + eager-401 + `@PermitAll` opt-out: done in apache#5404. - `access-control-service` (LiteLLM proxy hardening + feature registration): handled by apache#5421 (@Yicong-Huang). - **`file-service`: this PR.** With this and apache#5421, every microservice that uses `@RolesAllowed` enforces it, closing out apache#4904. ### Any related issues, documentation, or discussions? Closes apache#5433. Follow-up to apache#4904; companion to apache#5421. ### How was this PR tested? Added `DatasetResourcePermissionsSpec`, which verifies the six public-dataset endpoints carry `@PermitAll` so they remain anonymous-accessible after enforcement is enabled. `file-service` and the auth modules compile clean. Existing `DatasetResource` `@RolesAllowed` annotations are unchanged. ### Was this PR authored or co-authored using generative AI tooling? Co-authored with Claude Opus 4.8 in compliance with ASF Generative Tooling Guidance. --------- Co-authored-by: Yicong Huang <[email protected]>
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?
Registers Jersey's
RolesAllowedDynamicFeatureinfile-service's Jersey environment so the@RolesAllowed/@PermitAllannotations already present onDatasetResourceare actually enforced.file-serviceregisteredJwtAuthFilter(authentication) and theAuthValueFactoryProvider.Binder(so@Auth userinjects), but neverRolesAllowedDynamicFeature(authorization). The ~20@RolesAllowed(Array("REGULAR", "ADMIN"))annotations onDatasetResourcewere therefore decorative: any valid JWT reached the resource method regardless of role. This adds the one missing registration.Once enforcement is live, the six public-dataset endpoints (
getPublicPresignedUrl,getPublicPresignedUrlWithS3,getPublicDatasetVersionList,retrievePublicDatasetVersionRootFileNodes,getPublicDataset,getDatasetCover) must stay reachable without a JWT for anonymous hub visitors. They are already@PermitAllonmain; the new spec pins that so a future refactor cannot silently lock them out.Scope note
This PR was originally "complete @RolesAllowed enforcement across microservices." Since then the rest of that work has landed or is in flight on
main, so this PR has been narrowed to the one remaining gap:config-service,computing-unit-managing-service,workflow-compiling-service: done in fix: enforce @RolesAllowed on microservice resources #5049 / fix: enforce @RolesAllowed on microservice resources #5199.JwtAuthFilterpriority + eager-401 +@PermitAllopt-out: done in fix(auth): make JwtAuthFilter eager-401 with @PermitAll opt-out #5404.access-control-service(LiteLLM proxy hardening + feature registration): handled by fix(auth): require REGULAR/ADMIN role on LiteLLM proxy endpoints #5421 (@Yicong-Huang).file-service: this PR.With this and #5421, every microservice that uses
@RolesAllowedenforces it, closing out #4904.Any related issues, documentation, or discussions?
Closes #5433. Follow-up to #4904; companion to #5421.
How was this PR tested?
Added
DatasetResourcePermissionsSpec, which verifies the six public-dataset endpoints carry@PermitAllso they remain anonymous-accessible after enforcement is enabled.file-serviceand the auth modules compile clean. ExistingDatasetResource@RolesAllowedannotations are unchanged.Was this PR authored or co-authored using generative AI tooling?
Co-authored with Claude Opus 4.8 in compliance with ASF Generative Tooling Guidance.