Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .github/workflows/false-positive-ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ jobs:
}
purl += '@.*$';
var cpe = process.env.CPE.trim().replaceAll(/^`|`$/g,'').split(':');
var matchCpe;
var cpe22UriPrefix;
if (cpe[1] == '2.3') {
matchcpe = 'cpe:/a:' + cpe[3] + ':' + cpe[4];
cpe22UriPrefix = 'cpe:/a:' + cpe[3] + ':' + cpe[4] + ':';
} else {
matchcpe = 'cpe:/a:' + cpe[2] + ':' + cpe[3];
cpe22UriPrefix = 'cpe:/a:' + cpe[2] + ':' + cpe[3] + ':';
}

await github.rest.issues.createComment({
Expand All @@ -189,7 +189,7 @@ jobs:
' FP per issue #' + context.issue.number + '\n' +
' ]]></notes>\n' +
' <packageUrl regex="true">' + purl + '</packageUrl>\n' +
' <cpe>' + matchcpe + '</cpe>\n' +
' <cpe>' + cpe22UriPrefix + '</cpe>\n' +
'</suppress>\n```\n\n' +
'Link to test results: ' + context.serverUrl + '/' + context.repo.owner + '/' + context.repo.repo + '/actions/runs/' + context.runId
})
Expand Down Expand Up @@ -218,11 +218,11 @@ jobs:
purl += '@.*$';
var cpe = process.env.CPE.trim().replaceAll(/^`|`$/g,'').split(':');
console.log(cpe);
var matchCpe;
var cpe22UriPrefix;
if (cpe[1] == '2.3') {
matchcpe = 'cpe:/a:' + cpe[3] + ':' + cpe[4];
cpe22UriPrefix = 'cpe:/a:' + cpe[3] + ':' + cpe[4] + ':';
} else {
matchcpe = 'cpe:/a:' + cpe[2] + ':' + cpe[3];
cpe22UriPrefix = 'cpe:/a:' + cpe[2] + ':' + cpe[3] + ':';
}

await github.rest.issues.createComment({
Expand All @@ -236,7 +236,7 @@ jobs:
' FP per issue #' + context.issue.number + '\n' +
' ]]></notes>\n' +
' <packageUrl regex="true">' + purl + '</packageUrl>\n' +
' <cpe>' + matchcpe + '</cpe>\n' +
' <cpe>' + cpe22UriPrefix + '</cpe>\n' +
'</suppress>\n```\n\n' +
'Link to test results: ' + context.serverUrl + '/' + context.repo.owner + '/' + context.repo.repo + '/actions/runs/' + context.runId
})
Expand Down Expand Up @@ -264,11 +264,11 @@ jobs:
}
purl += '@.*$';
var cpe = process.env.CPE.trim().replaceAll(/^`|`$/g,'').split(':');
var matchCpe;
var cpe22UriPrefix;
if (cpe[1] == '2.3') {
matchcpe = 'cpe:/a:' + cpe[3] + ':' + cpe[4];
cpe22UriPrefix = 'cpe:/a:' + cpe[3] + ':' + cpe[4] + ':';
} else {
matchcpe = 'cpe:/a:' + cpe[2] + ':' + cpe[3];
cpe22UriPrefix = 'cpe:/a:' + cpe[2] + ':' + cpe[3] + ':';
}

await github.rest.issues.createComment({
Expand All @@ -282,7 +282,7 @@ jobs:
' FP per issue #' + context.issue.number + '\n' +
' ]]></notes>\n' +
' <packageUrl regex="true">' + purl + '</packageUrl>\n' +
' <cpe>' + matchcpe + '</cpe>\n' +
' <cpe>' + cpe22UriPrefix + '</cpe>\n' +
'</suppress>\n```\n\n' +
'Link to test results: ' + context.serverUrl + '/' + context.repo.owner + '/' + context.repo.repo + '/actions/runs/' + context.runId
})
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/publish-suppressions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Publish Suppressions

on:
workflow_dispatch:
push:
branches:
- generatedSuppressions

permissions: {}
jobs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.owasp.dependencycheck.Engine;
import org.owasp.dependencycheck.ant.logging.AntTaskHolder;
import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
import org.owasp.dependencycheck.data.update.exception.UpdateException;
import org.owasp.dependencycheck.utils.Downloader;
import org.owasp.dependencycheck.utils.InvalidSettingException;
import org.owasp.dependencycheck.utils.Settings;
import org.owasp.dependencycheck.ant.logging.AntTaskHolder;

/**
* An Ant task definition to execute dependency-check update. This will download
Expand Down Expand Up @@ -203,7 +203,7 @@ public class Update extends Purge {
*/
private Boolean hostedSuppressionsForceUpdate;
/**
* Whether the hosted suppressions file will be used. Defaults to true.
* Whether the hosted suppressions will be updated from the configured URL. Defaults to true.
*/
private Boolean hostedSuppressionsEnabled;
/**
Expand Down
2 changes: 1 addition & 1 deletion ant/src/site/markdown/config-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The following properties can be configured in the plugin. However, they are less
| connectionString | The connection string used to connect to the database. See using a [database server](../data/database.html). | &nbsp; |
| databaseUser | The username used when connecting to the database. | &nbsp; |
| databasePassword | The password used when connecting to the database. | &nbsp; |
| hostedSuppressionsEnabled | Whether the hosted suppression file will be used. | true |
| hostedSuppressionsEnabled | Whether the hosted suppressions will be updated from the configured URL. | true |
| 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 |
| hostedSuppressionsUser | The user for a Basic-auth-protected mirrored copy of the hosted suppressions file for internet-constrained environments | &nbsp; |
| hostedSuppressionsPassword | The password/token for a Basic-auth-protected mirrored copy of the hosted suppressions file for internet-constrained environments | &nbsp; |
Expand Down
2 changes: 1 addition & 1 deletion ant/src/site/markdown/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ The following properties can be configured in the plugin. However, they are less
| connectionString | The connection string used to connect to the database. See using a [database server](../data/database.html). | &nbsp; |
| databaseUser | The username used when connecting to the database. | &nbsp; |
| databasePassword | The password used when connecting to the database. | &nbsp; |
| hostedSuppressionsEnabled | Whether the hosted suppression file will be used. | true |
| hostedSuppressionsEnabled | Whether the hosted suppressions will be updated from the configured URL. | true |
| 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 |
| hostedSuppressionsUser | The user for a Basic-auth-protected mirrored copy of the hosted suppressions file for internet-constrained environments | &nbsp; |
| hostedSuppressionsPassword | The password/token for a Basic-auth-protected mirrored copy of the hosted suppressions file for internet-constrained environments | &nbsp; |
Expand Down
22 changes: 13 additions & 9 deletions cli/src/main/java/org/owasp/dependencycheck/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.FileAppender;
import org.apache.commons.cli.ParseException;
import org.apache.commons.lang3.StringUtils;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.types.LogLevel;
import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
Expand All @@ -46,6 +47,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -95,6 +97,14 @@ public static void main(String[] args) {
*/
public App() {
settings = new Settings();
settings.setString(Settings.KEYS.APPLICATION_NAME, determineName());
}

private static String determineName() {
return Optional.ofNullable(System.getenv("ODC_NAME"))
.filter(StringUtils::isNotBlank)
.map(n -> n.replace('/', '-').replace(' ', '_'))
.orElse("dependency-check-cli");
}

/**
Expand All @@ -120,11 +130,11 @@ public int run(String[] args) {
cli.parse(args);
} catch (FileNotFoundException ex) {
System.err.println(ex.getMessage());
cli.printHelp();
cli.printHelp(System.out);
return 1;
} catch (ParseException ex) {
System.err.println(ex.getMessage());
cli.printHelp();
cli.printHelp(System.out);
return 2;
}
final String verboseLog = cli.getStringArgument(CliParser.ARGUMENT.VERBOSE_LOG);
Expand Down Expand Up @@ -224,7 +234,7 @@ public int run(String[] args) {
settings.cleanup();
}
} else {
cli.printHelp();
cli.printHelp(System.out);
}
return exitCode;
}
Expand Down Expand Up @@ -456,12 +466,6 @@ private void runUpdateOnly() throws UpdateException, DatabaseException {
* file is unable to be loaded.
*/
protected void populateSettings(CliParser cli) throws InvalidSettingException {
String name = System.getenv("ODC_NAME") != null ? System.getenv("ODC_NAME") : "dependency-check-cli";
if (name.isBlank()) {
name = "dependency-check-cli";
}
name = name.replace("/", "-").replace(" ", "_");
settings.setString(Settings.KEYS.APPLICATION_NAME, name);
final File propertiesFile = cli.getFileArgument(CliParser.ARGUMENT.PROP);
if (propertiesFile != null) {
try {
Expand Down
Loading
Loading