Skip to content

Fixes-34840: remove compilers from ingestion-base, keep DB2 clidriverVersion working - #34839

Merged
harshsoni2024 merged 1 commit into
mainfrom
fix/remove-compiler-libs
Oct 8, 2026
Merged

harshsoni2024 merged 1 commit into
mainfrom
fix/remove-compiler-libs

Conversation

@harshsoni2024

@harshsoni2024 harshsoni2024 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes ##34840

Removes the C/C++ toolchain from ingestion-base (and images built on it). That clears CVE-2026-95619 / CVE-2026-102010 (libstdc++, no Debian fix yet) from every gcc package except the 4 runtime libraries that must stay. DB2 clidriverVersion is reworked so it no longer needs a compiler at runtime.

  • Dockerfile, Dockerfile.ci: purge build-essential gcc in the final root stage, after the last compiling pip install; autoremove drops the rest. Kept: libstdc++6, libgcc-s1, gcc-14-base, libgomp1 (numba's OpenMP layer in downstream images), xz-utils, bzip2. The build fails if a compiler package survives or a compiled module (MySQLdb, psycopg2, kerberos, _mysql_connector, ibm_db) stops importing. The remaining gcc runtime libs are upgraded once Debian ships a fix.
  • db2/utils.py: clidriverVersion ran pip install ibm_db --no-binary :all: at connection time. It now downloads the requested clidriver (IBM, then GitHub mirror) and swaps it in under the prebuilt ibm_db. No pip, no compiler.
  • basedpyright baseline: drops 4 entries for errors in the removed DB2 code.

Type of change:

  • Improvement

High-level design:

  • Why the swap works: the ibm_db 3.3.0 extension loads libdb2.so.1 via RUNPATH $ORIGIN/clidriver/lib. All 48 CLI functions it uses exist in clidriver 11.1.4 through 12.1.4.
  • clidriverVersion behaviour changes:
    • ibm_db stays 3.3.0 (it was downgraded to 3.2.x).
    • A failed download or swap keeps the bundled driver. Before, ibm_db was left uninstalled, which broke every DB2 service in a long-lived container.
  • Overlayfs: the swap uses shutil.move, because overlayfs refuses to rename a directory from a lower image layer (EXDEV).
  • Compatibility: images built FROM ingestion-base that compile C extensions must now install build-essential themselves.
  • Rollout: the image installs openmetadata-ingestion from PyPI, so both changes must ship in the same release. Backport to 2.0 for 2.0.5.

Tests:

Use cases covered

  • DB2 without clidriverVersion, and with 11.1.4, 11.5.9 (plus license) and 12.1.0. A plain DB2 service still works after a version switch in the same container.
  • The image builds and every connector module imports without a compiler.

Unit tests

  • ingestion/tests/unit/source/database/db2/test_clidriver.py covers: swap without pip, GitHub fallback, failed download, archive without a driver, rollback on a failed swap, overlayfs EXDEV, Windows zip, unsupported platform, no ibm_db, and the platform-to-archive mapping. The once-per-process, retry, version-change and concurrency tests are kept.
  • Coverage: 97% of the new clidriver code (67/69 lines).

Ingestion integration tests

  • Not applicable.

Manual testing performed

  1. Full arm64 build of Dockerfile.ci: the purge and import gate ran. 4 gcc runtime libs remain, no compiler, and 305/305 connector modules import.
  2. The new final stage on top of published ingestion-base:2.0.4 (amd64 and arm64): 292/292 imports, and ldd output is identical to the original image.
  3. DB2 through Db2Connection on the compiler-free amd64 image: default (v12.1.4), 11.5.9 with a license, 11.1.4 and 12.1.0 each load the requested driver (SQL30081N against a closed port). ibm_db stays 3.3.0.
  4. A downstream image that adds Prophet, numba and scikit-learn on the purged base builds and runs.
  5. Trivy (amd64, OS packages): 2,085 → 1,499 findings (−586: 552 Low from binutils, 34 Medium from the two GCC CVEs). The GCC CVEs drop from 21 packages to 4.

Not tested: a real DB2 server, and a full amd64 build.

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • I have added tests around the new logic.

CVE-2026-95619 and CVE-2026-102010 (libstdc++) are reported on all 21
src:gcc-14 binaries in ingestion-base, and the compilers are build-only.

- Dockerfile, Dockerfile.ci: purge build-essential and gcc in the final
  root stage, after the last compiling pip install; autoremove drops the
  rest (39 packages on amd64, 38 on arm64). Keep libstdc++6, libgcc-s1,
  gcc-14-base, libgomp1, xz-utils and bzip2. Fail the build if a compiler
  survives or MySQLdb, psycopg2, kerberos, _mysql_connector or ibm_db stop
  importing. Upgrade the remaining gcc runtime libs so Debian's fix ships
  on the next build.
- DB2: clidriverVersion rebuilt ibm_db from source at connection time,
  which needs gcc. Download the requested clidriver (IBM, then its GitHub
  mirror) and swap it in under the prebuilt ibm_db instead. A failed
  download or swap keeps the bundled driver.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
@harshsoni2024
harshsoni2024 requested a review from a team as a code owner October 7, 2026 11:18
@harshsoni2024
harshsoni2024 requested review from TeddyCr and a balanced review from Copilot October 7, 2026 11:18

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

github-actions Bot commented Oct 7, 2026

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 Ingestion safe to test Add this label to run secure Github workflows on PRs labels Oct 7, 2026
@harshsoni2024 harshsoni2024 changed the title Fixes (ingesiton): remove compilers from ingestion-base, keep DB2 clidriverVersion working Fixes(ingesiton): remove compilers from ingestion-base, keep DB2 clidriverVersion working Oct 7, 2026
@gitar-bot

gitar-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Removing compilers from ingestion-base and swapping DB2 driver archives at runtime could break downstream native-extension builds or DB2 connectivity if compatibility assumptions fail.

Removes the C/C++ compiler toolchain from ingestion-base and downstream images, clearing two GCC CVEs while keeping essential runtime libraries. DB2 clidriverVersion is reworked to download and swap CLI drivers at runtime without requiring compilation. The image builds successfully with all 305 connector modules importing, and manual testing confirms DB2 connections work across multiple driver versions. No issues found.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

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

@harshsoni2024 harshsoni2024 changed the title Fixes(ingesiton): remove compilers from ingestion-base, keep DB2 clidriverVersion working Fixes-34840: remove compilers from ingestion-base, keep DB2 clidriverVersion working Oct 7, 2026
@harshsoni2024
harshsoni2024 added this pull request to the merge queue Oct 8, 2026
Merged via the queue into main with commit d6265fe Oct 8, 2026
85 of 91 checks passed
@harshsoni2024
harshsoni2024 deleted the fix/remove-compiler-libs branch October 8, 2026 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion 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