Skip to content

fix: use service Trigger for manual AutoPilot runs - #36356

Merged
IceS2 merged 9 commits into
mainfrom
fix/autopilot-target-permissions
Nov 11, 2026
Merged

IceS2 merged 9 commits into
mainfrom
fix/autopilot-target-permissions

Conversation

@IceS2

@IceS2 IceS2 commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes

Manual AutoPilot runs require Trigger on both the application and the effective target service. Service permission descriptors expose Trigger, and the service-page button checks both permissions. Inactive runs remain no-ops; changing application configuration still requires application EditAll.

Type of change

  • Bug fix

High-level design

Native applications declare runtime parameters and prepare a validated run with its authorization requests. AutoPilot subclasses inherit that preparation, and direct triggers share its validation. Service Trigger covers AutoPilot agent creation, deployment, and execution; service EditAll does not substitute for it.

Compatibility

The default Data Steward policy grants Trigger on all resources, so it permits AutoPilot across services. Custom roles need application Trigger and target-service Trigger when ownership does not provide it. After service creation, the UI requests a manual run as the creator; ownership supplies the service permission under the default organization policy, while application Trigger is still required. The decision record documents the final permission contract.

Validation

  • Refreshed from main 841dbc674f: Java reactor build, 21 focused Java unit tests, 73 API tests, and 180 UI tests passed. The API suites skipped 10 tests with no failures or errors.
  • The service Trigger change at 586f37bc56 previously passed 4024 integration tests across 44 selected classes; 522 tests were skipped.
  • Regression tests confirmed the prior UI condition and service-operation registration fail the new expectations before the change.
  • This follow-up passed all 8 API cases covering explicit service grants and ownership across existing/new agents and base/derived applications, and all 16 Chromium E2E cases covering app-only and app-and-service button visibility across eight service types.
  • Java formatting and test compilation, full Playwright lint (zero errors; existing warnings), Playwright TypeScript checking, decision-record validation, and whitespace checks passed.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Oct 27, 2026
@IceS2
IceS2 marked this pull request as ready for review October 28, 2026 10:21
Copilot AI balanced review requested due to automatic review settings October 28, 2026 10:21
@IceS2
IceS2 requested a review from a team as a code owner October 28, 2026 10:21
@IceS2
IceS2 requested a review from TeddyCr October 28, 2026 10:21

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 has insufficient remaining quota.

@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

manerow
manerow previously approved these changes Oct 28, 2026
@manerow
manerow dismissed their stale review October 28, 2026 10:31

Withdrawing my approval for now.

Comment on lines +1654 to +1656
private void authorizeAutoPilotTarget(
SecurityContext securityContext, App app, Map<String, Object> configPayload) {
if (AutoPilotApp.class.getName().equals(app.getClassName())) {

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.

AppResource serves every app, but this check is specific to AutoPilot: it compares app.getClassName() to AutoPilotApp.class.getName() and imports the concrete bundle class (line 80). Any other app that takes a target in its trigger payload would need its own className branch in this same method, so the generic resource keeps learning about individual apps.

The string comparison also only matches that exact class name. An app registered with a subclass of AutoPilotApp would skip this check without any error.

Suggestion: one option might be to let each app declare what a trigger needs. This could be a default method on NativeApplication, something like List<AuthRequest> getTriggerAuthRequests(Map<String, Object> payload), which returns an empty list by default. AutoPilotApp would override it to return the EditAll request on the resolved service. AppResource would then call authorizer.authorizeRequests(securityContext, requests, AuthorizationLogic.ALL) when the list isn't empty, before dispatching the run. That keeps the resource generic, keeps the AutoPilot knowledge in AutoPilot, and subclasses inherit the check. ApplicationHandler already instantiates the app for triggerApplicationOnDemand, so the same instance could answer both calls.

}
String triggeredBy = securityContext.getUserPrincipal().getName();
if (app.getAppType().equals(AppType.Internal)) {
authorizeAutoPilotTarget(securityContext, app, configPayload);

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.

PR #36156 (open) also adds payload-based authorization to triggerApplicationRun. It adds overridesConfiguredValue(...) and hardcodes RUNTIME_TRIGGER_PARAMETERS = Set.of("entityLink") in this resource, so AutoPilot's entityLink doesn't require app EditAll.

The two rules agree with each other. But together they make two separate mechanisms in the same method, each with its own built-in knowledge of AutoPilot: one keyed on the class name, one on a payload key list. Whichever PR merges second will conflict here.

Suggestion: it might be worth agreeing with Mohit on one mechanism before either PR merges. The app-level hook from the comment above could also carry the runtime parameter list, for example Set<String> getRuntimeTriggerParameters() on NativeApplication. Then neither PR needs to hardcode AutoPilot in AppResource, and the second PR to merge only adds its piece to the hook.

Comment on lines +1660 to +1672
if (runtimeConfig.getActive() == null) {
throw new BadRequestException("AutoPilot active must be a boolean");
}
if (!runtimeConfig.getActive()) {
return;
}
if (nullOrEmpty(runtimeConfig.getEntityLink())) {
throw new BadRequestException("AutoPilot requires a service entity link");
}
EntityLink entityLink = EntityLink.parse(runtimeConfig.getEntityLink());
if (!Entity.getServiceEntityTypes().contains(entityLink.getEntityType())) {
throw new BadRequestException("AutoPilot requires a service entity link");
}

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.

The AutoPilot payload rules are checked here in the resource: active must not be null, an active run needs a link, and the link must point to a service. AutoPilotApp.triggerOnDemand (lines 71-76) still accepts active: true with a null or non-service entityLink, and the event-based path calls it directly. So the rules for a valid AutoPilot run now live in two places, and only the REST path enforces them.

The runtime config is also converted to AutoPilotAppConfig twice per request, once here and once in triggerOnDemand.

Suggestion: these rules could live in AutoPilotApp, for example a static method that takes the merged config and returns the validated service EntityLink, or an empty result when the run is inactive. The resource (or the hook above) and triggerOnDemand would both call it, so there would be one definition of a valid run and one conversion. The automatic run on service creation also calls triggerOnDemand, so it would be worth checking that it always sends a service link before it shares the stricter rules.

Comment on lines +33 to +35
Callers who can trigger the application must also be allowed to manage the selected service for
active runs. Clients should distinguish application permission from target-service permission;
showing the trigger button based only on application permission can still lead to HTTP 403.

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.

The "Trigger AutoPilot" button on the service page (DataAssetsHeader.component.tsx) is still shown based on can(Operation.Trigger), read from the service's permissions. This PR makes the backend require app Trigger plus service EditAll. A user who has Trigger on a service but not EditAll will see the button and get a 403 on every click. The UI isn't changed in this PR.

Suggestion: the button could be shown only when both checks the backend makes pass:

  • canEditAll from the service's derived flags, which are already loaded in that component;
  • Trigger on the AutoPilot app, from useEntityPermissions(ResourceEntity.APPLICATION, AUTO_PILOT_APP_NAME).

Doing it in this PR, or in a follow-up that ships in the same release, would keep the UI and the backend in step.

@IceS2
IceS2 requested a review from a team as a code owner November 5, 2026 09:49
@IceS2
IceS2 requested review from shrabantipaul-collate and a balanced review from Copilot November 5, 2026 09:49

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 has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 43 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 43 warning(s) across 1 changed file(s).

Count Rule
42 react-hooks/exhaustive-deps
1 openmetadata-imports/review-sequential-api-calls
All findings
Location Rule Message
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:379:8 react-hooks/exhaustive-deps React Hook useMemo has an unnecessary dependency: 'location.search'. Either exclude it or remove the dependency array. Outer scope values like 'location.search'
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:408:6 react-hooks/exhaustive-deps React Hook useMemo has an unnecessary dependency: 'serviceCategory'. Either exclude it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:436:5 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 'navigate'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:454:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'setFilters'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:478:6 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'getEntityPermissionByFqn'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:497:6 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'navigate'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:537:5 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'handlePageChange', 'navigate', and 'setFilters'. Either include them or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:565:40 openmetadata-imports/review-sequential-api-calls Review these sequential API requests. If they are independent, start them together with Promise.all/Promise.allSettled; keep sequencing only when data-dependent
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:649:5 react-hooks/exhaustive-deps React Hook useCallback has an unnecessary dependency: 'ingestionPaging'. Either exclude it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:764:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:778:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:797:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:838:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:852:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:868:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:884:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:898:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:913:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:935:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'handleFilesPagingChange'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:960:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'handleSpreadsheetsPagingChange'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1024:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1067:6 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'navigate' and 'setFilters'. Either include them or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1089:6 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'followers', 'serviceDetails', and 't'. Either include them or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1114:6 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'serviceDetails' and 't'. Either include them or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1286:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 't'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1399:6 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'navigate'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1456:6 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'handleShowDeleted' and 'showDeleted'. Either include them or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1466:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'navigate'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1493:6 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 't'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1500:5 react-hooks/exhaustive-deps React Hook useMemo has an unnecessary dependency: 'serviceCategory'. Either exclude it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1529:8 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1557:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'getOtherDetails'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1612:6 react-hooks/exhaustive-deps React Hook useEffect has missing dependencies: 'fetchDashboardsDataModel', 'fileSearchValue', and 'spreadSheetSearchValue'. Either include them or remove the de
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1677:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'fetchServiceDetails'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1683:6 react-hooks/exhaustive-deps React Hook useEffect has missing dependencies: 'fetchServicePermission' and 'isOpenMetadataService'. Either include them or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1697:6 react-hooks/exhaustive-deps React Hook useEffect has missing dependencies: 'currentIngestionPage', 'getAllIngestionWorkflows', 'ingestionPagingCursor?.pageSize', 'isOpenMetadataService', a
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1709:6 react-hooks/exhaustive-deps React Hook useEffect has missing dependencies: 'collateAgentPagingCursor?.pageSize' and 'fetchCollateAgentsList'. Either include them or remove the dependency a
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1713:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'fetchWorkflowInstanceStates'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1740:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'fetchCollateAgentsList'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1779:5 react-hooks/exhaustive-deps React Hook useMemo has an unnecessary dependency: 'ingestionPaging'. Either exclude it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1872:6 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:2055:6 react-hooks/exhaustive-deps React Hook useMemo has missing dependencies: 'pagingInfo', 'setFilters', and 't'. Either include them or remove the dependency array.
🟡 src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:2102:6 react-hooks/exhaustive-deps React Hook useCallback has an unnecessary dependency: 'serviceDetails.fullyQualifiedName'. Either exclude it or remove the dependency array.

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 81%
81.81% (142390/174041) 69.3% (52201/75320) 72.29% (29218/40415)

margin-top: 0;
margin-bottom: 0.5em;
color: var(--om-heading-color, rgba(0, 0, 0, 0.85));
color: var(--tw-text-color-primary);

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.

The merge commit 2f74ec7 changed this line, but main doesn't have this change. Main (#36373) has color: var(--om-heading-color, rgba(0, 0, 0, 0.85));. git show 2f74ec7 --cc on this file shows the merged result differs from both parents, so it looks like it came from resolving the merge.

This rule styles every h1 to h6 in the app. In light mode, headings change from rgba(0, 0, 0, 0.85) to the primary text token, and the fallback value is lost. Dark mode looks the same, because --om-heading-color already points to --color-text-primary there. #36373 kept the antd values on purpose, so that removing antd would not move any element.

Could you restore main's version of this file? It isn't related to the AutoPilot fix, and with a squash merge it would land under this PR's title.

@manerow

manerow commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Some regression notes, for information only. None of them block the PR, and I checked each one in the code.

  1. Data Stewards lose AutoPilot on services they don't own. The default DataStewardPolicy allows Trigger on all resources, but not EditAll. On main today they can run AutoPilot on any service, and the button shows for them. With this PR the button is hidden and a direct call returns 403. Owners keep access through the OrganizationPolicy owner rule. The decision record intends this, but it changes what a default role can do, so it may be worth a line in the release notes.

  2. The run after creating a service still works. AddServicePage and EmbeddedAddServicePage trigger AutoPilot right after the service is created, as the user who created it. getServiceConfigData makes that user the owner, so the owner rule gives them EditAll. It would only return 403 in an org that removed or narrowed that rule. I checked this in the code, not end to end.

  3. entityLink is now exempt only for AutoPilot. After fix(security): batch of backend security-hardening fixes #36156 it was exempt for every app. Now, sending entityLink to any other app needs app EditAll. In this repo only AutoPilot receives entityLink, from the three UI callers above. The Java SDK Apps.trigger sends no payload, no Python ingestion code calls this endpoint, and the governance RunApp node calls ApplicationHandler directly. I couldn't check API clients outside this repo.

  4. The app is now initialised before the configuration-override check. On main, the app EditAll check ran before the enabled check and before runAppInit. Now both run first. For a request without app EditAll that changes a configured value, there are two differences. A disabled app returns "not enabled" instead of 403. An app whose init throws returns that error instead of 403. Low impact.

Checked, and behaviour does not change:

  • Every service type the UI offers AutoPilot for is in Entity.getServiceEntityTypes(), so none of them start returning 400.
  • The stricter checks in AutoPilotApp.triggerOnDemand only matter for REST triggers. AutoPilot is NoSchedule, nothing on the server calls it, and Settings hides "Run now" for NoSchedule apps.

Copilot AI balanced review requested due to automatic review settings November 5, 2026 13:13

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 has insufficient remaining quota. Try requesting a review at a lower effort level.

@IceS2
IceS2 enabled auto-merge (squash) November 5, 2026 15:32
Comment on lines +555 to +556
const hasTriggerPermission =
flags.canEditAll && canAutoPilot(Operation.Trigger);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This will enforce editAll permission to trigger the run?

Copilot AI balanced review requested due to automatic review settings November 6, 2026 06:58

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 has insufficient remaining quota. Try requesting a review at a lower effort level.

@IceS2 IceS2 changed the title fix: require service edit permission for manual AutoPilot runs fix: use service Trigger for manual AutoPilot runs Nov 6, 2026
@sonarqubecloud

sonarqubecloud Bot commented Nov 6, 2026

Copy link
Copy Markdown

Copilot AI balanced review requested due to automatic review settings November 6, 2026 07:55

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 has insufficient remaining quota. Try requesting a review at a lower effort level.

Comment on lines +548 to +549
const hasTriggerPermission =
can(Operation.Trigger) && canAutoPilot(Operation.Trigger);

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.

ServiceEntityPermissions.spec.ts (lines 154-172) doesn't match this condition. The Allow Trigger permissions test grants Trigger on app only, then expects the AutoPilot button to be visible. With this change the button also needs Trigger on the service. That user doesn't have it: assignRoleToUser replaces their roles, and they don't own the service. So the button stays hidden and the test fails.

Playwright is skipped on this PR and runs in the merge queue, where the impact map selects this spec through DataAssetsHeader.component.tsx. The failure would first show up there and would most likely eject the PR from the queue. I found this by reading the code and haven't run the spec.

Suggestion: one option might be to grant Trigger on All in that test, which is the default for initializePermissions and covers every service type in the matrix. An extra case with Trigger on app only could then assert that the button is hidden, since that's the behaviour this PR changes.

Service resources expose `Trigger` through their permission descriptors. The service page shows
the AutoPilot button when both Trigger permissions are allowed. Application configuration
overrides still require application `EditAll`; an already-inactive run remains a no-op without
a target-service permission check. Automatic service-event workflows retain their existing path.

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.

AutoPilot doesn't seem to have an automatic service-event workflow to retain. The trigger in AutoPilotWorkflow.json is noOp. The run after creating a service is a REST call from AddServicePage and EmbeddedAddServicePage, made as the creator, so it goes through the manual-run check this ADR describes. As written, a reader could conclude that those runs skip the check.

Suggestion: this sentence might be replaced with one saying that the run after service creation is a normal manual run, and that the creator passes the service check as its owner.

- **Status:** Superseded by ADR:2026-11-06-manual-autopilot-runs-require-service-trigger
- **Revisions:** v1 2026-10-27 (initial) · v2 2026-11-05 (app-owned trigger preparation)
- **Deciders:** OpenMetadata maintainers
- **Guard:** `AppsResourceIT#test_autopilotTriggerRequiresEditAllOnEffectiveService`, `AppsResourceIT#test_autopilotInactiveDoesNotRequireTarget`, `AppsResourceIT#test_autopilotInvalidPayloadDoesNotStartWorkflow`

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.

This ADR is added and superseded in the same PR, so it records a rule that never reached main. Its Guard also names test_autopilotTriggerRequiresEditAllOnEffectiveService, which no longer exists. The test in this PR is now test_autopilotTriggerRequiresTriggerOnEffectiveService.

Suggestion: it might be simpler to drop this file, along with the Related line in the new ADR and the "supersedes" wording in the PR description. If the reasoning against EditAll is worth keeping, a sentence in the new ADR could cover it.


Roles can delegate AutoPilot execution separately from editing service information. The default
Data Steward policy grants `Trigger` on all resources, so it permits AutoPilot across services.
Owners retain access through the organization policy's `All` grant. Custom roles with only service

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.

No integration test covers this owner path. The callers in AppsResourceIT get their service access from a role rule (matchAnyServiceName), never from ownership.

The run after creating a service depends on this path: the UI makes the creator the owner, and the owner rule's All is what gives them service Trigger. If that stopped working, the service would still be created, but AutoPilot wouldn't start and the user would only see an error toast.

Suggestion: a case where the caller has only Trigger on the app and owns the target service could cover this, expecting the workflow to start.

Roles can delegate AutoPilot execution separately from editing service information. The default
Data Steward policy grants `Trigger` on all resources, so it permits AutoPilot across services.
Owners retain access through the organization policy's `All` grant. Custom roles with only service
`EditAll` need an additional `Trigger` grant. Existing ingestion-pipeline runs continue to check

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.

This affects any custom role with Trigger on the app and none on the service, not only roles with service EditAll. On main, those roles can run AutoPilot on any service. After this PR, on services they don't own, the button disappears and a direct call returns 403. There's no migration that adds the grant, so admins would only find out after upgrading.

Suggestion: it might be worth a release note telling admins to add Trigger on the service resources to any role that should keep running AutoPilot.

for `Trigger`, and is not required to run AutoPilot.

Service resources expose `Trigger` through their permission descriptors. The service page shows
the AutoPilot button when both Trigger permissions are allowed. Application configuration

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.

This covers the service page, but Collate's AI mode connection page has two more AutoPilot buttons with no permission check: the header action and the one in the Agents tab. They show for every user.

That gap already exists, but this PR makes it easier to hit. A user with Trigger on the app and none on the service can run AutoPilot on main. After this PR they still see those buttons, but clicking one gives a 403 error toast. The backend still refuses the run, so this only affects the UI. I read this in the code and haven't run it.

Suggestion: this doesn't need to change here. A follow-up in the Collate repo could apply the same check as DataAssetsHeader, ideally in the same release.

Copilot AI balanced review requested due to automatic review settings November 6, 2026 15:57

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 has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 9, 2026 09:57

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 has insufficient remaining quota. Try requesting a review at a lower effort level.

@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

@gitar-bot

gitar-bot Bot commented Nov 9, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 2 closed / 2 findings

🔴 High risk · Adding target-service Trigger authorization for manual AutoPilot runs changes access decisions; a faulty check could let users run agents on unauthorized services.

Manual AutoPilot runs now require Trigger on both the application and the effective target service, with service-page button visibility checked against both permissions. Two findings were resolved: the target check now runs before validation so bad payloads return 400 instead of 500, and the new AutoPilot trigger permission rule now has a decision record. No open issues found.

✅ 2 closed
✅ Edge Case: Target check runs before validation, so bad payloads return 500 not 400

📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppResource.java:1657-1666
authorizeAutoPilotTarget runs before AutoPilotApp.triggerOnDemand calls validateConfig, and it assumes both active and entityLink are non-null. The endpoint says callers can "Delete keys by setting them to null". If a caller sends {"active": null}, !runtimeConfig.getActive() unboxes null and throws an NPE. If the run is active and entityLink is null or absent (the schema only requires active), EntityLink.parse(null) throws an NPE inside Pattern.matcher. Both cases come back as a 500 instead of the 400 validation error clients got before. To fix, validate the merged config before authorizing, or reject missing values explicitly.

✅ Quality: New AutoPilot trigger permission rule has no decision record

📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppResource.java:1373 📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppResource.java:1654-1668
This PR adds an authorization rule that clients (such as the UI gating the AutoPilot trigger button) and future app authors have to follow. No record in docs/decisions/ states it; I grepped for trigger, EditAll and AutoPilot and found none. Picking EditAll was a judgment call: Trigger on the service or an ingestion-pipeline create permission were also options. The exemption for inactive runs is a rule that appears only in the PR description, and the repository squash-merges, so that text never reaches git log. A record should assert: "A manual AutoPilot run requires Trigger on the application and EditAll on the service named by the effective entityLink, which is the stored configuration overlaid with the request payload. Inactive runs require no target, and scheduled automation is not checked." This comes from the description: "requires EditAll on the effective target service in addition to Trigger" and "Inactive AutoPilot runs keep their no-op behavior and do not require a target."

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@IceS2
IceS2 merged commit 9f5fa4f into main Nov 11, 2026
72 of 73 checks passed
@IceS2
IceS2 deleted the fix/autopilot-target-permissions branch November 11, 2026 06:29
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.

5 participants