Skip to content

Commit d686a74

Browse files
committed
Upgrade to owasp dep check 12.1.5 and Java 25
1 parent c92ac7d commit d686a74

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

etc/scripts/owasp-dependency-check.sh

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -e
22
#
3-
# Copyright (c) 2020, 2024 Oracle and/or its affiliates.
3+
# Copyright (c) 2020, 2025 Oracle and/or its affiliates.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -19,14 +19,6 @@ set -o pipefail || true # trace ERR through pipes
1919
set -o errtrace || true # trace ERR through commands and functions
2020
set -o errexit || true # exit the script if any statement returns a non-true return value
2121

22-
on_error(){
23-
CODE="${?}" && \
24-
set +x && \
25-
printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \
26-
"${CODE}" "${BASH_SOURCE[0]}" "${LINENO}" "${BASH_COMMAND}"
27-
}
28-
trap on_error ERR
29-
3022
# Path to this script
3123
if [ -h "${0}" ] ; then
3224
SCRIPT_PATH="$(readlink "${0}")"
@@ -39,10 +31,17 @@ readonly SCRIPT_PATH
3931
# Path to the root of the workspace
4032
# shellcheck disable=SC2046
4133
WS_DIR=$(cd $(dirname -- "${SCRIPT_PATH}") ; cd ../.. ; pwd -P)
42-
readonly WS_DIR
4334

44-
# shellcheck disable=SC2155
45-
readonly RESULT_FILE=$(mktemp -t XXXdependency-check-result)
35+
on_error(){
36+
CODE="${?}" && \
37+
set +x && \
38+
printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \
39+
"${CODE}" "${BASH_SOURCE[0]}" "${LINENO}" "${BASH_COMMAND}"
40+
}
41+
trap on_error ERR
42+
43+
RESULT_FILE=$(mktemp -t XXXdependency-check-result)
44+
readonly RESULT_FILE
4645

4746
die() { cat "${RESULT_FILE}" ; echo "Dependency report in ${WS_DIR}/target" ; echo "${1}" ; exit 1 ;}
4847

@@ -52,13 +51,24 @@ if [ "${PIPELINE}" = "true" ] ; then
5251
mvn ${MAVEN_ARGS} -f "${WS_DIR}"/pom.xml clean install -DskipTests
5352
fi
5453

54+
# The Sonatype OSS Index analyzer requires authentication
55+
# See https://ossindex.sonatype.org/doc/auth-required
56+
# Set OSS_INDEX_USERNAME and OSS_INDEX_PASSWORD to authenticate.
57+
# Otherwise OSS Index analyzer will be disabled
58+
# And yes, this option uses a lower case i while Username and Password has an upper case I
59+
OSS_INDEX_OPTIONS="-DossindexAnalyzerEnabled=false"
60+
if [ -n "${OSS_INDEX_PASSWORD}" ] && [ -n "${OSS_INDEX_USERNAME}" ]; then
61+
OSS_INDEX_OPTIONS="-DossindexAnalyzerEnabled=true -DossIndexUsername=${OSS_INDEX_USERNAME} -DossIndexPassword=${OSS_INDEX_PASSWORD}"
62+
fi
63+
5564
# Setting NVD_API_KEY is not required but improves behavior of NVD API throttling
5665

5766
# shellcheck disable=SC2086
5867
mvn ${MAVEN_ARGS} -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN org.owasp:dependency-check-maven:aggregate \
5968
-f "${WS_DIR}"/pom.xml \
6069
-Dtop.parent.basedir="${WS_DIR}" \
61-
-Dnvd-api-key="${NVD_API_KEY}" \
70+
-DnvdApiKey="${NVD_API_KEY}" \
71+
${OSS_INDEX_OPTIONS} \
6272
> "${RESULT_FILE}" || die "Error running the Maven command"
6373

6474
grep -i "One or more dependencies were identified with known vulnerabilities" "${RESULT_FILE}" \

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939

4040
<version.lib.checkstyle>10.13.0</version.lib.checkstyle>
4141
<version.plugin.checkstyle>3.3.1</version.plugin.checkstyle>
42-
<version.plugin.dependency-check>12.1.0</version.plugin.dependency-check>
42+
<version.plugin.dependency-check>12.1.5</version.plugin.dependency-check>
4343
<version.plugin.directory>1.0</version.plugin.directory>
4444
<version.plugin.failsafe>3.2.5</version.plugin.failsafe>
45-
<version.plugin.spotbugs>4.8.5.0</version.plugin.spotbugs>
45+
<version.plugin.spotbugs>4.9.6.0</version.plugin.spotbugs>
4646
<version.plugin.findsecbugs>1.13.0</version.plugin.findsecbugs>
4747
<version.plugin.helidon-build-tools>4.0.14</version.plugin.helidon-build-tools>
4848
</properties>

0 commit comments

Comments
 (0)