Repository navigation
fix: patch Alpine packages in container images and bump handlebars - #325
Merged
Merged
Conversation
node:24-alpine (Alpine 3.24.2) still ships zlib 1.3.2-r0, which has CVE-2026-85091; 1.3.2-r1 is already in the Alpine repo. Run apk upgrade at build time so images pick up security fixes released since the base image was published. Co-Authored-By: Claude <noreply@anthropic.com>
Resolves Dependabot alerts #436, #437 and #438 (handlebars <= 4.7.9, pulled in transitively by ts-jest and conventional-changelog-writer). Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files
|
cdklabs-automation
enabled auto-merge
October 19, 2026 20:57
- Run apk upgrade on its own line so the libc6-compat note stays with its RUN, and say it only takes effect when CDK rebuilds the image. - Scope the override to handlebars@4, like the other multi-major ones. - README: tell users who own their Dockerfile to add apk upgrade. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
Code review (
|
| # | Finding | Outcome |
|---|---|---|
| 1–2 | apk upgrade only runs when the image is rebuilt. The DockerImageAsset hash covers the build context, so a redeploy with an unchanged app reuses the image already in ECR. On a local machine, the cached RUN layer is reused as well. |
Documented, not changed. The Dockerfile comment now says the upgrade takes effect only when CDK rebuilds the image, and the README says so too. Busting the cache on every deploy would rebuild every image on every deploy, which is too costly for this patch. |
| 3 | Users who own their Dockerfile don't get the fix. | Fixed: the README tells them to add RUN apk upgrade --no-cache. |
| 4 | Dockerfiles edited under the header get overwritten on upgrade, with a .bak copy. |
No change. This is the documented header contract, and it's how the fix reaches users. |
| 5 | apk upgrade && apk add fetches APKINDEX twice. |
No change. It costs a second or two per build. |
| 6 | The upgrade comment split the libc6-compat note from its RUN. |
Fixed: apk upgrade now has its own RUN line and comment. |
| 7 | The handlebars override had no major-version scope. | Fixed: it is now handlebars@4, matching js-yaml@3 and brace-expansion@5. |
| 8 | copyDockerfileToContext / isGeneratedDockerfile have no tests. |
Out of scope: this is pre-existing. |
| 9 | The two Dockerfiles duplicate their shared lines. | Out of scope: this is pre-existing. |
Verified: on node:24-alpine, apk upgrade --no-cache then apk add --no-cache libc6-compat gives zlib-1.3.2-r1. pnpm projen regenerates the lockfile with only handlebars 4.7.9 → 4.7.10.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
node:24-alpinebut never upgrade OS packages. The current upstream image (Alpine 3.24.2) still shipszlib-1.3.2-r0(CVE-2026-85091), while1.3.2-r1is already in the Alpine repo. Both Dockerfiles now runapk upgrade --no-cachebeforeapk add, so images pick up security fixes released after the base image was published. User Dockerfiles carrying the generated header are rewritten automatically.handlebars: ^4.7.10pnpm override (via.projenrc.ts) to resolve alerts #436, #437, #438. handlebars is transitive (ts-jest, conventional-changelog-writer); the lockfile diff touches only handlebars.Testing
docker run node:24-alpine sh -c 'apk upgrade --no-cache && apk add --no-cache libc6-compat && apk info -v | grep ^zlib'→zlib-1.3.2-r1, node v24.22.0.pnpm compile,pnpm projen,pnpm jest src/nextjs-build/nextjs-build.test.ts(52 passed).🤖 Generated with Claude Code