chore(deps): Bump sqlparse to 0.6.0 to clear pip-audit findings - #120
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour. 📝 WalkthroughWalkthroughThe pull request updates the Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to This dependency-only update and cleanup are merge-ready after normal checks; no actionable merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
Comment |
|
📦 Python package built successfully!
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #120 +/- ##
=======================================
Coverage 74.46% 74.46%
=======================================
Files 95 95
Lines 5707 5707
Branches 851 851
=======================================
Hits 4250 4250
Misses 1180 1180
Partials 277 277
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
|
🚀 Review App Deployment Started
|
sqlparse 0.5.5 is affected by four advisories, all fixed only in 0.6.0: PYSEC-2026-3696 codegen escaping breakout in the python/php output filters PYSEC-2026-3697 quadratic group_comments (comment-only statements) PYSEC-2026-3698 ReDoS in the dollar-quoted literal lexer PYSEC-2026-3699 TokenList.__init__ flattens the subtree per group sqlparse is a direct dependency, so this bumps its constraint in place rather than adding an entry to the transitive security-constraint block. Nothing else caps it below 0.6.0 (google-cloud-spanner asks for >=0.4.4), so the lock moves sqlparse alone. Also drops two ignore-vulns entries that no longer match any pinned version: PYSEC-2023-121 (zstd) and CVE-2026-0994 (protobuf). The pyarrow entries stay - they still apply to pyarrow 16.1.0 on Python 3.10/3.11. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QSHPq7nj9cJD8XVPesADtA
c0d036d to
90e4f13
Compare
Summary
pip-auditwas failing on four new advisories insqlparse0.5.5, all fixed only in 0.6.0. Unlike the previous audit PRs,sqlparseis a direct dependency (# SQL templating,pyproject.toml:85) and the repo's own<0.6cap was what blocked the fix — so this bumps that constraint in place rather than adding an entry to the transitive security-constraint block.The lock moves
sqlparseand nothing else.Changes
pyproject.toml— direct constraint bump# SQL templating "jinja2>=3.1.6,<4", - "sqlparse>=0.4.4,<0.6", + "sqlparse>=0.6.0,<0.7", "pymysql>=1.1.1,<1.2",<0.7follows the floor-plus-one-minor style used for the other security bumps (cryptography>=50.0.0,<51).poetry.lock— one package moved.github/workflows/ci.yml— drop two dead ignore entrieszstd 1.5.7.2andprotobuf 5.29.6now return zero advisories at every pinned version across all Python marker branches, so those two suppressions matched nothing. The twopyarrowentries are retained — they still apply topyarrow 16.1.0on Python 3.10/3.11.Why
<0.6was there, and why it's safe to liftThe cap was never about 0.6 — 0.6.0 did not exist when it was written. It dates from the open-source commit
8b2941b(2025-10-30), when the newest sqlparse was 0.5.3; 0.6.0 shipped 2026-08-13. The line was untouched in between:So it was a routine next-minor ceiling for a 0.x package, matching the repo's other 0.x caps (
db-dtypes<1.4,clickhouse-sqlalchemy<0.4,pyathena<4). That caution was earned — this repo was bitten by a sqlparse bump before:0.5.4 introduced
MAX_GROUPING_TOKENS=10000, which broke wide analytical queries;configure_sqlparse_limits()exists because of that incident. Worth noting that CVE-2026-54284 was fixed insqlparse/sql.py, not by touching the caps —MAX_GROUPING_TOKENS/MAX_GROUPING_DEPTHkeep the same names, module, defaults andis not Nonesemantics in 0.6.0, so the #77 workaround is unaffected.The only breaking change declared in the 0.6.0 CHANGELOG is dropping Python 3.8/3.9; this repo is
requires-python = ">=3.10.0,<3.14".tokens.pyandexceptions.pyare byte-identical between the two versions, andsqlparse.parsekeeps its signature.Per-advisory assessment
Entry point for all of these is
sql_execution.py:78, which callsunchain_sql_query()on raw cell text before Jinja rendering — so the parser sees the SQL first, ahead of validation and any DB connection. One cell execution parses the same text several times (sql_query_chaining.py:15,26,73,132,207,sql_execution.py:209,sql_caching.py:35), multiplying any per-parse cost.CVE-2026-59894
python/phpoutput filters let crafted SQL break out of the generated string literalsqlparse.format(..., output_format=...)— zero hits foroutput_format,OutputPythonFilter,OutputPHPFilteracrossdeepnote_toolkit/,deepnote_core/,installer/,tests/.google-cloud-spannercallssqlparse.format(query, strip_comments=True)only (spanner_dbapi/parse_utils.py:197,228), not the codegen filters. Fixed as a side effect of the bump.CVE-2026-71491
group_commentsis O(n²) on comment-only statements; reachable viasqlparse.parse()andformat(strip_comments=True)parse()sites and spanner'sstrip_comments=Truepath are exposed.CVE-2026-59893
keywords.py:33, backreference\1)filter_stack.py(:31tokenize →:41group), so the grouping caps provide zero mitigation even at their strictest setting. Dialect-irrelevant:sqlparseloads every keyword dict into one process-wide regex list and the repo never passes dialect info.CVE-2026-54284
TokenList.__init__flattens the whole subtree per group, burning CPU before the depth/token caps tripMeasured impact (0.5.5 → 0.6.0)
Same machine, limits configured exactly as the toolkit sets them at runtime (
MAX_GROUPING_TOKENS=None,MAX_GROUPING_DEPTH=None— seesql_utils.py:32-33, applied byruntime_initialization.py:58):parse— 3697format(strip_comments=True)— 3697$t<i>$openers (61 KB) — 3698parse— 3699All three DoS advisories show the same shape: quadratic on 0.5.5, linear on 0.6.0.
Known behavior change (not a blocker)
0.6.0 promotes
MATERIALIZEDandROW_FORMATto reserved keywords.extract_table_reference_from_token(sql_query_chaining.py:59-63) discardsKeyword-typed tokens, so a SQL block whose variable name is exactlymaterializedorrow_formatsilently stops being chained viafind_query_preview_references:The unit suite does not cover this. It is a pre-existing class of limitation — a block named
selectorcasefails identically on 0.5.5 today; the reserved-word list just grew by two. Fixing it properly means not discarding keyword tokens in theexpect_tableposition, which is a behavior change beyond this PR. Worth knowing if someone reports a chaining break after this lands.Follow-up on the disabled grouping caps (unchanged by this PR): #121.
🤖 Generated with Claude Code
https://claude.ai/code/session_01QSHPq7nj9cJD8XVPesADtA