Skip to content

fix: validate pipeline status task names against a set (CWE-407 DoS) - #36758

Merged
harshach merged 2 commits into
open-metadata:mainfrom
harshach:agent/ant-2026-1mwgxlc2-medium-cwe
Oct 31, 2026
Merged

harshach merged 2 commits into
open-metadata:mainfrom
harshach:agent/ant-2026-1mwgxlc2-medium-cwe

Conversation

@harshach

@harshach harshach commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

No linked issue: this PR fixes advisory ANT-2026-1MWGXLC2 (CWE-407, authenticated denial of service), and no public issue was opened for it. Labelled skip-pr-checks accordingly.

PUT /api/v1/pipelines/{fqn}/status validated every taskStatus entry with a linear scan over the pipeline's tasks, so one request cost tasks × entries string comparisons; /status/bulk cost tasks²/2 for a status naming every task once. Neither tasks nor taskStatus has a size limit in the schema, and a pipeline owner — under the default OrganizationPolicy any authenticated user can claim an unowned pipeline — could send large, repeatedly-failing bodies that hold every QoS request slot, making the whole REST API return 503 while they are in flight.

Collect the pipeline's task names into a HashSet once per request and check each taskStatus entry against the set, making both endpoints linear in tasks + entries. The 400 Invalid task name … response is unchanged, and both endpoints now share one validation path instead of two. A status carrying task entries for a pipeline without tasks now gets the same 400 instead of a 500 (NullPointerException).

Second commit (53f2fa78f32): #36763 (merged to main while this PR was open) migrated the bulk-import history mocks onto batched entityExtensionDAO.insertMany, fixing the red openmetadata-service-unit-tests. Rebased onto it; where the two fixes overlapped, both behaviors were kept — main's version plus this branch's explicit single-row assertion on the captured version batch and the unchecked-warning suppression on the raw ArgumentCaptor in BulkImportChangeEventMaskingTest. Test-only, no production code.

Type of change:

  • Bug fix

High-level design:

N/A — small change: one repository method rewritten to be set-based, one call site rerouted through it, the per-name linear scan removed.

Tests:

Use cases covered

  • Pipeline owner writes a status whose 10000 taskStatus entries all name the last of the pipeline's 14000 tasks: each task name is read exactly once; the request is linear, not tasks × entries.
  • A status naming every task once (the /status/bulk shape): each task name is read exactly once, not tasks²/2.
  • Unknown task names are still refused with the same 400 Invalid task name ….
  • A status without entries passes on a pipeline without tasks.
  • Task entries on a pipeline without tasks are refused with the same 400 (previously a 500 NullPointerException).

Unit tests

  • I added unit tests for the new/changed logic.
  • Files added/updated: openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/PipelineStatusTaskValidationTest.java (new, 5 tests)
  • Coverage %: PipelineRepository.validateTasks(Pipeline, List) 100% instructions / 100% branches (jacoco via -Pstatic-code-analysis). The rest of PipelineRepository is covered primarily by the integration tests below.
  • The tests fail without the fix: with the old dedup-and-rescan algorithm entriesAgainstEveryTaskReadEachNameOnce fails (expected <1> but was <14000>), and the counting tests cannot even call the old private instance method.
mvn -B package -pl openmetadata-service -am -Dspring-boot.repackage.skip=true \
  -Dtest=EntityCacheLoadRaceTest,PipelineStatusComparisonTest,PipelineStatusTaskValidationTest \
  -Dsurefire.failIfNoSpecifiedTests=false
# Tests run: 12, Failures: 0, Errors: 0, Skipped: 0
#   EntityCacheLoadRaceTest 3, PipelineStatusComparisonTest 4, PipelineStatusTaskValidationTest 5

Backend integration tests

  • Not applicable (no backend API changes) — the existing PUT /pipelines/{fqn}/status and /status/bulk endpoints keep their contract.
  • Ran the impacted pipeline ITs locally (PR CI runs only unit tests; the merge queue runs the ITs first):
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true \
  -Pmysql-elasticsearch -DintegrationTests.lane=parallel \
  -Dit.test=PipelineResourceIT,PipelineServiceResourceIT,PipelineStatusAuthorizationIT \
  -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false

PASSED — unit bucket and impacted pipeline ITs run locally.

  • Unit (commit 1b4de42d3d0): EntityCacheLoadRaceTest, PipelineStatusComparisonTest, PipelineStatusTaskValidationTest — Tests run: 12, Failures: 0, Errors: 0, Skipped: 0.
  • Integration (mysql-elasticsearch lane, real server + MySQL + Elasticsearch): PipelineResourceIT, PipelineServiceResourceIT, PipelineStatusAuthorizationIT — Tests run: 459, Failures: 0, Errors: 0, Skipped: 52 (environment-dependent skips). Command in the section above; BUILD SUCCESS.
  • Rebased branch (commit 53f2fa78f32, after test: read bulk import history from the shared version writer #36763 merged to main): EntityRepositoryBulkImportSecretsTest, BulkImportChangeEventMaskingTest, PipelineStatusTaskValidationTest, PipelineStatusComparisonTest — Tests run: 14, Failures: 0, Errors: 0, Skipped: 0; BUILD SUCCESS. Spotless clean.

The other 19 IT classes the impact map lists for this area (smoke + messaging-pipelines-storage) were not run locally; they run in the merge queue.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

  • No manual UI testing (backend-only change). End-to-end behavior is exercised by the integration tests above, which run the real server against MySQL + Elasticsearch.

UI screen recording:

Not applicable — backend-only change with no UI impact.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation> — no issue exists for advisory ANT-2026-1MWGXLC2; labelled skip-pr-checks.
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above. — none exists; see above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed. — no schema change.
  • For a UI feature or feature task: as part of PR creation, I ran the PR build in Docker with sample data and embedded a verified GitHub-hosted recording plus build/health evidence above (or explained why this requirement is not applicable). — not applicable, no UI changes.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: I reviewed the final diff against REVIEW.md at commits 1b4de42d3d0aefd999ac7c576d8923db409e764e and 53f2fa78f3266f2a060d6b47899ce5b7ad93cac2 (rebased onto origin/main at 370a82ff73d). Findings: one gap (the taskless-pipeline 400 behavior change was not test-locked) — fixed by adding entriesOnTasklessPipelineAreRefused. Zero remaining 🔴; no sibling sites share the old scan shape (getTasks().stream() appears nowhere else in main). The second commit is test-only (single-row assertion + warning suppression on top of main's test: read bulk import history from the shared version writer #36763).
  • Decision check: no durable decision — self-evident bug fix; the one behavior change (500 → 400 on taskless pipelines with entries) is disclosed above.
  • I have added a test that covers the exact scenario we are fixing (bug-fix checklist).

@harshach harshach added the skip-pr-checks Bypass PR metadata validation check label Oct 31, 2026
@harshach
harshach requested a review from a team as a code owner October 31, 2026 20:33
@harshach
harshach requested a review from pmbrull October 31, 2026 20:33
@github-actions github-actions Bot added backend 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 31, 2026
PUT /pipelines/{fqn}/status validated every taskStatus entry with a
linear scan over the pipeline's tasks, so one request cost
tasks x entries comparisons; /status/bulk cost tasks^2/2 for a status
naming every task. Neither list has a size limit, and a pipeline owner
sending large repeated bodies could occupy every QoS request slot and
deny service to all other API clients.

Collect the pipeline's task names into a HashSet once per request and
check each entry against the set, making both endpoints linear in
tasks + entries. A status carrying task entries for a pipeline without
tasks now gets the same 400 (Invalid task name) instead of a 500
(NullPointerException).
open-metadata#36763 moved the bulk-import history mocks onto insertMany; this keeps
the two checks it did not carry over: the explicit single-row assertion
on the captured version batch, and the unchecked-warning suppression on
the raw ArgumentCaptor.
@harshach
harshach force-pushed the agent/ant-2026-1mwgxlc2-medium-cwe branch from 14e0de8 to 53f2fa7 Compare October 31, 2026 21:38
@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 31, 2026
@gitar-bot

gitar-bot Bot commented Oct 31, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Set-based task validation changes pipeline status writes; mismatched task-name handling could reject otherwise valid pipeline updates.

Replaces the per-entry linear scan of pipeline task names in status validation with a one-time HashSet lookup, so both PUT /pipelines/{fqn}/status and /status/bulk are linear in tasks plus entries. No issues found.

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

@harshach
harshach merged commit 8b39c2d into open-metadata:main Oct 31, 2026
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant