Skip to content

Commit 8ec42ca

Browse files
authored
Merge branch 'main' into scratch/paths
2 parents 9f5fea9 + 99694c1 commit 8ec42ca

File tree

8 files changed

+52
-9
lines changed

8 files changed

+52
-9
lines changed

.github/workflows/false-positive-approvals.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ jobs:
151151
}
152152
- name: Publish Updated Suppressions
153153
if: ${{ steps.fp-ops-commit.outputs.publish == 'true' }}
154-
uses: JamesIves/[email protected].2
154+
uses: JamesIves/[email protected].3
155155
with:
156156
branch: gh-pages
157157
folder: suppressions

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ jobs:
255255
run: ls -R
256256
working-directory: target
257257
- name: Deploy gh-pages
258-
uses: JamesIves/[email protected].2
258+
uses: JamesIves/[email protected].3
259259
with:
260260
branch: gh-pages
261261
folder: target/staging

core/src/main/java/org/owasp/dependencycheck/AnalysisTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public Void call() {
8787
try {
8888
analyzer.analyze(dependency, engine);
8989
} catch (AnalysisException ex) {
90-
LOGGER.warn("An error occurred while analyzing '{}' ({}).", dependency.getActualFilePath(), analyzer.getName());
90+
LOGGER.warn("An error occurred while analyzing '{}' ({}): {}", dependency.getActualFilePath(), analyzer.getName(), ex.getMessage());
9191
LOGGER.debug("", ex);
9292
exceptions.add(ex);
9393
} catch (Throwable ex) {

maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2703,7 +2703,7 @@ private String[] determineSuppressions() {
27032703
/**
27042704
* Hacky method of muting the noisy logging from JCS
27052705
*/
2706-
private void muteNoisyLoggers() {
2706+
protected void muteNoisyLoggers() {
27072707
System.setProperty("jcs.logSystem", "slf4j");
27082708
if (!getLog().isDebugEnabled()) {
27092709
Slf4jAdapter.muteLogging(true);

maven/src/main/java/org/owasp/dependencycheck/maven/UpdateMojo.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public boolean canGenerateReport() {
6767
*/
6868
@Override
6969
protected void runCheck() throws MojoExecutionException, MojoFailureException {
70+
muteNoisyLoggers();
7071
try (Engine engine = initializeEngine()) {
7172
try {
7273
if (!engine.getSettings().getBoolean(Settings.KEYS.AUTO_UPDATE)) {

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Copyright (c) 2012 - Jeremy Long
138138
<maven-surefire-report-plugin.version>3.5.2</maven-surefire-report-plugin.version>
139139
<jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
140140
<spotbugs.version>4.9.1</spotbugs.version>
141-
<spotbugs.maven.plugin.version>4.8.6.6</spotbugs.maven.plugin.version>
141+
<spotbugs.maven.plugin.version>4.9.1.0</spotbugs.maven.plugin.version>
142142
<taglist-maven-plugin.version>3.2.1</taglist-maven-plugin.version>
143143
<versions-maven-plugin.version>2.18.0</versions-maven-plugin.version>
144144
<jetbrains.annotations.version>26.0.2</jetbrains.annotations.version>
@@ -219,12 +219,12 @@ Copyright (c) 2012 - Jeremy Long
219219
<plugin>
220220
<groupId>org.apache.maven.plugins</groupId>
221221
<artifactId>maven-clean-plugin</artifactId>
222-
<version>3.4.0</version>
222+
<version>3.4.1</version>
223223
</plugin>
224224
<plugin>
225225
<groupId>org.apache.maven.plugins</groupId>
226226
<artifactId>maven-compiler-plugin</artifactId>
227-
<version>3.13.0</version>
227+
<version>3.14.0</version>
228228
</plugin>
229229
<plugin>
230230
<groupId>org.apache.maven.plugins</groupId>

utils/src/main/java/org/owasp/dependencycheck/utils/Downloader.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.apache.hc.client5.http.auth.Credentials;
2424
import org.apache.hc.client5.http.auth.CredentialsStore;
2525
import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
26+
import org.apache.hc.client5.http.config.ConnectionConfig;
2627
import org.apache.hc.client5.http.impl.auth.BasicAuthCache;
2728
import org.apache.hc.client5.http.impl.auth.BasicScheme;
2829
import org.apache.hc.client5.http.impl.auth.SystemDefaultCredentialsProvider;
@@ -69,6 +70,7 @@
6970
import java.util.Collections;
7071
import java.util.List;
7172
import java.util.Locale;
73+
import java.util.concurrent.TimeUnit;
7274

7375
import static java.lang.String.format;
7476

@@ -88,6 +90,11 @@ public final class Downloader {
8890
*/
8991
private final HttpClientBuilder httpClientBuilderExplicitNoproxy;
9092

93+
/**
94+
* The connectionmanager for HTTP connection pooling shared by the client builders.
95+
*/
96+
private final PoolingHttpClientConnectionManager connectionManager;
97+
9198
/**
9299
* The Authentication cache for pre-emptive authentication.
93100
* This gets filled with credentials from the settings in {@link #configure(Settings)}.
@@ -133,7 +140,7 @@ public final class Downloader {
133140

134141
private Downloader() {
135142
// Singleton class
136-
final PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
143+
connectionManager = new PoolingHttpClientConnectionManager();
137144
//TODO: ensure proper closure and eviction policy
138145
httpClientBuilder = HttpClientBuilder.create()
139146
.useSystemProperties()
@@ -175,7 +182,17 @@ public static Downloader getInstance() {
175182
*/
176183
public void configure(Settings settings) throws InvalidSettingException {
177184
this.settings = settings;
178-
185+
final long connectionTimeout = settings.getLong(Settings.KEYS.CONNECTION_TIMEOUT, 10_000);
186+
// set a conservatively long default timeout to compensate for MITM-proxies that return the (final) bytes only
187+
// after all security checks passed
188+
final int readTimeout = settings.getInt(Settings.KEYS.CONNECTION_READ_TIMEOUT, 60_000);
189+
190+
connectionManager.setDefaultConnectionConfig(
191+
ConnectionConfig.custom()
192+
.setConnectTimeout(connectionTimeout, TimeUnit.MILLISECONDS)
193+
.setSocketTimeout(readTimeout, TimeUnit.MILLISECONDS)
194+
.build()
195+
);
179196
if (settings.getString(Settings.KEYS.PROXY_SERVER) != null) {
180197
// Legacy proxy configuration present
181198
// So don't rely on the system properties for proxy; use the legacy settings configuration

utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,31 @@ public long getLong(@NotNull final String key) throws InvalidSettingException {
14541454
}
14551455
}
14561456

1457+
/**
1458+
* Returns a long value from the properties file. If the value was specified
1459+
* as a system property or passed in via the -Dprop=value argument - this
1460+
* method will return the value from the system properties before the values
1461+
* in the contained configuration file.
1462+
*
1463+
* @param key the key to lookup within the properties file
1464+
* @param defaultValue the default value to return
1465+
* @return the property from the properties file or the defaultValue if the
1466+
* property does not exist or cannot be converted to an integer
1467+
*/
1468+
public long getLong(@NotNull final String key, long defaultValue) {
1469+
long value;
1470+
try {
1471+
value = Long.parseLong(getString(key));
1472+
} catch (NumberFormatException ex) {
1473+
if (!getString(key, "").isEmpty()) {
1474+
LOGGER.debug("Could not convert property '{}={}' to a long; using {} instead.",
1475+
key, getPrintableValue(key, getString(key)), defaultValue);
1476+
}
1477+
value = defaultValue;
1478+
}
1479+
return value;
1480+
}
1481+
14571482
/**
14581483
* Returns a boolean value from the properties file. If the value was
14591484
* specified as a system property or passed in via the

0 commit comments

Comments
 (0)