Skip to content

fix(security): bump pyathena to 3.35.4 (backport 1.13) - #32166

Merged
IceS2 merged 3 commits into
1.13from
backport/pyathena-3.35.4-1.13
Aug 28, 2026
Merged

IceS2 merged 3 commits into
1.13from
backport/pyathena-3.35.4-1.13

Conversation

@karanh37

@karanh37 karanh37 commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #32137 to 1.13.

Bumps pyathena from ~=3.25.0 to ~=3.35.4 to remediate CVE-2026-65321 / GHSA-xwj5-g6cv-4r5c (CVSS 9.3, CWE-89 SQL Injection). Vulnerable range [,3.35.4), fixed in 3.35.4.

Single-line change to ingestion/setup.py (VERSIONS["pyathena"]), feeding both the athena extra and the test/dev set. Cherry-picked clean from the main-branch commit.

See #32137 for full verification notes.

🤖 Generated with Claude Code

Greptile Summary

The PR upgrades PyAthena to 3.35.4 to remediate the reported SQL-injection vulnerability.

  • Updates the Athena extra and shared ingestion dependency version.
  • Aligns the Airflow 3.3.0 constraints file with the patched release.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
ingestion/setup.py Raises the shared PyAthena requirement to the patched 3.35.4 release.
ingestion/airflow-constraints-3.3.0.txt Pins Airflow 3.3.0 environments to PyAthena 3.35.4 and documents the security rationale.

Reviews (3): Last reviewed commit: "Merge branch '1.13' into backport/pyathe..." | Re-trigger Greptile

pyathena below 3.35.4 is affected by CVE-2026-65321 (CVSS 9.3, CWE-89):
DELETE and CTAS statements are routed to the Hive-style backslash
escaper, but Athena/Trino treats a backslash as an ordinary character
inside a string literal, so a parameter containing a single quote breaks
out of the literal and injects arbitrary SQL.

setup.py pinned `pyathena~=3.25.0`, which caps the athena extra at
<3.26 and cannot pick up the fix.

Verified against a real 3.35.4 install on Python 3.10 with
SQLAlchemy 2.0.52 that every pyathena symbol the Athena connector and
profiler rely on still exists, including the private ones:
AthenaStatementCompiler, AthenaDialect (_get_table, _get_column_type,
_pattern_column_type), pyathena.sqlalchemy.util._HashableDict, the
AthenaTableMetadata accessors, and the awsathena+rest dialect entry
point.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@karanh37
karanh37 requested a review from a team as a code owner August 27, 2026 10:09
@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 safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Aug 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The Python checkstyle failed.

Please run make py_format and py_format_check in the root of your repository and commit the changes to this PR.
You can also use pre-commit to automate the Python code formatting.

You can install the pre-commit hooks with make install_test precommit_install.

Comment thread ingestion/setup.py Resolved
@github-actions

Copy link
Copy Markdown
Contributor

The Python checkstyle failed.

Please run make py_format and py_format_check in the root of your repository and commit the changes to this PR.
You can also use pre-commit to automate the Python code formatting.

You can install the pre-commit hooks with make install_test precommit_install.

pmbrull pushed a commit that referenced this pull request Aug 28, 2026
* fix(ci): restore the python pipeline on 1.13

PRs targeting 1.13 are validated by main's workflow definitions: the
`pull_request_target` event resolves workflows from the default branch,
while `actions/checkout` puts the 1.13 tree on disk. main's
`py-tests-shared.yml` therefore runs against a checkout that is missing
files it depends on, and every python job goes red regardless of the
diff -- #32154, a Java-only backport, failed identically to #32166.

Three gaps are fixable from this branch:

* `.github/scripts/` does not exist on 1.13 at all. `classify_test_outcome.py`
  exits 2 *after* the tests pass (a postgres shard logged `101 passed` and
  `nox > Session integration-tests was successful`, then failed the job), and
  `configure_docker_storage.sh` exits 127, killing shards 2 and 3 before they
  download anything. Both scripts are copied verbatim from main; they are
  stdlib-only Python and plain bash with no new dependencies. The globs they
  read resolve here -- noxfile.py writes junit/test-results-unit.xml and
  junit/test-results-integration.xml.

* `basedpyright~=1.39.0` floats onto 1.39.10 (released 2026-08-13), which
  reports ~428 errors against this branch's baseline. main pinned
  `==1.39.3` in #27834 to stop exactly this; only the pin is taken here,
  since the rest of that commit conflicts across seven files.

* tests/unit/source/pipeline/openlineage/ is not a package, so its
  test_connection.py collides with the one under
  tests/unit/metadata/ingestion/connections/ and pytest intermittently
  reports `import file mismatch`. main disambiguates with __init__.py.
  Only the leaf marker is added -- enough to make the module name unique
  without renaming every module under tests/unit/source/.

The spaCy 3.8 model mismatch and the ruff-only checkstyle install cannot
be fixed from here; both need main's workflows to probe the checkout.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(integration): make the airflow, alationsink and ometa tests self-sufficient

Backport of the test half of #32145 (2.0, c1e9302). PRs based on 1.13 are
validated by main's py-tests-shared.yml, which brings the stack up with
`-i false` — no openmetadata_ingestion container, so no Airflow on :8080 and
no sample-data DAGs. These three suites still depended on both and failed
deterministically: four alationsink cases on shard-2, three
test_airflow_lineage cases plus test_es_search_from_name on shard-3, across
every Python version.

 - airflow: a conftest that builds and runs Airflow in a testcontainer joined
   to ometa_network, so the suite owns its DAGs and connection. apache-airflow
   3.3.0 matches this branch's setup.py, the same pin 2.0 uses.
 - alationsink: build the service, database, schema and tables under test
   instead of reading sample_data.ecommerce_db.
 - ometa: a test_team_data fixture creating the "Data" team that
   test_es_search_from_name asserts on.

.dockerignore keeps the airflow image's build context to src/, and only
applies to builds whose context is ingestion/ — every other image builds from
the repository root with the top-level ignore file.

The upstream commit's ingestion/src changes are deliberately omitted: its
PLC0415 annotations and dbt/dbtcloud/vertica suppressions target 2.0's ruff
and 2.0's basedpyright baseline, neither of which applies here. Its
test_ometa_user_api reformatting is also dropped — only the fixture is taken,
so the file stays black-conformant on this branch.

Does not address shard-2's datalake failures (a 400 on recursive service
delete when Airflow is absent), shard-3's trino NO_NODES_AVAILABLE errors, or
test_s3_ingestion.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(integration): fix the trino readiness race and a stale s3 assertion

trino (shard-3, 38 errors): the container readiness probe queried
system.runtime.nodes, which the system connector answers on every active node
before any catalog can be scheduled. The fixture proceeded and the first
ANALYZE failed with NO_NODES_AVAILABLE, erroring every test in the package.
Probe a real catalog instead, and replace the flat sleep(1) between write and
ANALYZE with a read-back that retries while the hive split is still lagging.
Pin the hive-metastore image by digest so :latest cannot drift under a
maintenance branch.

Only the readiness half of main's trino rework is taken. Its move of drop_stats
into a reset_trino_table_statistics fixture, the folding of test_no_statistics
into test_profiler, and the removal of test_empty_table_with_dropped_stats_falls_back
are a coverage redesign rather than a CI fix, so this branch keeps its global
drop_stats call and all three tests unchanged. Nothing in the trino connector
source is touched.

s3 (shard-3, 1 failed): the container payload no longer inlines children, so
`assert 7 == len(bucket.children.root)` raised AttributeError. The next line
already asserts the same count through list_container_children. The
"Invalid STS API version" logged nearby is the non-mandatory GetMetrics step of
the S3 test connection and fails nothing.

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(tests): profile in setUpClass so test_list_entity_profiles has data (#31882)

pytest orders unittest TestCase methods alphabetically, so
test_list_entity_profiles runs first -- before test_profiler_workflow has
created any profile. The module sets TestLoader.sortTestMethodsUsing = None
to force definition order, but that only affects unittest's own loader:
pytest collects TestCase methods itself and ignores it. Verified against an
unmodified checkout -- collection still yields list_entity_profiles first
with that line in place, so it has never had any effect here.

The test still passed, because it asserts on a global 24h window across
every table rather than on data it owns, and hard-deleted tables used to
leak their profiler rows into that window. #31556 stopped that leak (issue
"0 not greater than 0" on every PR that actually runs the ingestion
integration matrix, blocking the merge queue. PRs that do not touch
ingestion skip the matrix and report green, which is why this looked
branch-specific rather than repo-wide.

Run the profiler in setUpClass, where fixture data belongs, so no test
depends on another's ordering. Drop the ineffective loader hack, and turn
the `if profiles_all.entities:` guard into an assertion -- that guard
swallowed an empty unfiltered listing and hid which of the two calls was
actually empty, which is the signal needed to diagnose this.

* fix(ci): stabilize remaining 1.13 Python checks

* fix(ci): align 1.13 Python tests with CI

---------

Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: IceS2 <[email protected]>
Co-authored-by: Himanshu Khairajani <[email protected]>
Co-authored-by: Pablo Takara <[email protected]>
@gitar-bot

gitar-bot Bot commented Aug 28, 2026

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

Backport bumps PyAthena to 3.35.4 to remediate CVE-2024-65321 (CVSS 9.3 SQL injection). Airflow constraints pin now synchronized with the patched version, resolving the vulnerable constraint issue.

✅ 1 resolved
✅ Security: Airflow constraints pin vulnerable PyAthena, defeating CVE fix

📄 ingestion/setup.py:74
The setup.py bump to pyathena~=3.35.4 is correct, but ingestion/airflow-constraints-3.3.0.txt still pins PyAthena==3.32.0 (< 3.35.4, still vulnerable to CVE-2026-65321). Dockerfile.ci runs pip install "." --constraint /home/airflow/airflow-constraints-3.3.0.txt, and pip constraints take precedence over setup.py requirements, so the Docker/CI image will install the vulnerable 3.32.0 and the SQL-injection remediation is not applied there. Update the pin in airflow-constraints-3.3.0.txt (the active airflow 3.3.0 constraint) to PyAthena==3.35.4 or higher so the fix reaches the built image.

Options

Display: compact → Showing less information.

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 99550b6 into 1.13 Aug 28, 2026
86 of 93 checks passed
@IceS2
IceS2 deleted the backport/pyathena-3.35.4-1.13 branch August 28, 2026 16:13
@mohittilala mohittilala self-assigned this Aug 29, 2026

This branch was previously deployed

1 inactive deployment
test — 75a58bb0 Deployed Aug 28, 2026 by IceS2 via playwright-ci-postgresql (3, 6) #75638
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 UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants