fix: patch OS-level CVEs in Docker image#8
Conversation
Patches fixable Snyk findings (critical/high/medium) from Debian 12 base image packages (sqlite3, gnutls, openssl, perl, pam, gnupg).
Greptile SummaryThis PR adds a single Key changes:
Considerations:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["FROM python:3.13.3-slim\n(Debian 12 Bookworm base)"] --> B
subgraph NEW ["🆕 New layer (this PR)"]
B["RUN apt-get update &&\napt-get upgrade -y &&\nrm -rf /var/lib/apt/lists/*\n\n→ Patches 25 CVEs (2 Critical, 6 High, 7 Medium)"]
end
B --> C["WORKDIR /app"]
C --> D["COPY backend/requirements.txt\nRUN pip install -r requirements.txt"]
D --> E["COPY backend /app/backend\nCOPY README.md / LICENSE"]
E --> F["ENV DELEGA_HOST / PORT / AUTH / DB_PATH"]
F --> G["VOLUME /app/data\nEXPOSE 18890\nHEALTHCHECK"]
G --> H["CMD: run migrations → start main.py"]
style NEW fill:#d4edda,stroke:#28a745,color:#000
Last reviewed commit: "fix: add apt-get upg..." |
Dockerfile
Outdated
| FROM python:3.13.3-slim | ||
|
|
||
| # Patch OS-level vulnerabilities in base image | ||
| RUN apt-get update && apt-get upgrade -y && rm -rf /var/lib/apt/lists/* |
There was a problem hiding this comment.
Set
DEBIAN_FRONTEND=noninteractive for non-interactive apt runs
Without DEBIAN_FRONTEND=noninteractive, certain packages (e.g. tzdata, libreadline) can trigger debconf configuration prompts during apt-get upgrade. The -y flag only handles yes/no confirmations — it does not suppress interactive debconf dialogs. This can cause the build to hang or produce unexpected behavior in CI environments.
| RUN apt-get update && apt-get upgrade -y && rm -rf /var/lib/apt/lists/* | |
| RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get upgrade -y && rm -rf /var/lib/apt/lists/* |
Per Greptile review — prevents debconf prompts from hanging the build in CI.
Summary
Adds
apt-get update && apt-get upgrade -yto the Dockerfile to patch fixable OS-level vulnerabilities in the Debian 12 base image.What this fixes
Snyk found 73 OS-level CVEs in
python:3.13.3-slim(Debian 12 Bookworm). 25 have upstream fixes available:The remaining 48 low-severity findings have no Debian fix available yet.
Why this is safe
apt-get upgradeonly installs patched versions of already-installed packages. No new packages added. Build stays reproducible with the pinnedpython:3.13.3-slimbase.