Skip to content

Commit 5052513

Browse files
authored
Update package for CVE-2023-52425 (#1569)
Problem: There's a new CVE in the base image, but since Docker is caching the layer, `apk update && apk upgrade` doesn't have any effect. Solution: Only upgrade the affected package. This will invalidate the cache and only upgrade the package with a CVE. This also makes the build somewhat reproducible since we're not updating all the packages at build time.
1 parent e66c234 commit 5052513

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
images: |
8888
name=ghcr.io/nginxinc/nginx-gateway-fabric,enable=${{ inputs.image == 'ngf' && github.event_name != 'pull_request' }}
8989
name=ghcr.io/nginxinc/nginx-gateway-fabric/nginx,enable=${{ inputs.image == 'nginx' && github.event_name != 'pull_request' }}
90-
name=docker-mgmt.nginx.com/nginx-gateway-fabric/nginx-plus,enable=${{ inputs.image == 'nginx-plus' && github.event_name != 'pull_request' }}
90+
name=docker-mgmt.nginx.com/nginx-gateway-fabric/nginx-plus,enable=${{ inputs.image == 'plus' && github.event_name != 'pull_request' }}
9191
name=localhost:5000/nginx-gateway-fabric/${{ inputs.image }}
9292
flavor: |
9393
latest=${{ (inputs.tag != '' && 'true') || 'auto' }}
@@ -114,7 +114,7 @@ jobs:
114114
- name: Build Docker Image
115115
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
116116
with:
117-
file: build/Dockerfile${{ inputs.image == 'nginx' && '.nginx' || '' }}${{ inputs.image == 'nginx-plus' && '.nginxplus' || '' }}
117+
file: build/Dockerfile${{ inputs.image == 'nginx' && '.nginx' || '' }}${{ inputs.image == 'plus' && '.nginxplus' || '' }}
118118
context: "."
119119
target: ${{ inputs.image == 'ngf' && 'goreleaser' || '' }}
120120
tags: ${{ steps.meta.outputs.tags }}
@@ -154,6 +154,7 @@ jobs:
154154
continue-on-error: true
155155
with:
156156
sarif_file: ${{ steps.scan.outputs.sarif }}
157+
if: always()
157158

158159
- name: Upload Scan Results
159160
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
@@ -162,5 +163,6 @@ jobs:
162163
name: scan-results-${{ inputs.image }}
163164
path: |
164165
${{ steps.scan.outputs.sarif }}
165-
!sbom-nginx-plus.json
166+
*.json
167+
!sbom-plus.json
166168
if: always()

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ jobs:
246246
strategy:
247247
fail-fast: false
248248
matrix:
249-
image: [ngf, nginx, nginx-plus]
249+
image: [ngf, nginx, plus]
250250
platforms: ["linux/arm64, linux/amd64"]
251251
uses: ./.github/workflows/build.yml
252252
with:

build/Dockerfile.nginx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ ARG NJS_DIR
55
ARG NGINX_CONF_DIR
66
ARG BUILD_AGENT
77

8-
RUN apk update && apk upgrade && apk add --no-cache libcap \
8+
RUN apk add --no-cache libcap \
99
&& mkdir -p /var/lib/nginx /usr/lib/nginx/modules \
1010
&& setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx \
1111
&& setcap -v 'cap_net_bind_service=+ep' /usr/sbin/nginx \
12+
# Update packages for CVE-2023-52425
13+
&& apk --no-cache upgrade libexpat \
1214
&& apk del libcap
1315

1416
COPY ${NJS_DIR}/httpmatches.js /usr/lib/nginx/modules/njs/httpmatches.js

0 commit comments

Comments
 (0)