Skip to content

Commit e5bb706

Browse files
committed
Reset scanner cache validity period to 12h
Fixes #2115 Signed-off-by: nscuro <nscuro@protonmail.com>
1 parent 75c6206 commit e5bb706

File tree

5 files changed

+98
-4
lines changed

5 files changed

+98
-4
lines changed

docs/_docs/analysis-types/known-vulnerabilities.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ analyzed.
4545
VulnDB is a source of vulnerability intelligence that provides its own content. Refer to
4646
[VulnDB (Datasource)]({{ site.baseurl }}{% link _docs/datasources/vulndb.md %}) for additional information.
4747

48-
### Analysis Interval Throttle
48+
### Analysis Result Cache
4949

5050
Dependency-Track contains an internal limiter which prevents repeated requests to remote services when performing
51-
vulnerability analysis. When a components Package URL or CPE is successfully used for a given analyzer, the action
52-
and the timestamp is recorded and compared to the interval throttle. The interval throttle defaults to 24 hours.
51+
vulnerability analysis. When a component's Package URL or CPE is successfully analyzed by a given analyzer,
52+
the result is cached. By default, cache entries expire after 12 hours.

docs/_posts/2022-11-18-v4.6.3.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: v4.6.3
3+
type: patch
4+
---
5+
6+
This release fixes a defect in the caching of vulnerability analysis results from external sources.
7+
There are no changes for the frontend, the latest version of it remains 4.6.1.
8+
9+
**Fixes:**
10+
11+
* Resolved a defect that caused the [component analysis cache] validity period to be too short - [#2115]
12+
13+
**Upgrade Notes:**
14+
15+
* The value of the `scanner.analysis.cache.validity.period` configuration property will be reset to 12 hours
16+
during the automated upgrade. No manual actions are required.
17+
18+
For a complete list of changes, refer to the respective GitHub milestones:
19+
20+
* [API server milestone 4.6.3](https://github.com/DependencyTrack/dependency-track/milestone/30?closed=1)
21+
22+
###### dependency-track-apiserver.jar
23+
24+
| Algorithm | Checksum |
25+
|:----------|:---------|
26+
| SHA-1 | |
27+
| SHA-256 | |
28+
29+
###### dependency-track-bundled.jar
30+
31+
| Algorithm | Checksum |
32+
|:----------|:---------|
33+
| SHA-1 | |
34+
| SHA-256 | |
35+
36+
###### Software Bill of Materials (SBOM)
37+
38+
* API Server: [bom.json](https://github.com/DependencyTrack/dependency-track/releases/download/4.6.3/bom.json)
39+
40+
[#2115]: https://github.com/DependencyTrack/dependency-track/issues/2115
41+
[component analysis cache]: {{ site.baseurl }}{% link _docs/analysis-types/known-vulnerabilities.md %}#analysis-result-cache

src/main/java/org/dependencytrack/model/ConfigPropertyConstants.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public enum ConfigPropertyConstants {
4646
SCANNER_VULNDB_ENABLED("scanner", "vulndb.enabled", "false", PropertyType.BOOLEAN, "Flag to enable/disable VulnDB"),
4747
SCANNER_VULNDB_OAUTH1_CONSUMER_KEY("scanner", "vulndb.api.oauth1.consumerKey", null, PropertyType.STRING, "The OAuth 1.0a consumer key"),
4848
SCANNER_VULNDB_OAUTH1_CONSUMER_SECRET("scanner", "vulndb.api.oath1.consumerSecret", null, PropertyType.ENCRYPTEDSTRING, "The OAuth 1.0a consumer secret"),
49-
SCANNER_ANALYSIS_CACHE_VALIDITY_PERIOD("scanner", "analysis.cache.validity.period","864000", PropertyType.NUMBER, "Validity period for individual component analysis cache"),
49+
SCANNER_ANALYSIS_CACHE_VALIDITY_PERIOD("scanner", "analysis.cache.validity.period","43200000", PropertyType.NUMBER, "Validity period for individual component analysis cache"),
5050
VULNERABILITY_SOURCE_NVD_ENABLED("vuln-source", "nvd.enabled", "true", PropertyType.BOOLEAN, "Flag to enable/disable National Vulnerability Database"),
5151
VULNERABILITY_SOURCE_NVD_FEEDS_URL("vuln-source", "nvd.feeds.url", "https://nvd.nist.gov/feeds", PropertyType.URL, "A base URL pointing to the hostname and path of the NVD feeds"),
5252
VULNERABILITY_SOURCE_GITHUB_ADVISORIES_ENABLED("vuln-source", "github.advisories.enabled", "false", PropertyType.BOOLEAN, "Flag to enable/disable GitHub Advisories"),

src/main/java/org/dependencytrack/upgrade/UpgradeItems.java

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class UpgradeItems {
3333
UPGRADE_ITEMS.add(org.dependencytrack.upgrade.v440.v440Updater.class);
3434
UPGRADE_ITEMS.add(org.dependencytrack.upgrade.v450.v450Updater.class);
3535
UPGRADE_ITEMS.add(org.dependencytrack.upgrade.v460.v460Updater.class);
36+
UPGRADE_ITEMS.add(org.dependencytrack.upgrade.v463.v463Updater.class);
3637
}
3738

3839
static List<Class<? extends UpgradeItem>> getUpgradeItems() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* This file is part of Dependency-Track.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* SPDX-License-Identifier: Apache-2.0
17+
* Copyright (c) Steve Springett. All Rights Reserved.
18+
*/
19+
package org.dependencytrack.upgrade.v463;
20+
21+
import alpine.common.logging.Logger;
22+
import alpine.persistence.AlpineQueryManager;
23+
import alpine.server.upgrade.AbstractUpgradeItem;
24+
25+
import java.sql.Connection;
26+
import java.sql.PreparedStatement;
27+
28+
import static org.dependencytrack.model.ConfigPropertyConstants.SCANNER_ANALYSIS_CACHE_VALIDITY_PERIOD;
29+
30+
public class v463Updater extends AbstractUpgradeItem {
31+
32+
private static final Logger LOGGER = Logger.getLogger(v463Updater.class);
33+
34+
@Override
35+
public String getSchemaVersion() {
36+
return "4.6.3";
37+
}
38+
39+
@Override
40+
public void executeUpgrade(final AlpineQueryManager qm, final Connection connection) throws Exception {
41+
LOGGER.info("Resetting scanner cache validity period to 12h");
42+
final PreparedStatement ps = connection.prepareStatement("""
43+
UPDATE "CONFIGPROPERTY" SET "PROPERTYVALUE" = ?
44+
WHERE "GROUPNAME" = ? AND "PROPERTYNAME" = ?
45+
""");
46+
ps.setString(1, SCANNER_ANALYSIS_CACHE_VALIDITY_PERIOD.getDefaultPropertyValue());
47+
ps.setString(2, SCANNER_ANALYSIS_CACHE_VALIDITY_PERIOD.getGroupName());
48+
ps.setString(3, SCANNER_ANALYSIS_CACHE_VALIDITY_PERIOD.getPropertyName());
49+
ps.executeUpdate();
50+
}
51+
52+
}

0 commit comments

Comments
 (0)