feat: Migrate to UBI 9 base images for enterprise compliance and security improvements#1714
Conversation
…ions and removing runtime pip
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughMigrates backend, frontend, and Langflow Dockerfiles to Red Hat UBI9 bases; adds a frontend multi-stage build and frontend dependency overrides; targets Python 3.12 in tooling and dependencies; switches runtime privilege-drop to runuser-style; and makes Langflow/OpenShift filesystem, entrypoint, and Helm env changes. ChangesUBI9 Migration and OpenShift Container Orchestration
🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
Dockerfile.backend (2)
120-121: 💤 Low valueStale comment contradicts the change.
The note says the entrypoint "may need to be updated to use 'runuser' instead of 'gosu'", but
scripts/backend-entrypoint.shalready usesrunuser. Drop this line to avoid confusion.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Dockerfile.backend` around lines 120 - 121, The Dockerfile.backend contains a stale comment suggesting the entrypoint may need to switch from 'gosu' to 'runuser' even though scripts/backend-entrypoint.sh already uses runuser; remove that note/comment from Dockerfile.backend to avoid confusion and keep docs consistent with the actual entrypoint implementation (reference Dockerfile.backend and scripts/backend-entrypoint.sh).
9-9: ⚡ Quick winPin base images instead of
:latestfor reproducible builds.
:latestmakes builds non-deterministic and undermines the CVE-remediation intent of this PR (a future rebuild can silently pull a different OS layer). Prefer a versioned tag or, ideally, a digest. The same applies toDockerfile.frontendandDockerfile.langflow.Also applies to: 62-62
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Dockerfile.backend` at line 9, The Dockerfiles currently use the floating tag "registry.access.redhat.com/ubi9/python-311:latest" (and similar ":latest" in Dockerfile.frontend and Dockerfile.langflow), which makes builds non-reproducible; update each FROM instruction to pin a specific versioned tag or, preferably, an immutable digest (sha256) for the base image (replace "registry.access.redhat.com/ubi9/python-311:latest" with a concrete tag or digest), and do the same for the FROM lines in Dockerfile.frontend and Dockerfile.langflow so future rebuilds pull an identical OS layer.Dockerfile.frontend (1)
56-63: ⚡ Quick winWildcard
COPYglobs won’t abort here.The runtime
COPY ... next.config.* / postcss.config.* / tailwind.config.* / biome.json*won’t fail in this repo because those files exist infrontend/andDockerfile.frontendcopiesfrontend/into/opt/app-root/srcin the builder stage before the runtime copies occur.Optional:
biome.jsonis only used by the biome lint/format scripts (not bynext start), so thebiome.json*runtimeCOPYcould be removed to slim the image.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Dockerfile.frontend` around lines 56 - 63, The runtime Dockerfile COPY lines using wildcards (the COPY --from=builder ... next.config.* postcss.config.* tailwind.config.* biome.json* entries) can silently succeed if files are missing; update Dockerfile.frontend to either copy exact filenames (e.g., next.config.js/ts, postcss.config.js, tailwind.config.js) instead of globs so missing files cause a build error, and remove the runtime COPY of biome.json* (it’s only used for lint/format) to slim the image. Locate the COPY entries shown in the diff and replace the wildcard copies with explicit file names or drop the biome.json* COPY.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/langflow-entrypoint.py`:
- Around line 44-46: The unconditional privilege drop in langflow-entrypoint.py
(os.setgid(1000); os.setuid(1000)) fails for non-root OpenShift UIDs; guard
these calls by checking the effective UID first (use os.geteuid() == 0) and only
call os.setgid and os.setuid when running as root (optionally log or handle
PermissionError around the calls for safety), so modify the block containing
os.setgid/os.setuid to execute only under that root check.
---
Nitpick comments:
In `@Dockerfile.backend`:
- Around line 120-121: The Dockerfile.backend contains a stale comment
suggesting the entrypoint may need to switch from 'gosu' to 'runuser' even
though scripts/backend-entrypoint.sh already uses runuser; remove that
note/comment from Dockerfile.backend to avoid confusion and keep docs consistent
with the actual entrypoint implementation (reference Dockerfile.backend and
scripts/backend-entrypoint.sh).
- Line 9: The Dockerfiles currently use the floating tag
"registry.access.redhat.com/ubi9/python-311:latest" (and similar ":latest" in
Dockerfile.frontend and Dockerfile.langflow), which makes builds
non-reproducible; update each FROM instruction to pin a specific versioned tag
or, preferably, an immutable digest (sha256) for the base image (replace
"registry.access.redhat.com/ubi9/python-311:latest" with a concrete tag or
digest), and do the same for the FROM lines in Dockerfile.frontend and
Dockerfile.langflow so future rebuilds pull an identical OS layer.
In `@Dockerfile.frontend`:
- Around line 56-63: The runtime Dockerfile COPY lines using wildcards (the COPY
--from=builder ... next.config.* postcss.config.* tailwind.config.* biome.json*
entries) can silently succeed if files are missing; update Dockerfile.frontend
to either copy exact filenames (e.g., next.config.js/ts, postcss.config.js,
tailwind.config.js) instead of globs so missing files cause a build error, and
remove the runtime COPY of biome.json* (it’s only used for lint/format) to slim
the image. Locate the COPY entries shown in the diff and replace the wildcard
copies with explicit file names or drop the biome.json* COPY.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: aa06ad01-1764-45ec-8a98-29f5b5d335a4
⛔ Files ignored due to path filters (2)
frontend/package-lock.jsonis excluded by!**/package-lock.jsonuv.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
.dockerignoreDockerfile.backendDockerfile.frontendDockerfile.langflowfrontend/package.jsonpyproject.tomlscripts/backend-entrypoint.shscripts/langflow-entrypoint.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Dockerfile.langflow (1)
9-15:⚠️ Potential issue | 🟠 Major | ⚡ Quick winRemove build-only toolchain from the final runtime image.
git,gcc,gcc-c++, andmakeare left installed after SQLite build, which unnecessarily expands runtime attack surface and vulnerability footprint. Keep them only for build, then uninstall before finalizing the layer.🔧 Suggested hardening
-RUN dnf install -y --allowerasing \ +RUN dnf install -y --allowerasing \ git \ gcc \ gcc-c++ \ make \ ca-certificates \ - && dnf clean all + && dnf clean all @@ RUN curl -L https://www.sqlite.org/2024/sqlite-autoconf-3460000.tar.gz | tar -xz \ && cd sqlite-autoconf-3460000 \ && ./configure --prefix=/usr --libdir=/usr/lib64 \ && make -j$(nproc) install \ && cd .. \ - && rm -rf sqlite-autoconf-3460000 + && rm -rf sqlite-autoconf-3460000 \ + && dnf remove -y git gcc gcc-c++ make \ + && dnf clean allAlso applies to: 17-24
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Dockerfile.langflow` around lines 9 - 15, The runtime image currently keeps build-only packages (git, gcc, gcc-c++, make) after building SQLite; remove them or move the build into a separate stage. Modify the Dockerfile RUN that installs "git gcc gcc-c++ make ca-certificates" so that either (a) you perform the SQLite build in a dedicated builder stage and only copy the resulting artifacts into the final stage, or (b) uninstall build packages immediately after build with dnf remove git gcc gcc-c++ make && dnf clean all (preserving ca-certificates), ensuring only runtime dependencies remain; apply the same change for the other install block that contains those packages.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@Dockerfile.langflow`:
- Around line 9-15: The runtime image currently keeps build-only packages (git,
gcc, gcc-c++, make) after building SQLite; remove them or move the build into a
separate stage. Modify the Dockerfile RUN that installs "git gcc gcc-c++ make
ca-certificates" so that either (a) you perform the SQLite build in a dedicated
builder stage and only copy the resulting artifacts into the final stage, or (b)
uninstall build packages immediately after build with dnf remove git gcc gcc-c++
make && dnf clean all (preserving ca-certificates), ensuring only runtime
dependencies remain; apply the same change for the other install block that
contains those packages.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 53c2333a-8d12-42a3-9f90-f0e7f994cedb
📒 Files selected for processing (1)
Dockerfile.langflow
c28b2d0
into
langflow-ai:fix/ubi9_images
…rity improvements (#1714) * feat: migrate to UBI 9 base images for enterprise compliance * fix: update scripts/backend-entrypoint.sh for UBI9 compliance * fix: changed microdnf to dnf for ubi9 compatability * fix: Added --allowerasing flag to resolve curl-minimal conflict * fix: updated files * fix: mitigate backend and frontend CVEs by tightening dependency versions and removing runtime pip * fix: remediate frontend CVE dependency overrides and harden backend runtime image * fix: remediate dependency CVEs and reduce runtime image surface * fix: harden backend and frontend runtime images for CVE remediation * fix: apply comprehensive CVE fixes for backend and frontend containers * fix: explicitly copy package-lock.json to resolve npm ci build failure * fix: allow package.json and package-lock.json in Docker build context * fix: resolve CVEs across backend and frontend containers * fix: resolve CVE's * fix: resolve OSS CVE's * fix: resolve frontend CVEs * fix: upgrade system packages and nodemon dependencies to resolve issues * fix: add pysqlite3-binary to resolve SQLite version incompatibility * fix: resolved sqlite error * Update scripts/langflow-entrypoint.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: fixed path issues * Update Dockerfile.langflow Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: resolve UBI9 mem0 permission crash, preserve entrypoint, and pin base images * fix: UBI9 mem0 crash * fix: resolved dotenv issue * Fixed permission and wheel issue with langflow and backend * style: ruff autofix (auto) * changed langflow to 1.9.6.rc0 * fix image version * Reduce images size --------- Co-authored-by: Gautham N Pai <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Lucas Oliveira <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
…rity improvements (#1738) * feat: Migrate to UBI 9 base images for enterprise compliance and security improvements (#1714) * feat: migrate to UBI 9 base images for enterprise compliance * fix: update scripts/backend-entrypoint.sh for UBI9 compliance * fix: changed microdnf to dnf for ubi9 compatability * fix: Added --allowerasing flag to resolve curl-minimal conflict * fix: updated files * fix: mitigate backend and frontend CVEs by tightening dependency versions and removing runtime pip * fix: remediate frontend CVE dependency overrides and harden backend runtime image * fix: remediate dependency CVEs and reduce runtime image surface * fix: harden backend and frontend runtime images for CVE remediation * fix: apply comprehensive CVE fixes for backend and frontend containers * fix: explicitly copy package-lock.json to resolve npm ci build failure * fix: allow package.json and package-lock.json in Docker build context * fix: resolve CVEs across backend and frontend containers * fix: resolve CVE's * fix: resolve OSS CVE's * fix: resolve frontend CVEs * fix: upgrade system packages and nodemon dependencies to resolve issues * fix: add pysqlite3-binary to resolve SQLite version incompatibility * fix: resolved sqlite error * Update scripts/langflow-entrypoint.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: fixed path issues * Update Dockerfile.langflow Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: resolve UBI9 mem0 permission crash, preserve entrypoint, and pin base images * fix: UBI9 mem0 crash * fix: resolved dotenv issue * Fixed permission and wheel issue with langflow and backend * style: ruff autofix (auto) * changed langflow to 1.9.6.rc0 * fix image version * Reduce images size --------- Co-authored-by: Gautham N Pai <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Lucas Oliveira <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> * fixed documents.ts * update timeout on tests * fixed frontend image * chore: update uv.lock files after version bump * fix coderabbit * fix dockerfile langflow and deployment * fix cves * fix frontend docker * fixed frontend vulnerability and langflow not working * fix dockerfile langflow and entrypoint removing all unnecessary changes * fix langflow dockerfile * style: ruff autofix (auto) * revert deployment and fix backend --------- Co-authored-by: Gautham N Pai <[email protected]> Co-authored-by: Gautham N Pai <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Edwin Jose <[email protected]>
* feat: Migrate to UBI 9 base images for enterprise compliance and security improvements (#1714) * feat: migrate to UBI 9 base images for enterprise compliance * fix: update scripts/backend-entrypoint.sh for UBI9 compliance * fix: changed microdnf to dnf for ubi9 compatability * fix: Added --allowerasing flag to resolve curl-minimal conflict * fix: updated files * fix: mitigate backend and frontend CVEs by tightening dependency versions and removing runtime pip * fix: remediate frontend CVE dependency overrides and harden backend runtime image * fix: remediate dependency CVEs and reduce runtime image surface * fix: harden backend and frontend runtime images for CVE remediation * fix: apply comprehensive CVE fixes for backend and frontend containers * fix: explicitly copy package-lock.json to resolve npm ci build failure * fix: allow package.json and package-lock.json in Docker build context * fix: resolve CVEs across backend and frontend containers * fix: resolve CVE's * fix: resolve OSS CVE's * fix: resolve frontend CVEs * fix: upgrade system packages and nodemon dependencies to resolve issues * fix: add pysqlite3-binary to resolve SQLite version incompatibility * fix: resolved sqlite error * Update scripts/langflow-entrypoint.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: fixed path issues * Update Dockerfile.langflow Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: resolve UBI9 mem0 permission crash, preserve entrypoint, and pin base images * fix: UBI9 mem0 crash * fix: resolved dotenv issue * Fixed permission and wheel issue with langflow and backend * style: ruff autofix (auto) * changed langflow to 1.9.6.rc0 * fix image version * Reduce images size --------- Co-authored-by: Gautham N Pai <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Lucas Oliveira <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> * fixed documents.ts * update timeout on tests * fixed frontend image * chore: update uv.lock files after version bump * fix coderabbit * fix dockerfile langflow and deployment * fix cves * fix frontend docker * fixed frontend vulnerability and langflow not working * fix dockerfile langflow and entrypoint removing all unnecessary changes * fix langflow dockerfile * style: ruff autofix (auto) * revert deployment and fix backend * Update uv.lock * fix * revert TS SDK to release-cpd; The branch carried the SDK half of #1666 (filter_id delete/search scoping) without the backend half, so the two new Knowledge Filters integration tests failed (HTTP 422, unscoped results). Reset documents.ts, types.ts and integration.test.ts to match release-cpd --------- Co-authored-by: Gautham N Pai <[email protected]> Co-authored-by: Gautham N Pai <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Lucas Oliveira <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Summary by CodeRabbit
Chores
Bug Fixes