Skip to content

Commit aede6a9

Browse files
authored
Merge pull request #97 from joewiz/security-tooling
[ci] Add SpotBugs + FindSecBugs + CodeQL static analysis
2 parents 02c5b6b + f4e872c commit aede6a9

4 files changed

Lines changed: 132 additions & 0 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
schedule:
9+
# Weekly re-scan against latest CodeQL query database
10+
- cron: '17 4 * * 1'
11+
12+
jobs:
13+
analyze:
14+
name: Analyze (Java)
15+
runs-on: ubuntu-latest
16+
permissions:
17+
actions: read
18+
contents: read
19+
security-events: write
20+
21+
steps:
22+
- uses: actions/checkout@v6
23+
24+
- name: Set up JDK 21
25+
uses: actions/setup-java@v5
26+
with:
27+
distribution: temurin
28+
java-version: '21'
29+
cache: maven
30+
server-id: github
31+
server-username: GITHUB_ACTOR
32+
server-password: GITHUB_TOKEN
33+
34+
- name: Initialize CodeQL
35+
uses: github/codeql-action/init@v3
36+
with:
37+
languages: java-kotlin
38+
queries: security-extended,security-and-quality
39+
40+
- name: Build
41+
env:
42+
GITHUB_ACTOR: ${{ github.actor }}
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
run: mvn -B -U -DskipTests=true compile
45+
46+
- name: Perform CodeQL Analysis
47+
uses: github/codeql-action/analyze@v3
48+
with:
49+
category: "/language:java-kotlin"

.github/workflows/spotbugs.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: SpotBugs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
spotbugs:
11+
name: SpotBugs + FindSecBugs
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
security-events: write
16+
17+
steps:
18+
- uses: actions/checkout@v6
19+
20+
- name: Set up JDK 21
21+
uses: actions/setup-java@v5
22+
with:
23+
distribution: temurin
24+
java-version: '21'
25+
cache: maven
26+
server-id: github
27+
server-username: GITHUB_ACTOR
28+
server-password: GITHUB_TOKEN
29+
30+
- name: Run SpotBugs (+ FindSecBugs plugin)
31+
env:
32+
GITHUB_ACTOR: ${{ github.actor }}
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
run: mvn -B -U -DskipTests=true verify
35+
36+
- name: Upload SARIF to GitHub code scanning
37+
if: always()
38+
uses: github/codeql-action/upload-sarif@v3
39+
with:
40+
sarif_file: target/spotbugsSarif.json
41+
category: spotbugs
42+
43+
- name: Upload SpotBugs XML as artifact
44+
if: always()
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: spotbugs-report
48+
path: |
49+
target/spotbugs.xml
50+
target/spotbugsXml.xml
51+
target/spotbugsSarif.json
52+
if-no-files-found: warn

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[![CI](https://github.com/eXist-db/expath-crypto-module/workflows/CI/badge.svg)](https://github.com/eXist-db/expath-crypto-module/actions?query=workflow%3ACI)
2+
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/6700c245da044962938994fc59a2ebdc)](https://app.codacy.com/gh/eXist-db/expath-crypto-module/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
23

34
# eXist-db implementation for EXPath Cryptographic Module
45

pom.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,36 @@
245245
</execution>
246246
</executions>
247247
</plugin>
248+
<plugin>
249+
<!-- SpotBugs + FindSecBugs static analysis. Crypto-focused via FindSecBugs
250+
plugin. Currently report-only; once findings are triaged, switch the
251+
<goal> in <executions> from "spotbugs" to "check" to fail the build. -->
252+
<groupId>com.github.spotbugs</groupId>
253+
<artifactId>spotbugs-maven-plugin</artifactId>
254+
<version>4.8.6.6</version>
255+
<configuration>
256+
<effort>Max</effort>
257+
<threshold>Low</threshold>
258+
<failOnError>false</failOnError>
259+
<xmlOutput>true</xmlOutput>
260+
<sarifOutput>true</sarifOutput>
261+
<plugins>
262+
<plugin>
263+
<groupId>com.h3xstream.findsecbugs</groupId>
264+
<artifactId>findsecbugs-plugin</artifactId>
265+
<version>1.13.0</version>
266+
</plugin>
267+
</plugins>
268+
</configuration>
269+
<executions>
270+
<execution>
271+
<phase>verify</phase>
272+
<goals>
273+
<goal>spotbugs</goal>
274+
</goals>
275+
</execution>
276+
</executions>
277+
</plugin>
248278
<plugin>
249279
<groupId>com.ruleoftech</groupId>
250280
<artifactId>markdown-page-generator-plugin</artifactId>

0 commit comments

Comments
 (0)