Skip to content

Commit 47e1f5f

Browse files
Merge pull request #26 from SumoLogic/sumo_270861
Sumo 270861: Enhacement extension for CVE fixes
2 parents a09c8a5 + bc45135 commit 47e1f5f

24 files changed

+344
-247
lines changed

.github/workflows/unittest.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
name: build-and-test
44

5+
permissions:
6+
id-token: write
7+
contents: read
58
# Controls when the action will run. Triggers the workflow on push or pull request
69
# events but only for the main branch
710
on:
@@ -23,10 +26,18 @@ jobs:
2326
- name: Setup Go environment
2427
uses: actions/setup-go@v5
2528
with:
26-
go-version: 1.22
29+
go-version: 1.24
2730

2831
- name: Checking compilation errors while generating image
2932
run: env GOOS=linux go build -o "sumologic-extension" "lambda-extensions/sumologic-extension.go"
3033

34+
- name: Configure AWS credentials via OIDC and IAM Role
35+
uses: aws-actions/configure-aws-credentials@v4
36+
with:
37+
role-to-assume: arn:aws:iam::956882708938:role/LambdaExtensionPublishRole
38+
aws-region: us-east-1
39+
3140
- name: Run Unit Tests
41+
env:
42+
AWS_REGION: us-east-1
3243
run: go test ./...

containerimageexample/python-arm64/Dockerfile

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
11
# Define global args
22
ARG FUNCTION_DIR="app"
3-
ARG RUNTIME_VERSION="3.9"
4-
ARG DISTRO_VERSION="3.12"
5-
3+
ARG RUNTIME_VERSION="3.13.7"
64
# Stage 1 - bundle base image + runtime
7-
# Grab a fresh copy of the ARM 64 based image and install GCC
8-
FROM arm64v8/python:${RUNTIME_VERSION}-alpine${DISTRO_VERSION} AS python-alpine
9-
# Install GCC (Alpine uses musl but we compile and link dependencies with GCC)
10-
RUN apk add --no-cache \
11-
libstdc++
5+
# Grab a fresh copy of the ARM 64 based image
6+
FROM arm64v8/python:${RUNTIME_VERSION}-slim-bookworm AS python-slim-bookworm
127

138
# Stage 2 - build function and dependencies
14-
FROM python-alpine AS build-image
9+
FROM python-slim-bookworm AS build-image
1510
# Install aws-lambda-cpp build dependencies
16-
RUN apk add --no-cache \
17-
build-base \
18-
libtool \
19-
autoconf \
20-
automake \
21-
libexecinfo-dev \
22-
make \
23-
cmake \
24-
libcurl
11+
RUN apt-get update && \
12+
apt-get install -y \
13+
g++ \
14+
make \
15+
cmake \
16+
unzip \
17+
libcurl4-openssl-dev
18+
2519
# Include global args in this stage of the build
2620
ARG FUNCTION_DIR
2721
ARG RUNTIME_VERSION
@@ -36,7 +30,7 @@ RUN pip install awslambdaric --target ${FUNCTION_DIR}
3630

3731
# Stage 3 - final runtime image
3832
# Grab a fresh copy of the Python image
39-
FROM python-alpine
33+
FROM python-slim-bookworm
4034
# Include global arg in this stage of the build
4135
ARG FUNCTION_DIR
4236
# Set working directory to function root directory it also creates the directory and cd to that directory
@@ -45,8 +39,10 @@ WORKDIR ${FUNCTION_DIR}
4539
COPY --from=build-image ${FUNCTION_DIR} ./
4640
# (Optional) Add Lambda Runtime Interface Emulator and use a script in the ENTRYPOINT for simpler local runs
4741
ADD https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie /usr/bin/aws-lambda-rie
42+
# Create the directory explicitly
43+
RUN mkdir -p /opt/extensions
4844
# SumoLogic Lambda extension
49-
ADD sumologic-extension-arm64.tar.gz /opt/
45+
COPY extensions/sumologic-extension /opt/extensions/
5046
COPY entry.sh /
5147
RUN chmod 755 /usr/bin/aws-lambda-rie /entry.sh
5248
ENTRYPOINT [ "/entry.sh" ]
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
docker build -t lambda/hello-world-python:3.9-alpine3.12 .
1+
docker build --platform=linux/arm64 -t lambda/hello-world-python:3.13.7-slim-bookworm .
22

33
## Command to run container
4-
# docker run -p 9000:8080 lambda/hello-world-python:3.9-alpine3.12
4+
# docker run -p 9000:8080 lambda/hello-world-python:3.13.7-slim-bookworm
55

66
## Command to test
77
# curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'
88

99
## Command to push image
1010
ACCOUNT_ID=956882708938
11-
aws ecr create-repository --repository-name hello-world-python-arm64 --image-scanning-configuration scanOnPush=true
12-
docker tag lambda/hello-world-python:3.9-alpine3.12 "${ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/"hello-world-python-arm64:latest
11+
#aws ecr create-repository --repository-name hello-world-python-arm64 --image-scanning-configuration scanOnPush=true
12+
docker tag lambda/hello-world-python:3.13.7-slim-bookworm "${ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/"hello-world-python-arm64:latest
1313
aws ecr get-login-password | docker login --username AWS --password-stdin "${ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com"
1414
docker push "${ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/hello-world-python-arm64:latest"
Binary file not shown.
Binary file not shown.
Binary file not shown.

go.mod

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
11
module github.com/SumoLogic/sumologic-lambda-extensions
22

3-
go 1.22
3+
go 1.24.0
4+
5+
toolchain go1.24.1
46

57
require (
6-
github.com/aws/aws-sdk-go v1.51.25
7-
github.com/aws/aws-sdk-go-v2 v1.26.1
8-
github.com/aws/aws-sdk-go-v2/config v1.27.11
9-
github.com/aws/aws-sdk-go-v2/service/kms v1.31.0
8+
github.com/aws/aws-sdk-go-v2 v1.39.1
9+
github.com/aws/aws-sdk-go-v2/config v1.31.10
10+
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.19.8
11+
github.com/aws/aws-sdk-go-v2/service/kms v1.45.4
12+
github.com/aws/aws-sdk-go-v2/service/s3 v1.88.2
13+
github.com/aws/aws-sdk-go-v2/service/sts v1.38.5
1014
github.com/google/uuid v1.6.0
1115
github.com/sirupsen/logrus v1.9.3
1216
)
1317

1418
require (
15-
github.com/aws/aws-sdk-go-v2/credentials v1.17.11 // indirect
16-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 // indirect
17-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 // indirect
18-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 // indirect
19-
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
20-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect
21-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 // indirect
22-
github.com/aws/aws-sdk-go-v2/service/sso v1.20.5 // indirect
23-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.4 // indirect
24-
github.com/aws/aws-sdk-go-v2/service/sts v1.28.6 // indirect
25-
github.com/aws/smithy-go v1.20.2 // indirect
26-
github.com/jmespath/go-jmespath v0.4.0 // indirect
27-
golang.org/x/sys v0.19.0 // indirect
19+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.1 // indirect
20+
github.com/aws/aws-sdk-go-v2/credentials v1.18.14 // indirect
21+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.8 // indirect
22+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.8 // indirect
23+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.8 // indirect
24+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
25+
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.8 // indirect
26+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.1 // indirect
27+
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.8.8 // indirect
28+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.8 // indirect
29+
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.8 // indirect
30+
github.com/aws/aws-sdk-go-v2/service/sso v1.29.4 // indirect
31+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.0 // indirect
32+
github.com/aws/smithy-go v1.23.0 // indirect
33+
golang.org/x/sys v0.36.0 // indirect
2834
)

0 commit comments

Comments
 (0)