Skip to content

Commit 1300ec3

Browse files
committed
fix: replace COPY . . with explicit directory copies in Dockerfile
- Replace insecure COPY . . with explicit COPY src/ and COPY data/config/ - Prevents copying sensitive files (.env, secrets, git, tests, docs) - Addresses CWE-668 and CWE-497 security vulnerabilities - Maintains .dockerignore as defense-in-depth measure
1 parent 4028e94 commit 1300ec3

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,12 @@ RUN apt-get update && apt-get install -y \
6666
COPY --from=backend-deps /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
6767
COPY --from=backend-deps /usr/local/bin /usr/local/bin
6868

69-
# Copy application code
70-
# Security: .dockerignore ensures sensitive files (.env, secrets, git, etc.) are excluded
71-
# Only files not in .dockerignore will be copied to the container
72-
COPY . .
69+
# Copy application code (explicitly copy only necessary directories)
70+
# Security: Explicitly copy only required source code to prevent sensitive data exposure
71+
# .dockerignore provides additional protection as a defense-in-depth measure
72+
COPY src/ ./src/
73+
# Copy guardrails configuration (required for NeMo Guardrails)
74+
COPY data/config/guardrails/ ./data/config/guardrails/
7375

7476
# Build arguments for version injection
7577
ARG VERSION=0.0.0

0 commit comments

Comments
 (0)