Skip to content

fix(security): authorize test-connection workflow triggers (#26760) - #28414

Merged
ulixius9 merged 2 commits into
mainfrom
test_conn_auth
May 26, 2026
Merged

ulixius9 merged 2 commits into
mainfrom
test_conn_auth

Conversation

@ulixius9

Copy link
Copy Markdown
Member

What

Adds authorization to the workflow trigger endpoint (POST /v1/automations/workflows/trigger/{id}) for TEST_CONNECTION workflows. Closes #26760.

Why

The trigger endpoint performed no authorization, so any authenticated user could trigger a TEST_CONNECTION workflow against any service and probe its connectivity/credentials, regardless of ownership or pipeline permissions.

How

authorizeWorkflowTrigger, for TEST_CONNECTION only:

  1. Converts the workflow via ClassConverterFactory before the type check. The stored Workflow.request is an untyped LinkedHashMap, so instanceof TestServiceConnectionRequest only matches after conversion — the same pattern the existing unmask/decrypt paths already use. Without this the check silently falls through.
  2. Requires ANY of:
    • admin (short-circuits), or
    • EDIT_ALL on the target service (covers the service owner), or
    • CREATE on INGESTION_PIPELINE.
  3. When no serviceName is present, falls back to CREATE on INGESTION_PIPELINE.

workflowType is checked before converting, so non-test-connection triggers skip the (secrets-decrypting) conversion entirely.

Scope

QUERY_RUNNER, REVERSE_INGESTION, and TEST_SPARK_ENGINE_CONNECTION are intentionally left unchanged (no trigger-level authz, as before) to keep this change scoped to #26760. Locking those down — QUERY_RUNNER in particular executes arbitrary SQL — is worth a separate follow-up.

Testing

Adds WorkflowTriggerPermissionsIT. Verified end-to-end against a local Docker deployment:

Scenario Result
admin → TEST_CONNECTION 200
non-owner, no perms → TEST_CONNECTION 403
service owner → TEST_CONNECTION 200
non-owner + ingestionPipeline:Create → TEST_CONNECTION 200
QUERY_RUNNER (non-owner) not gated

🤖 Generated with Claude Code

POST /v1/automations/workflows/trigger/{id} performed no authorization,
so any authenticated user could trigger a TEST_CONNECTION workflow against
any service and probe its connectivity/credentials.

For TEST_CONNECTION triggers, require ANY of: admin, EDIT_ALL on the target
service (covers the service owner), or CREATE on INGESTION_PIPELINE; fall
back to CREATE on INGESTION_PIPELINE when no serviceName is present. Other
workflow types keep their prior behavior to keep the change scoped.

The stored Workflow.request is an untyped LinkedHashMap, so the type check
runs on a ClassConverterFactory-converted copy (same pattern the existing
unmask/decrypt paths use) — otherwise the instanceof never matches and the
check silently falls through.

Adds WorkflowTriggerPermissionsIT covering admin, non-owner, service-owner,
pipeline-permission, no-serviceName fallback, and non-test-connection scoping.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings May 25, 2026 14:34
@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels May 25, 2026
@ulixius9 ulixius9 added the To release Will cherry-pick this PR into the release branch label May 25, 2026

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 adds server-side authorization to the workflow trigger endpoint (POST /v1/automations/workflows/trigger/{id}) for TEST_CONNECTION workflows, preventing non-privileged users from triggering connectivity/credential probes against services they don’t own or administer.

Changes:

  • Enforce authorization on TEST_CONNECTION workflow triggers, requiring either service-level EDIT_ALL or global INGESTION_PIPELINE CREATE (admin short-circuits via authorizer behavior).
  • Convert stored workflow payloads before type-checking the request so TEST_CONNECTION requests stored as untyped maps can be evaluated.
  • Add integration tests validating allow/deny behavior across admin, service-owner, ingestionPipeline-create, and DataConsumer scenarios.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
openmetadata-service/src/main/java/org/openmetadata/service/resources/automations/WorkflowResource.java Adds TEST_CONNECTION-scoped authorization checks to the trigger endpoint using authorizeRequests(..., ANY).
openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/WorkflowTriggerPermissionsIT.java Introduces integration coverage for the new trigger authorization behavior and confirms non-TEST_CONNECTION triggers remain ungated.

…ected

Address review: if a TEST_CONNECTION workflow's request cannot be resolved
to a TestServiceConnectionRequest after conversion (e.g. a null/corrupt
request or future converter change), deny the trigger with 403 instead of
silently letting it run unauthorized.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@gitar-bot

gitar-bot Bot commented May 25, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 resolved / 1 findings

Adds authorization to the workflow trigger endpoint for test-connection requests to prevent unauthorized connectivity probes. The fix addresses the silent auth bypass caused by type conversion failures.

✅ 1 resolved
✅ Security: Silent auth bypass when ClassConverter fails to produce expected type

📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/automations/WorkflowResource.java:590-598
In authorizeWorkflowTrigger (line 590-598), if the workflow type is TEST_CONNECTION but ClassConverterFactory fails to convert the request into a TestServiceConnectionRequest (e.g., malformed/corrupted data, schema mismatch, or future refactoring changes the converter behavior), the instanceof check on line 594 silently falls through and no authorization is performed. The trigger then proceeds without any permission check.

Since this is a security-critical path, the method should deny access by default when the conversion doesn't yield the expected type, rather than silently allowing it.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (11 flaky)

✅ 4246 passed · ❌ 0 failed · 🟡 11 flaky · ⏭️ 87 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 297 0 2 4
🟡 Shard 2 804 0 1 8
🟡 Shard 3 795 0 1 8
🟡 Shard 4 842 0 3 12
✅ Shard 5 719 0 0 47
🟡 Shard 6 789 0 4 8
🟡 11 flaky test(s) (passed on retry)
  • Features/MetricCustomUnitFlow.spec.ts › Should create metric and test unit of measurement updates (shard 1, 1 retry)
  • Features/TagsSuggestion.spec.ts › should decline requested tags for an api endpoint request schema field (shard 1, 1 retry)
  • Features/Glossary/GlossaryWorkflow.spec.ts › should display correct status badge color and icon (shard 2, 1 retry)
  • Features/Table.spec.ts › Table pagination with sorting should works (shard 3, 1 retry)
  • Pages/CustomProperties.spec.ts › Table (shard 4, 1 retry)
  • Pages/CustomProperties.spec.ts › Entity Reference (shard 4, 1 retry)
  • Pages/CustomProperties.spec.ts › Markdown (shard 4, 1 retry)
  • Pages/Lineage/DataAssetLineage.spec.ts › Column lineage for mlModel -> table (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage schema filter selection (shard 6, 1 retry)
  • Pages/ODCSImportExport.spec.ts › Multi-object ODCS contract - object selector shows all schema objects (shard 6, 1 retry)
  • Pages/TasksUIFlow.spec.ts › Create and reject tag task for Topic via UI (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

@ulixius9
ulixius9 merged commit 45295b7 into main May 26, 2026
55 of 56 checks passed
@ulixius9
ulixius9 deleted the test_conn_auth branch May 26, 2026 08:50
@github-actions

Copy link
Copy Markdown
Contributor

Changes have been cherry-picked to the 1.12.9 branch.

github-actions Bot pushed a commit that referenced this pull request May 26, 2026
…28414)

* fix(security): authorize test-connection workflow triggers (#26760)

POST /v1/automations/workflows/trigger/{id} performed no authorization,
so any authenticated user could trigger a TEST_CONNECTION workflow against
any service and probe its connectivity/credentials.

For TEST_CONNECTION triggers, require ANY of: admin, EDIT_ALL on the target
service (covers the service owner), or CREATE on INGESTION_PIPELINE; fall
back to CREATE on INGESTION_PIPELINE when no serviceName is present. Other
workflow types keep their prior behavior to keep the change scoped.

The stored Workflow.request is an untyped LinkedHashMap, so the type check
runs on a ClassConverterFactory-converted copy (same pattern the existing
unmask/decrypt paths use) — otherwise the instanceof never matches and the
check silently falls through.

Adds WorkflowTriggerPermissionsIT covering admin, non-owner, service-owner,
pipeline-permission, no-serviceName fallback, and non-test-connection scoping.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(security): fail closed when TEST_CONNECTION request type is unexpected

Address review: if a TEST_CONNECTION workflow's request cannot be resolved
to a TestServiceConnectionRequest after conversion (e.g. a null/corrupt
request or future converter change), deny the trigger with 403 instead of
silently letting it run unauthorized.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
(cherry picked from commit 45295b7)
@github-actions

Copy link
Copy Markdown
Contributor

Changes have been cherry-picked to the 1.13 branch.

github-actions Bot pushed a commit that referenced this pull request May 26, 2026
…28414)

* fix(security): authorize test-connection workflow triggers (#26760)

POST /v1/automations/workflows/trigger/{id} performed no authorization,
so any authenticated user could trigger a TEST_CONNECTION workflow against
any service and probe its connectivity/credentials.

For TEST_CONNECTION triggers, require ANY of: admin, EDIT_ALL on the target
service (covers the service owner), or CREATE on INGESTION_PIPELINE; fall
back to CREATE on INGESTION_PIPELINE when no serviceName is present. Other
workflow types keep their prior behavior to keep the change scoped.

The stored Workflow.request is an untyped LinkedHashMap, so the type check
runs on a ClassConverterFactory-converted copy (same pattern the existing
unmask/decrypt paths use) — otherwise the instanceof never matches and the
check silently falls through.

Adds WorkflowTriggerPermissionsIT covering admin, non-owner, service-owner,
pipeline-permission, no-serviceName fallback, and non-test-connection scoping.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(security): fail closed when TEST_CONNECTION request type is unexpected

Address review: if a TEST_CONNECTION workflow's request cannot be resolved
to a TestServiceConnectionRequest after conversion (e.g. a null/corrupt
request or future converter change), deny the trigger with 403 instead of
silently letting it run unauthorized.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
(cherry picked from commit 45295b7)

This branch was previously deployed

1 inactive deployment
test — 080c009a Deployed May 25, 2026 by ulixius9 via playwright-ci-postgresql (1, 6) #48504
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 To release Will cherry-pick this PR into the release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test Connection endpoint authorizer

3 participants