Skip to content

Commit 846d691

Browse files
fix: improve security scan to use CycloneDX SBOM for accurate vulnerability detection
Switch from scanning Gradle cache dir to generating a proper CycloneDX SBOM via the cyclonedx-gradle-plugin and feeding it to Grype. This ensures shaded/fat JARs (e.g. testsigma-java-sdk) have their bundled transitive dependencies fully resolved and reported, closing the gap where 'dir:' scanning missed embedded libs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 4d88b3c commit 846d691

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

.github/workflows/security-scan.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,27 @@ jobs:
1616
java-version: '11'
1717
distribution: 'zulu'
1818

19-
- name: Download dependencies
20-
run: ./gradlew dependencies --no-daemon
19+
- name: Generate CycloneDX SBOM
20+
# Resolves all transitive dependencies and produces build/reports/bom.json
21+
run: ./gradlew cyclonedxBom --no-daemon
2122

2223
- name: Install Grype
2324
run: curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin
2425

2526
- name: Run Grype vulnerability scanner
2627
run: |
27-
GRADLE_CACHE="$HOME/.gradle/caches/modules-2/files-2.1"
28-
echo "Scanning Gradle cache: $(find $GRADLE_CACHE -name '*.jar' | wc -l) JARs found"
29-
grype "dir:$GRADLE_CACHE" \
28+
echo "=== Vulnerability table ==="
29+
grype "sbom:build/reports/bom.json" \
3030
--output table
31-
grype "dir:$GRADLE_CACHE" \
31+
32+
grype "sbom:build/reports/bom.json" \
3233
--output sarif > grype-results.sarif
3334
3435
- name: Upload scan results as artifact
3536
uses: actions/upload-artifact@v4
3637
if: always()
3738
with:
3839
name: grype-scan-results
39-
path: 'grype-results.sarif'
40+
path: |
41+
grype-results.sarif
42+
build/reports/bom.json

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ plugins {
1717
id 'maven-publish'
1818
id 'signing'
1919
id 'com.vanniktech.maven.publish' version '0.34.0'
20+
id 'org.cyclonedx.bom' version '1.10.0'
2021
}
2122

2223
repositories {

0 commit comments

Comments
 (0)