Skip to content

fix(ingestion): validate PowerBI .pbit archive members before extracting - #37859

Merged
Khairajani merged 5 commits into
mainfrom
fix/powerbi-pbit-zip-slip
Nov 16, 2026
Merged

Khairajani merged 5 commits into
mainfrom
fix/powerbi-pbit-zip-slip

Conversation

@Khairajani

@Khairajani Khairajani commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #

From the nightly security review, which reported Zip Slip in PowerBI .pbit extraction.

  • get_datamodel_schema_files_from_pbit() called extractall() on .pbit files from a shared bucket or folder without checking member names.
  • CPython's extractall already rewrites .. and absolute names, so nothing escapes today. Even so, the crafted entry was silently relocated instead of rejected, and the download step in the same file already validates paths explicitly.
  • Members are now extracted one at a time, and any entry whose resolved path leaves the extract directory is skipped with a warning.
  • Each .pbit is now handled on its own, so one corrupt file no longer turns the whole result into None.

Tests: added test_file_client_zip_slip.py. Two of its tests fail on the old code, and all 53 PowerBI file-client tests pass.

Type of change:

  • Bug fix

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the previous test concern is fixed and no new issues were found.

Summary

The PR checks archive member paths before extracting PowerBI .pbit files and catches extraction errors per archive.

  • Power BI extraction skips .pbit entries that leave their folder.
  • A damaged .pbit no longer stops other files from providing schemas.

Reviews (4) · Last reviewed commit: "test(ingestion): assert the good .pbit's..." · Reviewed by Greptile

get_datamodel_schema_files_from_pbit() called extractall() on .pbit files
pulled from a shared bucket or folder without checking member names. CPython's
extractall rewrites ".." and absolute names, so nothing lands outside the
target today, but the crafted entry is silently relocated rather than
rejected, and the download step in the same file already validates paths
explicitly.

Extract member by member and skip, with a warning, any entry whose resolved
path leaves the extract directory. Also handle each .pbit on its own, so one
corrupt file no longer discards the schemas of all the others.
@Khairajani
Khairajani requested a review from a team as a code owner November 16, 2026 08:23
@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.

@Khairajani Khairajani added the safe to test Add this label to run secure Github workflows on PRs label Nov 16, 2026
…pping all schemas

Opening a ZIP reads only its central directory, so damaged compressed data
fails later, during extraction, with zlib.error, EOFError, RuntimeError or
NotImplementedError. The per-file handler caught only BadZipFile and OSError,
so those errors reached the outer handler and returned None for every archive.
Catch any extraction failure per file, and add a test with damaged deflate data
next to a good archive.
@gitar-bot

gitar-bot Bot commented Nov 16, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 1 closed / 1 findings

Per-member .pbit path validation and per-file error handling change ingestion; rejected or damaged archives could leave their schemas unavailable.

Hardens PowerBI .pbit extraction by validating archive member paths and extracting each file in isolation so one corrupt archive no longer discards all schemas. Resolved a finding where the escape assertion checked the wrong path and could never detect traversal. No open issues found.

✅ 1 closed
✅ Quality: Escape assertion checks wrong path, never detects the traversal

📄 ingestion/tests/unit/source/dashboard/powerbi/test_file_client_zip_slip.py:57-64
With dest = tmp_path/extracted/report, the member ../../bad.txt resolves to tmp_path/bad.txt, not tmp_path.parent/bad.txt. The assertion on line 64 checks a path the escape could never reach, so it passes even if _extract_pbit writes the file outside dest. The test also does not check that the member was skipped rather than moved inside dest. Point the assertion at tmp_path / "bad.txt" and also assert not (dest / "bad.txt").exists().

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

@Khairajani
Khairajani enabled auto-merge (squash) November 16, 2026 10:33
@Khairajani
Khairajani merged commit def1e9e into main Nov 16, 2026
54 of 56 checks passed
@Khairajani
Khairajani deleted the fix/powerbi-pbit-zip-slip branch November 16, 2026 10:41
Khairajani added a commit that referenced this pull request Nov 16, 2026
…ing (#37859)

* fix(ingestion): validate PowerBI .pbit archive members before extracting

get_datamodel_schema_files_from_pbit() called extractall() on .pbit files
pulled from a shared bucket or folder without checking member names. CPython's
extractall rewrites ".." and absolute names, so nothing lands outside the
target today, but the crafted entry is silently relocated rather than
rejected, and the download step in the same file already validates paths
explicitly.

Extract member by member and skip, with a warning, any entry whose resolved
path leaves the extract directory. Also handle each .pbit on its own, so one
corrupt file no longer discards the schemas of all the others.

* test(ingestion): assert the .pbit escape paths a traversal would actually reach

* fix(ingestion): skip a .pbit that fails mid-extraction instead of dropping all schemas

Opening a ZIP reads only its central directory, so damaged compressed data
fails later, during extraction, with zlib.error, EOFError, RuntimeError or
NotImplementedError. The per-file handler caught only BadZipFile and OSError,
so those errors reached the outer handler and returned None for every archive.
Catch any extraction failure per file, and add a test with damaged deflate data
next to a good archive.

* style(ingestion): use lazy %-style logging in the .pbit extraction warnings

* test(ingestion): assert the good .pbit's parsed schema instead of mocking the schema reader

(cherry picked from commit def1e9e)
Khairajani added a commit that referenced this pull request Nov 16, 2026
….pbit Zip Slip fix (#37748, #37858, #37859) (#37861)

* fix(ingestion): floor oauthlib, filelock and dnspython for Dependabot alerts (#37748)

oauthlib >= 4.0.1 fixes GHSA-3jp2-3mrg-2vxc (device-code grant issues a
token for any device_code). filelock >= 4.2.1 fixes GHSA-v4x8-3wr5-3wq8
(ReadWriteLock follows planted symlinks) and dnspython >= 2.9.0 fixes
GHSA-45c3-73f7-pv4m (name decompression CPU DoS); both fixes need Python
3.11, so the floors carry a python_version marker and the 3.10 fork keeps
the vulnerable releases.

The images pip-install openmetadata-ingestion from PyPI rather than from
uv.lock, so the floors go in setup.py where they reach both. The in-tree
Airflow constraints pin oauthlib 3.3.1 and filelock 3.32.6; bump them, and
snowflake-connector-python to 4.8.1 because 4.7.x caps filelock < 4.

(cherry picked from commit 8a95e0c)

* fix(ingestion): raise dnspython, tornado and OpenTelemetry floors for CVEs (#37858)

dnspython >= 2.9.2 fixes CVE-2026-128089, which the 2.9.0 floor from
opentelemetry-exporter-otlp 1.45.2 brings opentelemetry-api 1.45.2 for
CVE-2026-126360. The dnspython and tornado fixes need Python 3.11, so the
existing python_version markers stay and the 3.10 fork keeps the old releases.

The in-tree Airflow constraints pin dnspython 2.9.0, tornado 6.5.9 and the
OpenTelemetry family at 1.45.1 / 0.66b1; bump them to match, and regenerate
uv.lock for just these packages.

(cherry picked from commit b7a53e0)

* fix(ingestion): validate PowerBI .pbit archive members before extracting (#37859)

* fix(ingestion): validate PowerBI .pbit archive members before extracting

get_datamodel_schema_files_from_pbit() called extractall() on .pbit files
pulled from a shared bucket or folder without checking member names. CPython's
extractall rewrites ".." and absolute names, so nothing lands outside the
target today, but the crafted entry is silently relocated rather than
rejected, and the download step in the same file already validates paths
explicitly.

Extract member by member and skip, with a warning, any entry whose resolved
path leaves the extract directory. Also handle each .pbit on its own, so one
corrupt file no longer discards the schemas of all the others.

* test(ingestion): assert the .pbit escape paths a traversal would actually reach

* fix(ingestion): skip a .pbit that fails mid-extraction instead of dropping all schemas

Opening a ZIP reads only its central directory, so damaged compressed data
fails later, during extraction, with zlib.error, EOFError, RuntimeError or
NotImplementedError. The per-file handler caught only BadZipFile and OSError,
so those errors reached the outer handler and returned None for every archive.
Catch any extraction failure per file, and add a test with damaged deflate data
next to a good archive.

* style(ingestion): use lazy %-style logging in the .pbit extraction warnings

* test(ingestion): assert the good .pbit's parsed schema instead of mocking the schema reader

(cherry picked from commit def1e9e)

---------

Co-authored-by: Mayur Singal <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants