Skip to content

Commit 1a21a94

Browse files
committed
ci(dependency-check): pass NVD API key as env variable
1 parent abdc83d commit 1a21a94

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

.github/workflows/maven-dependency-check.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,12 @@ jobs:
4444
run: |
4545
set -euo pipefail
4646
# Do not set IFS=$'\n\t', breaks ${MAVEN_CLI_OPTS}
47+
# The NVD API key is read from the NVD_API_KEY environment variable by
48+
# the pom (dependencyCheck.NVDApiKey default), so the secret is never
49+
# passed on the command line where it would be visible in the process
50+
# list.
4751
# shellcheck disable=SC2086 # [Double quote to prevent globbing and word splitting]: splitting is desired for MAVEN_CLI_OPTS
48-
./mvnw ${MAVEN_CLI_OPTS} -DdependencyCheck.NVDApiKey=${NVD_API_KEY} dependency-check:aggregate
52+
./mvnw ${MAVEN_CLI_OPTS} dependency-check:aggregate
4953
- name: Clean up
5054
working-directory: xml
5155
shell: bash

xml/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
<dependencyCheck.version>12.2.2</dependencyCheck.version>
1313
<dependencyCheck.skip>false</dependencyCheck.skip>
1414
<dependencyCheck.threshold>7</dependencyCheck.threshold>
15+
<!-- Read the NVD API key from the environment so the secret is never
16+
passed on the command line (visible in the process list). Can still
17+
be overridden with -DdependencyCheck.NVDApiKey=... if needed. -->
18+
<dependencyCheck.NVDApiKey>${env.NVD_API_KEY}</dependencyCheck.NVDApiKey>
1519
<saxon.version>13.0</saxon.version>
1620
</properties>
1721
<build>

0 commit comments

Comments
 (0)