Skip to content

Commit 0252f49

Browse files
authored
Merge branch 'main' into oss-index-docs
2 parents 4929152 + f03b7dc commit 0252f49

45 files changed

Lines changed: 2022 additions & 1328 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ jobs:
171171
}
172172
purl += '@.*$';
173173
var cpe = process.env.CPE.trim().replaceAll(/^`|`$/g,'').split(':');
174-
var matchCpe;
174+
var cpe22UriPrefix;
175175
if (cpe[1] == '2.3') {
176-
matchcpe = 'cpe:/a:' + cpe[3] + ':' + cpe[4];
176+
cpe22UriPrefix = 'cpe:/a:' + cpe[3] + ':' + cpe[4] + ':';
177177
} else {
178-
matchcpe = 'cpe:/a:' + cpe[2] + ':' + cpe[3];
178+
cpe22UriPrefix = 'cpe:/a:' + cpe[2] + ':' + cpe[3] + ':';
179179
}
180180
181181
await github.rest.issues.createComment({
@@ -189,7 +189,7 @@ jobs:
189189
' FP per issue #' + context.issue.number + '\n' +
190190
' ]]></notes>\n' +
191191
' <packageUrl regex="true">' + purl + '</packageUrl>\n' +
192-
' <cpe>' + matchcpe + '</cpe>\n' +
192+
' <cpe>' + cpe22UriPrefix + '</cpe>\n' +
193193
'</suppress>\n```\n\n' +
194194
'Link to test results: ' + context.serverUrl + '/' + context.repo.owner + '/' + context.repo.repo + '/actions/runs/' + context.runId
195195
})
@@ -218,11 +218,11 @@ jobs:
218218
purl += '@.*$';
219219
var cpe = process.env.CPE.trim().replaceAll(/^`|`$/g,'').split(':');
220220
console.log(cpe);
221-
var matchCpe;
221+
var cpe22UriPrefix;
222222
if (cpe[1] == '2.3') {
223-
matchcpe = 'cpe:/a:' + cpe[3] + ':' + cpe[4];
223+
cpe22UriPrefix = 'cpe:/a:' + cpe[3] + ':' + cpe[4] + ':';
224224
} else {
225-
matchcpe = 'cpe:/a:' + cpe[2] + ':' + cpe[3];
225+
cpe22UriPrefix = 'cpe:/a:' + cpe[2] + ':' + cpe[3] + ':';
226226
}
227227
228228
await github.rest.issues.createComment({
@@ -236,7 +236,7 @@ jobs:
236236
' FP per issue #' + context.issue.number + '\n' +
237237
' ]]></notes>\n' +
238238
' <packageUrl regex="true">' + purl + '</packageUrl>\n' +
239-
' <cpe>' + matchcpe + '</cpe>\n' +
239+
' <cpe>' + cpe22UriPrefix + '</cpe>\n' +
240240
'</suppress>\n```\n\n' +
241241
'Link to test results: ' + context.serverUrl + '/' + context.repo.owner + '/' + context.repo.repo + '/actions/runs/' + context.runId
242242
})
@@ -264,11 +264,11 @@ jobs:
264264
}
265265
purl += '@.*$';
266266
var cpe = process.env.CPE.trim().replaceAll(/^`|`$/g,'').split(':');
267-
var matchCpe;
267+
var cpe22UriPrefix;
268268
if (cpe[1] == '2.3') {
269-
matchcpe = 'cpe:/a:' + cpe[3] + ':' + cpe[4];
269+
cpe22UriPrefix = 'cpe:/a:' + cpe[3] + ':' + cpe[4] + ':';
270270
} else {
271-
matchcpe = 'cpe:/a:' + cpe[2] + ':' + cpe[3];
271+
cpe22UriPrefix = 'cpe:/a:' + cpe[2] + ':' + cpe[3] + ':';
272272
}
273273
274274
await github.rest.issues.createComment({
@@ -282,7 +282,7 @@ jobs:
282282
' FP per issue #' + context.issue.number + '\n' +
283283
' ]]></notes>\n' +
284284
' <packageUrl regex="true">' + purl + '</packageUrl>\n' +
285-
' <cpe>' + matchcpe + '</cpe>\n' +
285+
' <cpe>' + cpe22UriPrefix + '</cpe>\n' +
286286
'</suppress>\n```\n\n' +
287287
'Link to test results: ' + context.serverUrl + '/' + context.repo.owner + '/' + context.repo.repo + '/actions/runs/' + context.runId
288288
})

.github/workflows/publish-suppressions.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Publish Suppressions
22

33
on:
44
workflow_dispatch:
5+
push:
6+
branches:
7+
- generatedSuppressions
58

69
permissions: {}
710
jobs:

ant/src/main/java/org/owasp/dependencycheck/taskdefs/Update.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
import org.apache.tools.ant.BuildException;
2121
import org.apache.tools.ant.Project;
2222
import org.owasp.dependencycheck.Engine;
23+
import org.owasp.dependencycheck.ant.logging.AntTaskHolder;
2324
import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
2425
import org.owasp.dependencycheck.data.update.exception.UpdateException;
2526
import org.owasp.dependencycheck.utils.Downloader;
2627
import org.owasp.dependencycheck.utils.InvalidSettingException;
2728
import org.owasp.dependencycheck.utils.Settings;
28-
import org.owasp.dependencycheck.ant.logging.AntTaskHolder;
2929

3030
/**
3131
* An Ant task definition to execute dependency-check update. This will download
@@ -203,7 +203,7 @@ public class Update extends Purge {
203203
*/
204204
private Boolean hostedSuppressionsForceUpdate;
205205
/**
206-
* Whether the hosted suppressions file will be used. Defaults to true.
206+
* Whether the hosted suppressions will be updated from the configured URL. Defaults to true.
207207
*/
208208
private Boolean hostedSuppressionsEnabled;
209209
/**

ant/src/site/markdown/config-update.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ The following properties can be configured in the plugin. However, they are less
5050
| connectionString | The connection string used to connect to the database. See using a [database server](../data/database.html). | &nbsp; |
5151
| databaseUser | The username used when connecting to the database. | &nbsp; |
5252
| databasePassword | The password used when connecting to the database. | &nbsp; |
53-
| hostedSuppressionsEnabled | Whether the hosted suppression file will be used. | true |
53+
| hostedSuppressionsEnabled | Whether the hosted suppressions will be updated from the configured URL. | true |
5454
| hostedSuppressionsUrl | The URL to a mirrored copy of the hosted suppressions file for internet-constrained environments | https://dependency-check.github.io/DependencyCheck/suppressions/publishedSuppressions.xml |
5555
| hostedSuppressionsUser | The user for a Basic-auth-protected mirrored copy of the hosted suppressions file for internet-constrained environments | &nbsp; |
5656
| hostedSuppressionsPassword | The password/token for a Basic-auth-protected mirrored copy of the hosted suppressions file for internet-constrained environments | &nbsp; |

ant/src/site/markdown/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ The following properties can be configured in the plugin. However, they are less
166166
| connectionString | The connection string used to connect to the database. See using a [database server](../data/database.html). | &nbsp; |
167167
| databaseUser | The username used when connecting to the database. | &nbsp; |
168168
| databasePassword | The password used when connecting to the database. | &nbsp; |
169-
| hostedSuppressionsEnabled | Whether the hosted suppression file will be used. | true |
169+
| hostedSuppressionsEnabled | Whether the hosted suppressions will be updated from the configured URL. | true |
170170
| hostedSuppressionsUrl | The URL to a mirrored copy of the hosted suppressions file for internet-constrained environments | https://dependency-check.github.io/DependencyCheck/suppressions/publishedSuppressions.xml |
171171
| hostedSuppressionsUser | The user for a Basic-auth-protected mirrored copy of the hosted suppressions file for internet-constrained environments | &nbsp; |
172172
| hostedSuppressionsPassword | The password/token for a Basic-auth-protected mirrored copy of the hosted suppressions file for internet-constrained environments | &nbsp; |

cli/src/main/java/org/owasp/dependencycheck/App.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import ch.qos.logback.classic.spi.ILoggingEvent;
2525
import ch.qos.logback.core.FileAppender;
2626
import org.apache.commons.cli.ParseException;
27+
import org.apache.commons.lang3.StringUtils;
2728
import org.apache.tools.ant.DirectoryScanner;
2829
import org.apache.tools.ant.types.LogLevel;
2930
import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
@@ -46,6 +47,7 @@
4647
import java.io.IOException;
4748
import java.util.ArrayList;
4849
import java.util.List;
50+
import java.util.Optional;
4951
import java.util.Set;
5052
import java.util.TreeSet;
5153
import java.util.stream.Collectors;
@@ -95,6 +97,14 @@ public static void main(String[] args) {
9597
*/
9698
public App() {
9799
settings = new Settings();
100+
settings.setString(Settings.KEYS.APPLICATION_NAME, determineName());
101+
}
102+
103+
private static String determineName() {
104+
return Optional.ofNullable(System.getenv("ODC_NAME"))
105+
.filter(StringUtils::isNotBlank)
106+
.map(n -> n.replace('/', '-').replace(' ', '_'))
107+
.orElse("dependency-check-cli");
98108
}
99109

100110
/**
@@ -120,11 +130,11 @@ public int run(String[] args) {
120130
cli.parse(args);
121131
} catch (FileNotFoundException ex) {
122132
System.err.println(ex.getMessage());
123-
cli.printHelp();
133+
cli.printHelp(System.out);
124134
return 1;
125135
} catch (ParseException ex) {
126136
System.err.println(ex.getMessage());
127-
cli.printHelp();
137+
cli.printHelp(System.out);
128138
return 2;
129139
}
130140
final String verboseLog = cli.getStringArgument(CliParser.ARGUMENT.VERBOSE_LOG);
@@ -224,7 +234,7 @@ public int run(String[] args) {
224234
settings.cleanup();
225235
}
226236
} else {
227-
cli.printHelp();
237+
cli.printHelp(System.out);
228238
}
229239
return exitCode;
230240
}
@@ -456,12 +466,6 @@ private void runUpdateOnly() throws UpdateException, DatabaseException {
456466
* file is unable to be loaded.
457467
*/
458468
protected void populateSettings(CliParser cli) throws InvalidSettingException {
459-
String name = System.getenv("ODC_NAME") != null ? System.getenv("ODC_NAME") : "dependency-check-cli";
460-
if (name.isBlank()) {
461-
name = "dependency-check-cli";
462-
}
463-
name = name.replace("/", "-").replace(" ", "_");
464-
settings.setString(Settings.KEYS.APPLICATION_NAME, name);
465469
final File propertiesFile = cli.getFileArgument(CliParser.ARGUMENT.PROP);
466470
if (propertiesFile != null) {
467471
try {

0 commit comments

Comments
 (0)