Skip to content

Commit ddaf876

Browse files
Security: Update sbt-github-actions plugin to v0.25.0 to fix CVE-2024-42471 (#183)
* Security: Fix CVE-2024-42471 and update all GitHub Actions to latest versions Fixes: - CVE-2024-42471: Updated actions/download-artifact@v2 to v4.3.0 Eliminates arbitrary file write vulnerability during artifact extraction that could lead to remote code execution, secret leakage, or workflow manipulation Updated all vulnerable actions to latest stable versions: - actions/checkout: v2 → v4.2.2 - actions/setup-java: v2 → v4.7.1 - actions/cache: v2 → v4.2.3 - actions/upload-artifact: v2 → v4.6.2 - actions/download-artifact: v2 → v4.3.0 This addresses high-risk security vulnerabilities while maintaining full workflow functionality and improving CI/CD pipeline security. * Fix CVE-2024-42471: Update sbt-github-actions to use secure action versions Properly configures sbt-github-actions plugin to generate workflows with secure action versions instead of manually editing the generated ci.yml file. Changes: - Override githubWorkflowJobSetup with secure action versions: * actions/checkout: v2 → v4.2.2 * actions/setup-java: v2 → v4.7.1 * actions/cache: v2 → v4.2.3 - Override githubWorkflowGeneratedUploadSteps and githubWorkflowGeneratedDownloadSteps: * actions/upload-artifact: v2 → v4.6.2 * actions/download-artifact: v2 → v4.3.0 (fixes CVE-2024-42471) This approach ensures the security fixes persist through future workflow regeneration and prevents the workflow check from failing. * Update sbt-github-actions to v0.25.0 to fix CVE-2024-42471 - Updated plugin from v0.14.2 to v0.25.0 which uses secure action versions by default - Removed custom security overrides since new plugin has secure defaults - Now uses actions/download-artifact@v4 which fixes CVE-2024-42471 - Also updated to latest versions: checkout@v4, setup-java@v4, upload-artifact@v4 Fixes: CVE-2024-42471 (arbitrary file write vulnerability) * Update Java version to temurin@11 - Changed from zulu@8 to temurin@11 as requested - Updated build.sbt with explicit Java version specification - Regenerated workflows with new Java version
1 parent 8889fb1 commit ddaf876

File tree

5 files changed

+21
-34
lines changed

5 files changed

+21
-34
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,40 +28,32 @@ jobs:
2828
runs-on: ${{ matrix.os }}
2929
steps:
3030
- name: Checkout current branch (full)
31-
uses: actions/checkout@v2
31+
uses: actions/checkout@v4
3232
with:
3333
fetch-depth: 0
3434

3535
- name: Setup Java (temurin@11)
3636
if: matrix.java == 'temurin@11'
37-
uses: actions/setup-java@v2
37+
uses: actions/setup-java@v4
3838
with:
3939
distribution: temurin
4040
java-version: 11
41+
cache: sbt
4142

42-
- name: Cache sbt
43-
uses: actions/cache@v2
44-
with:
45-
path: |
46-
~/.sbt
47-
~/.ivy2/cache
48-
~/.coursier/cache/v1
49-
~/.cache/coursier/v1
50-
~/AppData/Local/Coursier/Cache/v1
51-
~/Library/Caches/Coursier/v1
52-
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
43+
- name: Setup sbt
44+
uses: sbt/setup-sbt@v1
5345

5446
- name: Check that workflows are up to date
55-
run: sbt ++${{ matrix.scala }} githubWorkflowCheck
47+
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck
5648

5749
- name: Build project
58-
run: sbt ++${{ matrix.scala }} test
50+
run: sbt '++ ${{ matrix.scala }}' test
5951

6052
- name: Compress target directories
6153
run: tar cf targets.tar target compose-examples/target compose/target compose-macros/target compose-graphql/target project/target
6254

6355
- name: Upload target directories
64-
uses: actions/upload-artifact@v2
56+
uses: actions/upload-artifact@v4
6557
with:
6658
name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }}
6759
path: targets.tar
@@ -78,31 +70,23 @@ jobs:
7870
runs-on: ${{ matrix.os }}
7971
steps:
8072
- name: Checkout current branch (full)
81-
uses: actions/checkout@v2
73+
uses: actions/checkout@v4
8274
with:
8375
fetch-depth: 0
8476

8577
- name: Setup Java (temurin@11)
8678
if: matrix.java == 'temurin@11'
87-
uses: actions/setup-java@v2
79+
uses: actions/setup-java@v4
8880
with:
8981
distribution: temurin
9082
java-version: 11
83+
cache: sbt
9184

92-
- name: Cache sbt
93-
uses: actions/cache@v2
94-
with:
95-
path: |
96-
~/.sbt
97-
~/.ivy2/cache
98-
~/.coursier/cache/v1
99-
~/.cache/coursier/v1
100-
~/AppData/Local/Coursier/Cache/v1
101-
~/Library/Caches/Coursier/v1
102-
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
85+
- name: Setup sbt
86+
uses: sbt/setup-sbt@v1
10387

10488
- name: Download target directories (2.13.8)
105-
uses: actions/download-artifact@v2
89+
uses: actions/download-artifact@v4
10690
with:
10791
name: target-${{ matrix.os }}-2.13.8-${{ matrix.java }}
10892

@@ -116,4 +100,4 @@ jobs:
116100
PGP_SECRET: ${{ secrets.PGP_SECRET }}
117101
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
118102
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
119-
run: sbt ++${{ matrix.scala }} ci-release
103+
run: sbt ci-release

.github/workflows/clean.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1818
steps:
1919
- name: Delete artifacts
20+
shell: bash {0}
2021
run: |
2122
# Customize those three lines with your repository and credentials:
2223
REPO=${GITHUB_API_URL}/repos/${{ github.repository }}
@@ -25,7 +26,7 @@ jobs:
2526
ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; }
2627
2728
# A temporary file which receives HTTP response headers.
28-
TMPFILE=/tmp/tmp.$$
29+
TMPFILE=$(mktemp)
2930
3031
# An associative array, key: artifact name, value: number of artifacts of that name.
3132
declare -A ARTCOUNT

build.sbt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ Global / scalacOptions := Seq(
1313
Global / scalaVersion := "2.13.8"
1414
ThisBuild / versionScheme := Some("early-semver")
1515
ThisBuild / testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
16+
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("11"))
1617
ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
1718
ThisBuild / githubWorkflowPublishTargetBranches += RefPredicate.StartsWith(Ref.Tag("v"))
18-
ThisBuild / githubWorkflowPublish := Seq(WorkflowStep.Sbt(List("ci-release")))
19+
1920
ThisBuild / githubWorkflowPublish := Seq(WorkflowStep.Sbt(
2021
List("ci-release"),
2122
env = Map(

forge.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
model: anthropic/claude-sonnet-4

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.4")
22
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")
3-
addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.14.2")
3+
addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.25.0")
44
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.11")

0 commit comments

Comments
 (0)