Skip to content

fix(security): bump pyathena to 3.35.4 - #32137

Merged
harshsoni2024 merged 1 commit into
mainfrom
security/pyathena-3.35.4
Aug 27, 2026
Merged

harshsoni2024 merged 1 commit into
mainfrom
security/pyathena-3.35.4

Conversation

@karanh37

@karanh37 karanh37 commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Advisory

CVE-2026-65321 / GHSA-xwj5-g6cv-4r5c / SNYK-PYTHON-PYATHENA-19270043 — critical, CVSS 9.3
(CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H/E:P), CWE-89 SQL Injection.
Vulnerable range [,3.35.4); fixed in 3.35.4.

Affected versions of this package are vulnerable to SQL Injection through its escaper selection
for DELETE and CREATE TABLE ... AS SELECT statements. An attacker can break out of a
parameterized string literal and inject arbitrary SQL by supplying a value containing a single
quote in a DELETE or CTAS query. The vulnerable code routes those statements to the Hive-style
backslash escaper, but Athena/Trino parses backslashes as ordinary characters inside string
literals […]

Raw scanner finding

ingestion-dep-scan.json, security-scan run 33031058562 (head 36f5148884) — the only non-base-image critical in this run:

severity=critical  package=pyathena  version=3.25.0  title="SQL Injection"
  id=SNYK-PYTHON-PYATHENA-19270043  CVE-2026-65321  cvssScore=9.3
  fixedIn=['3.35.4']  semver.vulnerable=['[,3.35.4)']
  isUpgradable=False  isPatchable=False
  from=['[email protected]', '[email protected]']

Snyk reports isUpgradable: False because the fix falls outside the declared pin
pyathena~=3.25.0 (>=3.25.0, <3.26.0) — the pin itself is what blocks the fix, so the pin is
what this PR changes.

What I verified

1 — the advisory is coherent. pyathena 3.35.4 is a real published release
(https://pypi.org/pypi/pyathena/3.35.4/json, requires_python: >=3.10), and 3.25.0 is genuinely
below it. It is a minor bump inside the 3.x line, not a major.

2 — the full pyathena API surface this repo uses still exists at 3.35.4. The Athena connector
does not just import pyathena, it monkey-patches private internals, so I installed 3.35.4 into a
clean Python 3.10 venv (the version CI runs) with sqlalchemy 2.0.52 — inside this repo's
declared sqlalchemy>=2.0.0,<3 range — and checked every symbol:

Symbol Used at Present in 3.35.4
pyathena.sqlalchemy.compiler.AthenaStatementCompiler profiler/interface/sqlalchemy/athena/profiler_interface.py:25 yes
AthenaStatementCompiler.visit_column (patched) same file yes
pyathena.sqlalchemy.util._HashableDict (private) .../database/athena/utils.py:17,274,275 yes
pyathena.sqlalchemy.base.AthenaDialect .../database/athena/metadata.py:19 yes
AthenaDialect._pattern_column_type (private) .../athena/utils.py:37 yes (base.py:185)
AthenaDialect._get_table / _get_column_type / get_columns / get_view_definition / get_table_options / _raw_connection patched in athena/metadata.py:74-77, defined in athena/utils.py all yes
AthenaTableMetadata.{columns, partition_keys, parameters, location, compression, row_format, file_format, serde_properties, table_properties} athena/utils.py get_columns / get_table_options all yes
awsathena+rest dialect entry point athenaConnection.json:18 scheme enum yes → resolves to AthenaRestDialect

sa.create_engine("awsathena+rest://…") resolves to AthenaRestDialect on 3.35.4.

3 — no dependency floor is violated. 3.35.4 declares boto3>=1.41.2 / botocore>=1.41.2;
this repo already pins boto3~=1.41.5 (setup.py:30), which satisfies both. Its sqlalchemy
extra declares >=1.0.0, satisfied by the repo's sqlalchemy>=2.0.0,<3.

4 — it is consistent with the rest of the repo. ingestion/airflow-constraints-3.3.1.txt:50
already carries PyAthena==3.35.4. That constraint file is only applied to the
openmetadata-airflow-apis install in Dockerfile.ci, not to the ingestion install, so there is
no live resolver conflict today — but 3.35.4 is what the pinned Airflow 3.3.1 constraint set
expects, and after this change the two agree.

5 — formatting/lint. ruff format --check and ruff check (with ingestion/pyproject.toml)
both pass on the changed file; the new line is 119 chars against the configured line-length = 120.

Manifests touched

  • ingestion/setup.py — VERSIONS["pyathena"]: pyathena~=3.25.0 → pyathena~=3.35.4.
    This one entry feeds both the athena extra (setup.py:218) and the test/dev set (setup.py:550).

No lockfile to regenerate on the Python side.

What I did NOT test

  • No ingestion test suite run, and no pip install -e '.[athena]' against the real ingestion
    dependency set.
    The verification above is a targeted API-surface check in an isolated venv
    containing only pyathena + sqlalchemy. It proves the symbols exist and the dialect resolves;
    it does not prove the whole ingestion resolver still solves with 3.35.4 alongside every other
    pinned connector. CI is the check for that — please let it run before this leaves draft.
  • No live Athena connection, no metadata ingestion run, and no profiler run. Behavioural
    equivalence of get_columns / get_table_options / struct-column profiling against a real
    Athena catalog is unverified.
  • The CVE was not reproduced, and I did not diff pyathena's own behaviour across the ten minor
    releases between 3.25 and 3.35 beyond the symbol check above. That gap is the main reason this
    is a draft.

Real-world exposure

The injection vector is DELETE and CTAS statement compilation. OpenMetadata's Athena connector
is read-only (metadata reflection via the Athena/Glue API plus SELECT for profiling), so it is
not obviously on the vulnerable path — but pyathena is also exposed to users through the profiler
and is a shipped dependency of the ingestion image, so a CVSS 9.3 SQL injection in it should not be
carried.

🤖 Generated with Claude Code

Greptile Summary

The PR upgrades PyAthena from the 3.25 release line to the security-fixed 3.35 release line.

  • Raises the minimum PyAthena version to 3.35.4 for Athena and test/development extras.
  • Documents the DELETE/CTAS SQL-injection vulnerability addressed by the new minimum.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or non-blocking defects identified in the dependency update.

The upgraded dependency requirements remain jointly satisfiable, the supported runtime is compatible, and available evidence does not establish a regression in the Athena connector paths.

Important Files Changed

Filename Overview
ingestion/setup.py Updates the shared PyAthena dependency declaration to the security-fixed 3.35.4 release line without creating a demonstrated resolver or compatibility conflict.

Reviews (1): Last reviewed commit: "fix(security): bump pyathena to 3.35.4" | 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]>
@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
@gitar-bot

gitar-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Bumps pyathena to 3.35.4 in ingestion/setup.py to address CVE-2026-65321 (critical SQL injection vulnerability). No issues found.

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

@karanh37
karanh37 marked this pull request as ready for review August 27, 2026 05:44
@karanh37
karanh37 requested a review from a team as a code owner August 27, 2026 05:44
Copilot AI lite review requested due to automatic review settings August 27, 2026 05:44

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@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.

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit ebc67043192525e5b4bfcd81007e2629fbbba735 in Playwright run 33043437110, attempt 1.

✅ 110 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 52m 43s

⏱️ Max setup 5m 11s · max shard execution 12m 30s · max shard-job elapsed before upload 22m 12s · reporting 3s

🌐 218.10 requests/attempt · 1.79 app boots/UI scenario · 0.00% common-shard skew

Optimization targets still in progress:

  • Browser traffic was 218.1 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 1.79 per UI scenario (216 boots / 121 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 46 0 0 0 0 0
✅ Shard ingestion-01 25 0 0 0 0 0
✅ Shard ingestion-02 39 0 0 0 0 0

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@harshsoni2024
harshsoni2024 added this pull request to the merge queue Aug 27, 2026
Merged via the queue into main with commit f10c8cb Aug 27, 2026
169 of 171 checks passed
@harshsoni2024
harshsoni2024 deleted the security/pyathena-3.35.4 branch August 27, 2026 12:13

This branch was previously deployed

1 inactive deployment
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.

3 participants