Skip to content

Harden pipeline summary filter handling [2.0] - #36133

Merged
TeddyCr merged 2 commits into
open-metadata:2.0from
TeddyCr:backport/36010-2.0
Oct 23, 2026
Merged

TeddyCr merged 2 commits into
open-metadata:2.0from
TeddyCr:backport/36010-2.0

Conversation

@TeddyCr

@TeddyCr TeddyCr commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Backport of #36010 to the 2.0 release branch.

Route the pipeline summary, metrics, and execution/runtime trend filter values through bound SQL parameters (:psService, :psServiceType, :psStatus, :psTier) instead of interpolated string literals, so the escaping is consistent and complete across engines, and apply the standard VIEW_BASIC authorization check on the summary endpoint to match the metrics and trend endpoints.

Describe your changes:

Backport of the SQL filter hardening and summary authorization fix merged to main in #36010.

Adapted to 2.0 because a cherry-pick does not apply:

  • The DAO methods live in CollectionDAO.java on this branch (the TimeSeriesDAOs.java split came later on main), so the new @Bind parameters were added to the 2.0 signatures.
  • The 2.0 summary path also interpolated the serviceType query-param value raw into its MySQL/Postgres filters (mysqlServiceTypeFilter/postgresServiceTypeFilter). On main that value was already a bound parameter before Harden pipeline summary filter handling #36010, so the upstream diff did not touch it; here it is bound to :psServiceType as part of the backport — leaving it interpolated would keep open the exact injection Harden pipeline summary filter handling #36010 fixes.

Fixes the same defect on 2.0 as #36010 fixes on main.

Type of change:

  • Bug fix

High-level design:

N/A — direct backport, see #36010.

Tests:

Use cases covered

  • Pipeline summary/metrics/trend queries with service, serviceType, status, and tier filter values containing quotes produce bound parameters, not SQL fragments.
  • The /v1/pipelines/summary endpoint now enforces VIEW_BASIC like /metrics and the trend endpoints.

Unit tests

  • Not applicable — the filter-building logic has no unit-testable seam on 2.0; it is exercised by the merge-queue integration tests. The upstream PR Harden pipeline summary filter handling #36010 likewise added no tests (its review flagged the summary-auth regression IT as a merge follow-up on main).

Backend integration tests

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

  • mvn -pl openmetadata-service compile → BUILD SUCCESS
  • mvn -pl openmetadata-service spotless:apply (no churn) and spotless:check → pass

UI screen recording:

Not applicable — backend-only security backport.

Checklist:

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 4/5

The filter and authorization changes appear sound, but the DAO signatures must satisfy the repository’s parameter limit before merging.

Findings

  1. P2 DAO argument lists keep growing ▶

Summary

This backport replaces SQL literals with bound filter values and adds a VIEW_BASIC check before pipeline summaries are read.

  • Pipeline filters pass service, service type, status, and tier as bound values.
  • Pipeline summaries require the basic view permission.

TeddyCr explicitly states that no regression tests were added intentionally, relies on merge-queue coverage, and identifies the upstream summary authorization test as a deferred follow-up. No separate test finding is reported.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Pipeline request] --> B[VIEW_BASIC check]
  B --> C[Build SQL filters]
  C --> D[DAO binds filter values]
  D --> E[(MySQL or PostgreSQL)]
Loading

Reviews (1) · Last reviewed commit: "Merge branch '2.0' into backport/36010-2..." · Reviewed by Greptile

Backport of open-metadata#36010 to the 2.0 branch.

Route the pipeline summary, metrics, and execution/runtime trend filter
values through bound SQL parameters (:psService, :psServiceType,
:psStatus, :psTier) instead of interpolated string literals, so the
escaping is consistent and complete across engines, and apply the
standard VIEW_BASIC authorization check on the summary endpoint to
match the metrics and trend endpoints.

Adapted to 2.0: the DAO methods live in CollectionDAO (the
TimeSeriesDAOs split came later on main), and the summary path's
serviceType filters are bound here too since 2.0 interpolated them
raw.
@TeddyCr
TeddyCr requested a review from a team as a code owner October 23, 2026 16:26
@TeddyCr
TeddyCr requested review from pmbrull and removed request for a team October 23, 2026 16:26
@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.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Oct 23, 2026

OperationContext operationContext =
new OperationContext(entityType, MetadataOperation.VIEW_BASIC);
authorizer.authorize(securityContext, operationContext, getResourceContext());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Quality: No regression test for bound filters or summary VIEW_BASIC auth

This PR fixes a security bug: filter values that went straight into the SQL, and a missing authorization check on /v1/pipelines/summary. The repo's guidelines require bug fixes to ship with a failing test, but none was added. Nothing would catch a later change that puts service/serviceType/status/tier back into the SQL text, or that drops the authorizer.authorize(...) call. That is likely, since these queries are rebuilt by hand on each branch. Suggested fix: add an integration test in the existing pipeline resource IT. It should call /summary, /metrics, and the trend endpoints with filter values that contain single quotes (e.g. service=a' OR '1'='1) and check that no rows come back and the request does not fail with a SQL error. It should also call /summary as a user without VIEW_BASIC and expect a 403.

Was this helpful? React with 👍 / 👎

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs and removed safe to test Add this label to run secure Github workflows on PRs labels Oct 23, 2026
@gitar-bot

gitar-bot Bot commented Oct 23, 2026

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 0 closed / 1 findings

🔴 High risk · Adding VIEW_BASIC authorization to pipeline summaries changes access decisions and could make summaries unavailable to users lacking that permission.

Hardens pipeline summary, metrics, and trend filters by binding service, serviceType, status, and tier as SQL parameters, and adds VIEW_BASIC authorization to the /v1/pipelines/summary endpoint. Approved with one open suggestion: add a regression test for bound filters and the summary authorization check, since none ships with this security fix.

💡 Quality: No regression test for bound filters or summary VIEW_BASIC auth

📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/pipelines/PipelineResource.java:851 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PipelineRepository.java:1720-1734 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PipelineRepository.java:2538-2552

This PR fixes a security bug: filter values that went straight into the SQL, and a missing authorization check on /v1/pipelines/summary. The repo's guidelines require bug fixes to ship with a failing test, but none was added. Nothing would catch a later change that puts service/serviceType/status/tier back into the SQL text, or that drops the authorizer.authorize(...) call. That is likely, since these queries are rebuilt by hand on each branch. Suggested fix: add an integration test in the existing pipeline resource IT. It should call /summary, /metrics, and the trend endpoints with filter values that contain single quotes (e.g. service=a' OR '1'='1) and check that no rows come back and the request does not fail with a SQL error. It should also call /summary as a user without VIEW_BASIC and expect a 403.

🤖 Prompt for agents
Code Review: Hardens pipeline summary, metrics, and trend filters by binding `service`, `serviceType`, `status`, and `tier` as SQL parameters, and adds `VIEW_BASIC` authorization to the `/v1/pipelines/summary` endpoint. Approved with one open suggestion: add a regression test for bound filters and the summary authorization check, since none ships with this security fix.

1. 💡 Quality: No regression test for bound filters or summary VIEW_BASIC auth
   Files: openmetadata-service/src/main/java/org/openmetadata/service/resources/pipelines/PipelineResource.java:851, openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PipelineRepository.java:1720-1734, openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PipelineRepository.java:2538-2552

   This PR fixes a security bug: filter values that went straight into the SQL, and a missing authorization check on `/v1/pipelines/summary`. The repo's guidelines require bug fixes to ship with a failing test, but none was added. Nothing would catch a later change that puts `service`/`serviceType`/`status`/`tier` back into the SQL text, or that drops the `authorizer.authorize(...)` call. That is likely, since these queries are rebuilt by hand on each branch. Suggested fix: add an integration test in the existing pipeline resource IT. It should call `/summary`, `/metrics`, and the trend endpoints with filter values that contain single quotes (e.g. `service=a' OR '1'='1`) and check that no rows come back and the request does not fail with a SQL error. It should also call `/summary` as a user without `VIEW_BASIC` and expect a 403.

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

@sonarqubecloud

Copy link
Copy Markdown

@TeddyCr
TeddyCr merged commit ae25169 into open-metadata:2.0 Oct 23, 2026
56 of 62 checks passed
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.

2 participants