Skip to content

Fix #26577: Add authorization to App operational endpoints - #26590

Merged
ulixius9 merged 9 commits into
mainfrom
issue-26577
Mar 23, 2026
Merged

ulixius9 merged 9 commits into
mainfrom
issue-26577

Conversation

@ulixius9

@ulixius9 ulixius9 commented Mar 18, 2026 •

Copy link
Copy Markdown
Member

Fix #26577: Add authorization to App operational endpoints

Summary

  • Added authorizer.authorize() checks to 5 unprotected AppResource endpoints: trigger, stop, deploy, schedule, and configure
  • trigger and stop require MetadataOperation.TRIGGER permission
  • deploy requires MetadataOperation.DEPLOY permission
  • schedule and configure require MetadataOperation.EDIT_ALL permission
  • Added integration tests (AppOperationPermissionsIT) verifying unauthenticated requests return 401 and unauthorized users are denied access

Test plan

  • AppOperationPermissionsIT — 11 tests covering all 5 endpoints (401 for no auth, 403/404 for data consumer, 200 for admin)
  • Verify via UI that admin users can still trigger/deploy/stop apps
  • Verify via UI that users without the Trigger/Deploy/EditAll permission on app are denied

🤖 Generated with Claude Code

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Mar 18, 2026
@@ -1049,6 +1049,9 @@ public Response scheduleApplication(
@Context SecurityContext securityContext) {
App app =

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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

@github-actions

github-actions Bot commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (18 flaky)

✅ 3415 passed · ❌ 0 failed · 🟡 18 flaky · ⏭️ 183 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 451 0 4 2
🟡 Shard 2 304 0 1 1
🟡 Shard 3 676 0 5 33
🟡 Shard 4 701 0 5 41
🟡 Shard 5 671 0 1 73
🟡 Shard 6 612 0 2 33
🟡 18 flaky test(s) (passed on retry)
  • Flow/Tour.spec.ts › Tour should work from help section (shard 1, 1 retry)
  • Flow/Tour.spec.ts › Tour should work from welcome screen (shard 1, 1 retry)
  • Flow/Tour.spec.ts › Tour should work from URL directly (shard 1, 1 retry)
  • Pages/AuditLogs.spec.ts › should apply both User and EntityType filters simultaneously (shard 1, 1 retry)
  • Features/ColumnBulkOperations.spec.ts › should select column, open drawer, and verify form fields (shard 2, 1 retry)
  • Features/DataQuality/TestCaseIncidentPermissions.spec.ts › User with TEST_CASE.EDIT_ALL can see edit icon on incidents (shard 3, 1 retry)
  • Features/DataQuality/TestCaseResultPermissions.spec.ts › User with only VIEW cannot PATCH results (shard 3, 1 retry)
  • Features/ImpactAnalysis.spec.ts › Verify column level upstream connections (shard 3, 1 retry)
  • Features/Permissions/GlossaryPermissions.spec.ts › Team-based permissions work correctly (shard 3, 1 retry)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 1 retry)
  • Flow/PersonaFlow.spec.ts › Set default persona for team should work properly (shard 4, 1 retry)
  • Pages/Customproperties-part2.spec.ts › entityReferenceList shows item count, scrollable list, no expand toggle (shard 4, 1 retry)
  • Pages/DataProductAndSubdomains.spec.ts › Add expert to data product via UI (shard 4, 1 retry)
  • Pages/Domains.spec.ts › Rename domain with assets (tables, topics, dashboards) preserves associations (shard 4, 1 retry)
  • Pages/Domains.spec.ts › Multiple consecutive domain renames preserve all associations (shard 4, 1 retry)
  • Pages/EntityDataSteward.spec.ts › Glossary Term Add, Update and Remove (shard 5, 1 retry)
  • Pages/Lineage.spec.ts › Lineage creation from Metric entity (shard 6, 1 retry)
  • Pages/Users.spec.ts › Permissions for table details page for Data Consumer (shard 6, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

Copilot AI review requested due to automatic review settings March 20, 2026 06:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 enforce authorizer.authorize() on 5 operational endpoints.
  • Apply operation mappings: TRIGGER (trigger/stop), DEPLOY (deploy), EDIT_ALL (schedule/configure).
  • Add AppOperationPermissionsIT integration 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.

Comment on lines +62 to +70
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());
}

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@Rohit0301
Rohit0301 requested a review from a team as a code owner March 20, 2026 09:41
Copilot AI review requested due to automatic review settings March 23, 2026 05:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

@gitar-bot

gitar-bot Bot commented Mar 23, 2026 •

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 1 resolved / 2 findings

Adds 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 (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);
✅ 1 resolved
✅ Quality: Duplicate 'Deny permissions' test.describe block names

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/Permissions/ServiceEntityPermissions.spec.ts:167 📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/Permissions/ServiceEntityPermissions.spec.ts:191
The new test.describe('Deny permissions', ...) block at line 167 (for testing denied Trigger permission) has the same name as the pre-existing test.describe('Deny permissions', ...) block at line 191 (for testing denied common operations). While Playwright allows duplicate describe names, this makes test reports confusing—both blocks will appear as 'Deny permissions' and it becomes unclear which one failed.

Consider renaming the new block to distinguish it, e.g., 'Deny Trigger permissions'.

🤖 Prompt for agents
Code Review: Adds 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.

1. 💡 Security: Entity fetched before authorization leaks app existence
   Files: 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 (`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);

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@ulixius9
ulixius9 merged commit 919ac4c into main Mar 23, 2026
57 checks passed
@ulixius9
ulixius9 deleted the issue-26577 branch March 23, 2026 13:45
ulixius9 added a commit that referenced this pull request Mar 23, 2026
* 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>

This branch was previously deployed

1 inactive deployment
test — 71537383 Deployed Mar 23, 2026 by Rohit0301 via playwright-ci-postgresql (2, 6) #38265
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restrict Trigger Autopilot action based on permissions

6 participants