Skip to content

Commit 4526647

Browse files
authored
Maintenance release: v1.0.6 (#13)
* Using pinned versions of immutable Actions * Use explicit immutable actions in sample workflow * Use pinned commit in sample workflow and README * Checksum verification for SpotBugs download * Spaced out for readability * Fixed link to LICENSE * Changed to NOTE markup * Updated CHANGELOG
1 parent ee8f082 commit 4526647

File tree

5 files changed

+54
-12
lines changed

5 files changed

+54
-12
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# CHANGELOG
22

3+
## 1.0.6 - 2025-04-08
4+
5+
A supply chain security and maintenance release.
6+
7+
* Added SHA256 checksum verification for SpotBugs (not for FindSecBugs, Maven Central versions are immutable)
8+
* Using immutable Actions versions where possible
9+
* Added pinned commit to sample workflow
10+
11+
## 1.0.5 - 2024-10-08
12+
13+
* Allowed setting RAM in the inputs
14+
315
## 1.0.0 - 2023-07-13
416

517
* Created Action

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Please fork the repository, and raise a Pull Request (PR) for review.
1818

1919
Remember to update the [README](README.md) and [CHANGELOG](CHANGELOG.md).
2020

21-
Your changes must be acceptable under the [LICENSE](LICENSE.md) of the project.
21+
Your changes must be acceptable under the [LICENSE](LICENSE) of the project.
2222

2323
## Code of conduct
2424

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# spotbugs-findsecbugs-action
22

3-
> ℹ️ This is an _unofficial_ tool created by Field Security Services, and is not officially supported by GitHub.
3+
> [!NOTE]
4+
> This is an _unofficial_ tool created by Field Security Services, and is not officially supported by GitHub.
45
56
This Action run SpotBugs with FindSecBugs, and uploads the results to GitHub Code Scanning.
67

@@ -14,15 +15,18 @@ Then, set up this Action as a step in your Actions workflow, e.g. for a typical
1415

1516
```yaml
1617
- name: Run SpotBugs with FindSecBugs
17-
uses: advanced-security/spotbugs-findsecbugs-action@v1
18+
uses: advanced-security/spotbugs-findsecbugs-action@33c1fbec0ef4c37b5d32fc41b072bb624962d5d8 # v1.0.6
1819
```
1920
2021
## Inputs
2122
2223
* `spotbugs_version`: The version of SpotBugs to use. Default: `4.7.3`
24+
* `spotbugs_checksum`: The SHA256 checksum of the SpotBugs tarball. Default is the checksum for the default version. Set to '' to disable checksum verification (not recommended).
25+
* find the checksum for the SpotBugs version you specify on the [GitHub release page](https://github.com/spotbugs/spotbugs/releases)
2326
* `findsecbugs_version`: The version of FindSecBugs to use. Default: `1.12.0`
27+
* Maven Central releases are immutable, so there is no need to specify a checksum, but it is shown in the workflow log for traceability
2428
* `spotbugs_target`: The target directory to run SpotBugs against. Default: `target/`
25-
* `spotbugs_filename_glob`: The filenames to locate for SpotBugs, e.g. *.class, *.jar. Default: `*.jar`
29+
* `spotbugs_filename_glob`: The filenames to locate for SpotBugs, e.g. `*.class`, `*.jar`. Default: `*.jar`
2630
* `upload_sarif`: Whether to upload the SARIF file to GitHub Code Scanning. Default: `true`
2731
* `java_distribution`: The Java distribution to use. Default: `microsoft`
2832
* `java_version`: The Java version to use. Default: `11`
@@ -67,7 +71,8 @@ See [CODEOWNERS](CODEOWNERS) for the list of maintainers.
6771

6872
## Support
6973

70-
> ℹ️ This is an _unofficial_ tool created by Field Security Services, and is not officially supported by GitHub.
74+
> [!NOTE]
75+
> This is an _unofficial_ tool created by Field Security Services, and is not officially supported by GitHub.
7176

7277
See the [SUPPORT](SUPPORT.md) file.
7378

action.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ inputs:
1111
description: 'The version of SpotBugs to use'
1212
required: false
1313
default: '4.7.3'
14+
spotbugs_checksum:
15+
description: 'The SHA256 checksum of the SpotBugs tarball'
16+
required: false
17+
default: 'f02e2f1135b23f3edfddb75f64be0491353cfeb567b5a584115aa4fd373d4431'
1418
findsecbugs_version:
1519
description: 'The version of FindSecBugs to use'
1620
required: false
@@ -59,38 +63,50 @@ runs:
5963
using: "composite"
6064
steps:
6165
- name: Setup Java
62-
uses: actions/setup-java@v3
66+
uses: actions/setup-java@4.7.0
6367
with:
6468
distribution: ${{ inputs.java_distribution }}
6569
java-version: ${{ inputs.java_version }}
70+
6671
- name: Cache SpotBugs
6772
if: inputs.no_cache == 'false'
6873
id: cache-spotbugs
69-
uses: actions/cache@v3
74+
uses: actions/cache@4.2.3
7075
with:
7176
path: ${{ inputs.base_path }}/spotbugs+/spotbugs-${{ inputs.spotbugs_version }}
7277
key: ${{ runner.os }}-spotbugs-${{ inputs.spotbugs_version }}
78+
7379
- name: Cache FindSecBugs
7480
if: inputs.no_cache == 'false'
7581
id: cache-findsecbugs
76-
uses: actions/cache@v3
82+
uses: actions/cache@4.2.3
7783
with:
7884
path: ${{ inputs.base_path }}/findsecbugs+/findsecbugs-plugin-${{ inputs.findsecbugs_version }}.jar
7985
key: ${{ runner.os }}-findsecbugs-${{ inputs.findsecbugs_version }}
86+
8087
- name: Get SpotBugs
8188
if: inputs.no_cache == 'true' || steps.cache-spotbugs.outputs.cache-hit != 'true'
8289
env:
8390
INPUT_SPOTBUGS_VERSION: ${{ inputs.spotbugs_version }}
91+
INPUT_SPOTBUGS_CHECKSUM: ${{ inputs.spotbugs_checksum }}
8492
SPOTBUGS_HOME: ${{ inputs.base_path }}/spotbugs+/
8593
run: |
8694
mkdir -p "${SPOTBUGS_HOME}"
8795
cd "${SPOTBUGS_HOME}"
8896
wget -q -O spotbugs-"${INPUT_SPOTBUGS_VERSION}".tgz "https://github.com/spotbugs/spotbugs/releases/download/${INPUT_SPOTBUGS_VERSION}/spotbugs-${INPUT_SPOTBUGS_VERSION}.tgz"
97+
if [ "${INPUT_SPOTBUGS_CHECKSUM}" != "" ]; then
98+
echo "Checking checksum"
99+
echo "${INPUT_SPOTBUGS_CHECKSUM} spotbugs-${INPUT_SPOTBUGS_VERSION}.tgz" | sha256sum -c - || { echo "Checksum verification failed for spotbugs-${INPUT_SPOTBUGS_VERSION}.tgz"; exit 1; }
100+
else
101+
echo "No checksum provided, showing current checksum"
102+
sha256sum spotbugs-"${INPUT_SPOTBUGS_VERSION}".tgz
103+
fi
89104
tar -xzf spotbugs-"${INPUT_SPOTBUGS_VERSION}".tgz
90105
chmod +x spotbugs-"${INPUT_SPOTBUGS_VERSION}"/bin/spotbugs
91106
ls "spotbugs-${INPUT_SPOTBUGS_VERSION}.tgz"
92107
echo "Got spotbugs"
93108
shell: bash
109+
94110
- name: Get FindSecBugs
95111
if: inputs.no_cache == 'true' || steps.cache-findsecbugs.outputs.cache-hit != 'true'
96112
env:
@@ -100,9 +116,12 @@ runs:
100116
mkdir -p "${FINDSECBUGS_HOME}"
101117
cd "${FINDSECBUGS_HOME}"
102118
wget -q -O "findsecbugs-plugin-${INPUT_FINDSECBUGS_VERSION}.jar" "https://search.maven.org/remotecontent?filepath=com/h3xstream/findsecbugs/findsecbugs-plugin/${INPUT_FINDSECBUGS_VERSION}/findsecbugs-plugin-${INPUT_FINDSECBUGS_VERSION}.jar"
119+
# Maven Central provides immutable versions, so we don't check the checksum, but do print it for traceability
120+
sha256sum "findsecbugs-plugin-${INPUT_FINDSECBUGS_VERSION}.jar"
103121
ls "findsecbugs-plugin-${INPUT_FINDSECBUGS_VERSION}.jar"
104122
echo "Got findsecbugs"
105123
shell: bash
124+
106125
- name: Run SpotBugs
107126
env:
108127
INPUT_FINDSECBUGS_VERSION: ${{ inputs.findsecbugs_version }}
@@ -118,6 +137,7 @@ runs:
118137
SPOTBUGS_FILES=$(find "${GITHUB_WORKSPACE}/${INPUT_SPOTBUGS_TARGET}" -type f -name "${INPUT_SPOTBUGS_GLOB}" -exec echo -n {} \+)
119138
"${SPOTBUGS_HOME}/bin/spotbugs" -maxHeap "${INPUT_RAM}" -textui -quiet -effort:max -low -bugCategories SECURITY -pluginList "${FINDSECBUGS_HOME}/findsecbugs-plugin-${INPUT_FINDSECBUGS_VERSION}.jar" -sarif=spotbugs.sarif ${SPOTBUGS_FILES}
120139
shell: bash
140+
121141
- name: Adjust file paths
122142
if: inputs.path_prefix != ''
123143
env:
@@ -129,8 +149,9 @@ runs:
129149
mv spotbugs.sarif spotbugs_orig.sarif
130150
mv spotbugs_edited.sarif spotbugs.sarif
131151
shell: bash
152+
132153
- name: Upload SARIF file
133154
if: inputs.upload_sarif == 'true'
134-
uses: github/codeql-action/upload-sarif@v3
155+
uses: github/codeql-action/upload-sarif@3.28.15
135156
with:
136157
sarif_file: ${{ inputs.base_path }}/spotbugs_working+/spotbugs.sarif

starter-workflow.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020

2121
steps:
2222
- name: Checkout
23-
uses: actions/checkout@v3
23+
uses: actions/checkout@4.2.2
2424
# this needs to be appropriately configured for your project
2525
- name: Setup Java
26-
uses: actions/setup-java@v3
26+
uses: actions/setup-java@4.7.0
2727
with:
2828
distribution: 'microsoft'
2929
java-version: 11
@@ -32,14 +32,18 @@ jobs:
3232
run: sbt publishLocal
3333
# now run SpotBugs and upload the results to Code Scanning
3434
- name: Run SpotBugs with FindSecBugs
35-
uses: advanced-security/spotbugs-findsecbugs-action@v1
35+
uses: advanced-security/spotbugs-findsecbugs-action@33c1fbec0ef4c37b5d32fc41b072bb624962d5d8 # v1.0.6
3636
with:
3737
# set these appropriately for your project - the defaults are shown here for context
38+
# make sure to set a SHA256 checksum that matches the version you want to use of SpotBugs
39+
# check https://github.com/spotbugs/spotbugs/releases
40+
# you can switch off checksum checking by setting the checksum to '', but this is not recommended
3841
spotbugs_target: 'target/scala-2.13' # cannot have globs
3942
# spotbugs_filename_glob: '*.jar'
4043
# upload_sarif: 'true'
4144
# no_cache: 'false'
4245
# spotbugs_version: '4.7.3'
46+
# spotbugs_checksum: 'f02e2f1135b23f3edfddb75f64be0491353cfeb567b5a584115aa4fd373d4431'
4347
# findsecbugs_version: '1.12.0'
4448
# java_distribution: 'microsoft'
4549
# java_version: '11'

0 commit comments

Comments
 (0)