Repository navigation
Fix #26577: Add authorization to App operational endpoints - #26590
Conversation
| @@ -1049,6 +1049,9 @@ public Response scheduleApplication( | |||
| @Context SecurityContext securityContext) { | |||
| App app = | |||
There was a problem hiding this comment.
💡 Security: Entity fetched before authorization leaks app existence
In all 5 newly protected endpoints (trigger, stop, deploy, schedule, configure), repository.getByName() is called before authorizer.authorize(). This allows an unauthorized caller to distinguish between "app exists" (403) and "app doesn't exist" (404), enabling entity-existence enumeration.
This is a pre-existing pattern in AppResource (most older endpoints do the same), so it's consistent with the codebase. Notably, deleteAppAsync (line 1344-1346) already does it in the correct order (authorize first, then fetch). Flagging as minor since it matches the existing convention, but worth noting for a future hardening pass.
Suggested fix:
// Move authorizer.authorize() before the entity fetch:
OperationContext operationContext =
new OperationContext(entityType, MetadataOperation.TRIGGER);
authorizer.authorize(securityContext, operationContext, getResourceContextByName(name));
App app =
repository.getByName(uriInfo, name, fields);
Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion
🟡 Playwright Results — all passed (18 flaky)✅ 3415 passed · ❌ 0 failed · 🟡 18 flaky · ⏭️ 183 skipped
🟡 18 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
There was a problem hiding this comment.
Pull request overview
This PR tightens backend access control for App operational endpoints in AppResource by adding explicit authorization checks for trigger/stop/deploy/schedule/configure actions, and introduces an integration test suite to validate unauthenticated/unauthorized behavior.
Changes:
- Register App-specific operations (
TRIGGER,DEPLOY) and enforceauthorizer.authorize()on 5 operational endpoints. - Apply operation mappings:
TRIGGER(trigger/stop),DEPLOY(deploy),EDIT_ALL(schedule/configure). - Add
AppOperationPermissionsITintegration tests covering 401 (no auth) and 403/404 (unauthorized role) scenarios.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppResource.java | Adds entity-specific operations and authorization checks to previously unprotected operational endpoints. |
| openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/AppOperationPermissionsIT.java | Adds integration tests validating access is denied for unauthenticated/unauthorized requests on app operational endpoints. |
| void test_triggerApp_admin_allowed(TestNamespace ns) throws Exception { | ||
| HttpResponse<String> response = | ||
| postWithToken("/v1/apps/trigger/" + APP_NAME, "{}", SdkClients.getAdminToken()); | ||
|
|
||
| assertTrue( | ||
| response.statusCode() == 200 || response.statusCode() == 409, | ||
| "Admin should be able to trigger app (200) or app already running (409), got: " | ||
| + response.statusCode()); | ||
| } |
There was a problem hiding this comment.
test_triggerApp_admin_allowed may be flaky/fail in environments where app triggering is not supported with the K8s pipeline backend. Other tests guard this with assumeFalse(TestSuiteBootstrap.isK8sEnabled(), ...); consider adding the same assumption here (or otherwise handling the K8s case) to keep CI stable.
Code Review 👍 Approved with suggestions 1 resolved / 2 findingsAdds authorization to 5 App operational endpoints (trigger, stop, deploy, schedule, configure), addressing the duplicate test block names from earlier reviews. Consider reviewing the entity fetch order to prevent app existence information leaks before authorization checks. 💡 Security: Entity fetched before authorization leaks app existence📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppResource.java:1050 📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppResource.java:1092 📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppResource.java:1132 📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppResource.java:1184 📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppResource.java:1229 📄 openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/AppOperationPermissionsIT.java:56 📄 openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/AppOperationPermissionsIT.java:91 📄 openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/AppOperationPermissionsIT.java:115 📄 openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/AppOperationPermissionsIT.java:139 📄 openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/AppOperationPermissionsIT.java:163 In all 5 newly protected endpoints ( This is a pre-existing pattern in AppResource (most older endpoints do the same), so it's consistent with the codebase. Notably, Suggested fix✅ 1 resolved✅ Quality: Duplicate 'Deny permissions' test.describe block names
🤖 Prompt for agentsOptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
|
|
* Fix #26577: Restrict Trigger Autopilot action based on permissions * add app permission for trigger and deploy * Showing the Trigger autopilot button on App.trigger permission * fix tests * addressed gitar comments * Addressed PR comments * removed test.slow --------- Co-authored-by: Rohit0301 <rj03012002@gmail.com> Co-authored-by: Rohit Jain <60229265+Rohit0301@users.noreply.github.com> Co-authored-by: Suman Maharana <sumanmaharana786@gmail.com>



Fix #26577: Add authorization to App operational endpoints
Summary
authorizer.authorize()checks to 5 unprotectedAppResourceendpoints:trigger,stop,deploy,schedule, andconfiguretriggerandstoprequireMetadataOperation.TRIGGERpermissiondeployrequiresMetadataOperation.DEPLOYpermissionscheduleandconfigurerequireMetadataOperation.EDIT_ALLpermissionAppOperationPermissionsIT) verifying unauthenticated requests return 401 and unauthorized users are denied accessTest plan
AppOperationPermissionsIT— 11 tests covering all 5 endpoints (401 for no auth, 403/404 for data consumer, 200 for admin)Trigger/Deploy/EditAllpermission onappare denied🤖 Generated with Claude Code