Skip to content

Commit 530394b

Browse files
fix: replace third-party base image with AWS public ECR image (CVE-2026-31789) (#1250)
* fix: replace third-party base image with AWS public ECR image Switch Python container Dockerfile from ghcr.io/astral-sh/uv:python3.12-bookworm-slim to public.ecr.aws/docker/library/python:3.12-slim to remediate CVE-2026-31789 (OpenSSL). The uv binary is copied from the official image via multi-stage COPY --from. Constraint: Must preserve uv-based dependency management workflow Rejected: pip install uv | adds network call and slower builds Confidence: high Scope-risk: narrow * fix: address review — use pip install uv, fix import command, update docs - Replace COPY --from with pip install uv==0.11.14 to fully eliminate third-party image pull at build time - Update agentcore import Dockerfile generation to use AWS ECR base image - Update docs/container-builds.md to reflect new base image setup Constraint: No AWS-hosted uv binary available; pip install is the cleanest path Confidence: high Scope-risk: narrow * fix: pin python base image to bookworm for reproducible builds Pin to python:3.12-slim-bookworm to prevent silent OS upgrade when Debian Trixie becomes the default slim tag. Confidence: high Scope-risk: narrow * fix: unpin uv version — install latest via pip uv is a single static binary with no OS dependencies, so pinning provides little security value while requiring periodic bumps. Confidence: high Scope-risk: narrow
1 parent a8e9a1e commit 530394b

4 files changed

Lines changed: 13 additions & 5 deletions

File tree

docs/container-builds.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ app/MyAgent/
3939

4040
## Generated Dockerfile
4141

42-
The template uses `ghcr.io/astral-sh/uv:python3.12-bookworm-slim` as the base image with these design choices:
42+
The template uses `public.ecr.aws/docker/library/python:3.12-slim` as the base image (with `uv` installed via
43+
`pip install uv`) with these design choices:
4344

4445
- **Layer caching**: Dependencies (`pyproject.toml`) are installed before copying application code
4546
- **Non-root**: Runs as `bedrock_agentcore` (UID 1000)

src/assets/__tests__/__snapshots__/dockerfile-render.test.ts.snap

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

33
exports[`Dockerfile enableOtel rendering > renders opentelemetry-instrument CMD when enableOtel is true > Dockerfile-enableOtel-true 1`] = `
4-
"FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
4+
"FROM public.ecr.aws/docker/library/python:3.12-slim-bookworm
5+
6+
RUN pip install --no-cache-dir uv
57
68
ARG UV_DEFAULT_INDEX
79
ARG UV_INDEX
@@ -39,7 +41,9 @@ CMD ["opentelemetry-instrument", "python", "-m", "main"]
3941
`;
4042

4143
exports[`Dockerfile enableOtel rendering > renders plain python CMD when enableOtel is false > Dockerfile-enableOtel-false 1`] = `
42-
"FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
44+
"FROM public.ecr.aws/docker/library/python:3.12-slim-bookworm
45+
46+
RUN pip install --no-cache-dir uv
4347
4448
ARG UV_DEFAULT_INDEX
4549
ARG UV_INDEX

src/assets/container/python/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
1+
FROM public.ecr.aws/docker/library/python:3.12-slim-bookworm
2+
3+
RUN pip install --no-cache-dir uv
24

35
ARG UV_DEFAULT_INDEX
46
ARG UV_INDEX

src/cli/commands/import/actions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,8 @@ export async function handleImport(options: ImportOptions): Promise<ImportResult
383383
fs.writeFileSync(
384384
destDockerfile,
385385
[
386-
'FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim',
386+
'FROM public.ecr.aws/docker/library/python:3.12-slim-bookworm',
387+
'RUN pip install --no-cache-dir uv',
387388
'WORKDIR /app',
388389
'',
389390
'ENV UV_SYSTEM_PYTHON=1 \\',

0 commit comments

Comments
 (0)