Skip to content

Commit 8dfc396

Browse files
committed
Patches public.ecr.aws/lambda/ruby:3.2
1 parent b24b93d commit 8dfc396

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

Dockerfile-ruby3.2-patched

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Builder
2+
# Use an official Go image that has the security fix (>=1.24.6).
3+
# We use -alpine to keep the builder stage small and fast.
4+
#
5+
# NOTE:
6+
# Remove this as soon as AWS deals with aws-lambda-rie vulnerabilities: CVE-2025-47907 and CVE-2025-4674
7+
# =================================================================
8+
9+
FROM golang:1.24.6-alpine AS gobuilder
10+
11+
# Install git, which is required to clone the source code repository.
12+
RUN apk add --no-cache git
13+
14+
# Set a working directory inside the builder stage.
15+
WORKDIR /src
16+
17+
# Clone the official source code for the AWS Lambda RIE.
18+
# It's good practice to clone a specific tag for reproducibility, but for this
19+
# purpose, cloning the main branch is sufficient.
20+
RUN git clone https://github.com/aws/aws-lambda-runtime-interface-emulator.git .
21+
22+
# Compile the RIE.
23+
# - CGO_ENABLED=0 creates a static binary with no C library dependencies.
24+
# - -ldflags="-s -w" strips debug symbols, making the binary smaller.
25+
# The output file will be named 'aws-lambda-rie'.
26+
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o aws-lambda-rie ./cmd/aws-lambda-rie
27+
28+
# ===========================================
29+
30+
31+
FROM public.ecr.aws/lambda/ruby:3.2
32+
33+
# --- FIX: Vulnerabilities ---
34+
# Copy the newly compiled, non-vulnerable 'aws-lambda-rie' binary
35+
# from our 'builder' stage. This overwrites the vulnerable version
36+
# located at /usr/local/bin/aws-lambda-rie in the base image.
37+
COPY --from=gobuilder /src/aws-lambda-rie /usr/local/bin/aws-lambda-rie
38+
39+
# CVE-2025-8194
40+
RUN yum update -y python3 python
41+
42+
# CVE-2025-24294
43+
RUN yum update -y ruby
44+
45+
# CVE-2025-43857
46+
# /var/lang/lib/ruby/gems/3.2.0/specifications/net-imap-0.3.8.gemspec
47+
# patching CVE-2025-43857
48+
RUN gem install 'net-imap:0.3.9' --default && \
49+
rm -f /var/lang/lib/ruby/gems/3.2.0/specifications/net-imap-0.3.8.gemspec && \
50+
gem uninstall 'net-imap:0.3.8'
51+
52+
# CVE-2025-6965
53+
RUN yum update -y sqlite
54+
55+
# GHSA-vrw8-fxc6-2r93
56+
# /usr/local/bin/aws-lambda-rie
57+
# golang / github.com/go-chi/chi / 1.5.5
58+
RUN echo "no fix available?"
59+
60+
# CVE-2025-24294
61+
# /var/lang/lib/ruby/gems/3.2.0/specifications/default/resolv-0.2.2.gemspec
62+
RUN gem install 'resolv:0.2.3' --default && \
63+
rm -f /var/lang/lib/ruby/gems/3.2.0/specifications/default/resolv-0.2.2.gemspec && \
64+
gem uninstall 'resolv:0.2.2'

0 commit comments

Comments
 (0)