Skip to content

Commit 0cce495

Browse files
committed
added validation
1 parent 1c05346 commit 0cce495

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,16 @@ private Process launchBundleAudit(File folder) throws AnalysisException {
114114
throw new AnalysisException(String.format("%s should have been a directory.", folder.getAbsolutePath()));
115115
}
116116
final List<String> args = new ArrayList<String>();
117-
final String bundleAuditPath = Settings.getString(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_PATH);
118-
args.add(null == bundleAuditPath ? "bundle-audit" : bundleAuditPath);
117+
String bundleAuditPath = Settings.getString(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_PATH);
118+
File bundleAudit = null;
119+
if (bundleAuditPath != null) {
120+
bundleAudit = new File(bundleAuditPath);
121+
if (!bundleAudit.isFile()) {
122+
LOGGER.warn("Supplied `bundleAudit` path is incorrect: " + bundleAuditPath);
123+
bundleAudit = null;
124+
}
125+
}
126+
args.add(bundleAudit != null && bundleAudit.isFile() ? bundleAudit.getAbsolutePath() : "bundle-audit");
119127
args.add("check");
120128
args.add("--verbose");
121129
final ProcessBuilder builder = new ProcessBuilder(args);

0 commit comments

Comments
 (0)