Skip to content

Commit c159ddc

Browse files
authored
Merge branch 'aws:develop' into develop
2 parents fb47130 + c17162c commit c159ddc

File tree

22 files changed

+125
-34
lines changed

22 files changed

+125
-34
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Check binaries
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 16 * * 1-5" # min h d Mo DoW / 9am PST M-F
7+
8+
jobs:
9+
check-for-vulnerabilities:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
report_contents: ${{ steps.save-output.outputs.report_contents }}
13+
steps:
14+
- name: Setup python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.11'
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
ref: main
22+
- name: Download latest release
23+
uses: robinraju/[email protected]
24+
with:
25+
latest: true
26+
fileName: 'aws-lambda-rie*'
27+
out-file-path: "bin"
28+
- name: Run check for vulnerabilities
29+
id: check-binaries
30+
run: |
31+
make check-binaries
32+
- if: always() && failure() # `always()` to run even if the previous step failed. Failure means that there are vulnerabilities
33+
name: Save content of the vulnerabilities report as GitHub output
34+
id: save-output
35+
run: |
36+
report_csv="$(ls -tr output.cve-bin-*.csv 2>/dev/null | tail -n1)" # last file generated
37+
if [ -z "$report_csv" ]; then
38+
echo "No file with vulnerabilities. Probably a failure in previous step."
39+
else
40+
echo "Vulnerabilities stored in $report_csv"
41+
fi
42+
final_report="${report_csv}.txt"
43+
awk -F',' '{n=split($10, path, "/"); print $2,$3,$4,$5,path[n]}' "$report_csv" | column -t > "$final_report" # make the CSV nicer
44+
echo "report_contents<<EOF" >> "$GITHUB_OUTPUT"
45+
cat "$final_report" >> "$GITHUB_OUTPUT"
46+
echo "EOF" >> "$GITHUB_OUTPUT"
47+
- if: always() && steps.save-output.outputs.report_contents
48+
name: Build new binaries and check vulnerabilities again
49+
id: check-new-version
50+
run: |
51+
mkdir ./bin2
52+
mv ./bin/* ./bin2
53+
make compile-with-docker-all
54+
latest_version=$(strings bin/aws-lambda-rie* | grep '^go1\.' | sort | uniq)
55+
echo "latest_version=$latest_version" >> "$GITHUB_OUTPUT"
56+
make check-binaries
57+
- if: always() && steps.save-output.outputs.report_contents
58+
name: Save outputs for the check with the latest build
59+
id: save-new-version
60+
run: |
61+
if [ "${{ steps.check-new-version.outcome }}" == "failure" ]; then
62+
fixed="No"
63+
else
64+
fixed="Yes"
65+
fi
66+
echo "fixed=$fixed" >> "$GITHUB_OUTPUT"
67+
- if: always() && steps.save-output.outputs.report_contents
68+
name: Create GitHub Issue indicating vulnerabilities
69+
id: create-issue
70+
uses: dacbd/create-issue-action@main
71+
with:
72+
token: ${{ github.token }}
73+
title: |
74+
CVEs found in latest RIE release
75+
body: |
76+
### CVEs found in latest RIE release
77+
```
78+
${{ steps.save-output.outputs.report_contents }}
79+
```
80+
81+
#### Are these resolved by building with the latest patch version of Go (${{ steps.check-new-version.outputs.latest_version }})?:
82+
> **${{ steps.save-new-version.outputs.fixed }}**

.github/workflows/integ-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
pull_request:
55
branches:
66
- develop
7+
- main
78

89
jobs:
910
go-tests:

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ DESTINATION_old:= bin/${BINARY_NAME}
1010
DESTINATION_x86_64 := bin/${BINARY_NAME}-x86_64
1111
DESTINATION_arm64 := bin/${BINARY_NAME}-arm64
1212

13-
run_in_docker = docker run --env GOPROXY=direct -v $(shell pwd):/LambdaRuntimeLocal -w /LambdaRuntimeLocal golang:1.22 $(1)
13+
run_in_docker = docker run --env GOPROXY=direct -v $(shell pwd):/LambdaRuntimeLocal -w /LambdaRuntimeLocal golang:1.24 $(1)
1414

1515
compile-with-docker-all:
1616
$(call run_in_docker, make compile-lambda-linux-all)
@@ -70,4 +70,7 @@ integ-tests-with-docker-old:
7070
make ARCH=old compile-with-docker
7171
make prep-python
7272
make TEST_ARCH="" TEST_PORT=9052 exec-python-e2e-test
73-
73+
74+
check-binaries: prep-python
75+
.venv/bin/pip install cve-bin-tool
76+
.venv/bin/python -m cve_bin_tool.cli bin/ -r go -d REDHAT,OSV,GAD,CURL --no-0-cve-report -f csv

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,16 @@ Lambda’s orchestrator, or security and authentication configurations. You can
3131

3232
## Installing
3333

34-
Instructions for installing AWS Lambda Runtime Interface Emulator for your platform
34+
The following commands download the RIE binary for your platform. Note that while you can download the binary on any platform, the RIE can only be executed in a Linux environment (typically within a Docker container).
3535

36-
| Platform | Command to install |
36+
| Platform (for downloading) | Command to download |
3737
|---------|---------
3838
| macOS/Linux x86\_64 | `mkdir -p ~/.aws-lambda-rie && curl -Lo ~/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie && chmod +x ~/.aws-lambda-rie/aws-lambda-rie` |
3939
| macOS/Linux arm64 | `mkdir -p ~/.aws-lambda-rie && curl -Lo ~/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie-arm64 && chmod +x ~/.aws-lambda-rie/aws-lambda-rie` |
4040
| Windows x86\_64 | `Invoke-WebRequest -OutFile 'C:\Program Files\aws lambda\aws-lambda-rie' https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie` |
4141
| Windows arm64 | `Invoke-WebRequest -OutFile 'C:\Program Files\aws lambda\aws-lambda-rie' https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie-arm64` |
4242

43+
After downloading, the RIE binary must be used within a Linux environment, typically as part of a Docker container setup. See the Docker configuration instructions below for proper implementation.
4344

4445
## Getting started
4546

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module go.amzn.com
22

3-
go 1.22
3+
go 1.24
44

55
require (
66
github.com/aws/aws-lambda-go v1.46.0
7-
github.com/go-chi/chi v1.5.5
7+
github.com/go-chi/chi/v5 v5.2.2
88
github.com/google/uuid v1.6.0
99
github.com/jessevdk/go-flags v1.5.0
1010
github.com/sirupsen/logrus v1.9.3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ github.com/aws/aws-lambda-go v1.46.0/go.mod h1:dpMpZgvWx5vuQJfBt0zqBha60q7Dd7Rfg
33
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
44
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
55
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
6-
github.com/go-chi/chi v1.5.5 h1:vOB/HbEMt9QqBqErz07QehcOKHaWFtuj87tTDVz2qXE=
7-
github.com/go-chi/chi v1.5.5/go.mod h1:C9JqLr3tIYjDOZpzn+BCuxY8z8vmca43EeMgyZt7irw=
6+
github.com/go-chi/chi/v5 v5.2.2 h1:CMwsvRVTbXVytCk1Wd72Zy1LAsAh9GxMmSNWLHCG618=
7+
github.com/go-chi/chi/v5 v5.2.2/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops=
88
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
99
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
1010
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=

lambda/core/directinvoke/directinvoke.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"strconv"
1212
"strings"
1313

14-
"github.com/go-chi/chi"
14+
"github.com/go-chi/chi/v5"
1515
"go.amzn.com/lambda/core/bandwidthlimiter"
1616
"go.amzn.com/lambda/fatalerror"
1717
"go.amzn.com/lambda/interop"

lambda/core/directinvoke/directinvoke_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"testing"
1818
"time"
1919

20-
"github.com/go-chi/chi"
20+
"github.com/go-chi/chi/v5"
2121
"github.com/stretchr/testify/assert"
2222
"github.com/stretchr/testify/require"
2323
"go.amzn.com/lambda/fatalerror"

lambda/rapi/handler/agentnext.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (h *agentNextHandler) ServeHTTP(writer http.ResponseWriter, request *http.R
4848
}
4949
} else {
5050
log.Warnf("Unknown agent %s tried to call /next", agentID.String())
51-
rendering.RenderForbiddenWithTypeMsg(writer, request, errAgentIdentifierUnknown, "Unknown extension"+agentID.String())
51+
rendering.RenderForbiddenWithTypeMsg(writer, request, errAgentIdentifierUnknown, "Unknown extension %s", agentID.String())
5252
return
5353
}
5454

lambda/rapi/handler/agentregister.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (h *agentRegisterHandler) ServeHTTP(writer http.ResponseWriter, request *ht
7777

7878
registerRequest, err := parseRegister(request)
7979
if err != nil {
80-
rendering.RenderForbiddenWithTypeMsg(writer, request, errInvalidRequestFormat, err.Error())
80+
rendering.RenderForbiddenWithTypeMsg(writer, request, errInvalidRequestFormat, "%s", err.Error())
8181
return
8282
}
8383

0 commit comments

Comments
 (0)