| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
package org.owasp.dependencycheck.maven; |
| 19 | |
|
| 20 | |
import java.io.BufferedOutputStream; |
| 21 | |
import java.io.File; |
| 22 | |
import java.io.FileInputStream; |
| 23 | |
import java.io.FileNotFoundException; |
| 24 | |
import java.io.FileOutputStream; |
| 25 | |
import java.io.IOException; |
| 26 | |
import java.io.InputStream; |
| 27 | |
import java.io.ObjectOutputStream; |
| 28 | |
import java.util.List; |
| 29 | |
import java.util.Locale; |
| 30 | |
import org.apache.maven.artifact.Artifact; |
| 31 | |
import org.apache.maven.doxia.sink.Sink; |
| 32 | |
import org.apache.maven.plugin.AbstractMojo; |
| 33 | |
import org.apache.maven.plugin.MojoExecutionException; |
| 34 | |
import org.apache.maven.plugin.MojoFailureException; |
| 35 | |
import org.apache.maven.plugins.annotations.Component; |
| 36 | |
import org.apache.maven.plugins.annotations.Parameter; |
| 37 | |
import org.apache.maven.project.MavenProject; |
| 38 | |
import org.apache.maven.reporting.MavenReport; |
| 39 | |
import org.apache.maven.reporting.MavenReportException; |
| 40 | |
import org.apache.maven.settings.Proxy; |
| 41 | |
import org.apache.maven.settings.Server; |
| 42 | |
import org.owasp.dependencycheck.data.nexus.MavenArtifact; |
| 43 | |
import org.owasp.dependencycheck.data.nvdcve.CveDB; |
| 44 | |
import org.owasp.dependencycheck.data.nvdcve.DatabaseException; |
| 45 | |
import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties; |
| 46 | |
import org.owasp.dependencycheck.dependency.Confidence; |
| 47 | |
import org.owasp.dependencycheck.dependency.Dependency; |
| 48 | |
import org.owasp.dependencycheck.dependency.Identifier; |
| 49 | |
import org.owasp.dependencycheck.dependency.Vulnerability; |
| 50 | |
import org.owasp.dependencycheck.reporting.ReportGenerator; |
| 51 | |
import org.owasp.dependencycheck.utils.ExpectedOjectInputStream; |
| 52 | |
import org.owasp.dependencycheck.utils.Settings; |
| 53 | |
import org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher; |
| 54 | |
import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher; |
| 55 | |
import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; |
| 56 | |
|
| 57 | |
|
| 58 | |
|
| 59 | |
|
| 60 | |
|
| 61 | 0 | public abstract class BaseDependencyCheckMojo extends AbstractMojo implements MavenReport { |
| 62 | |
|
| 63 | |
|
| 64 | |
|
| 65 | |
|
| 66 | |
|
| 67 | |
private static final String PROPERTIES_FILE = "mojo.properties"; |
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | 0 | private static final String NEW_LINE = System.getProperty("line.separator", "\n").intern(); |
| 72 | |
|
| 73 | |
|
| 74 | |
|
| 75 | |
@Parameter(property = "metaFileName", defaultValue = "dependency-check.ser", required = true) |
| 76 | |
private String dataFileName; |
| 77 | |
|
| 78 | |
|
| 79 | |
|
| 80 | |
|
| 81 | |
|
| 82 | |
|
| 83 | |
@Parameter(property = "project", required = true, readonly = true) |
| 84 | |
private MavenProject project; |
| 85 | |
|
| 86 | |
|
| 87 | |
|
| 88 | |
@Parameter(readonly = true, required = true, property = "reactorProjects") |
| 89 | |
private List<MavenProject> reactorProjects; |
| 90 | |
|
| 91 | |
|
| 92 | |
|
| 93 | |
|
| 94 | |
@Parameter(defaultValue = "${project.build.directory}", required = true) |
| 95 | |
private File outputDirectory; |
| 96 | |
|
| 97 | |
|
| 98 | |
|
| 99 | |
@Parameter(property = "project.reporting.outputDirectory", required = true) |
| 100 | |
private File reportOutputDirectory; |
| 101 | |
|
| 102 | |
|
| 103 | |
|
| 104 | |
|
| 105 | 0 | @SuppressWarnings("CanBeFinal") |
| 106 | |
@Parameter(property = "failBuildOnCVSS", defaultValue = "11", required = true) |
| 107 | |
private float failBuildOnCVSS = 11; |
| 108 | |
|
| 109 | |
|
| 110 | |
|
| 111 | |
|
| 112 | |
@SuppressWarnings("CanBeFinal") |
| 113 | |
@Parameter(property = "autoUpdate") |
| 114 | |
private Boolean autoUpdate; |
| 115 | |
|
| 116 | |
|
| 117 | |
|
| 118 | |
|
| 119 | |
|
| 120 | |
@Parameter(property = "aggregate") |
| 121 | |
@Deprecated |
| 122 | |
private Boolean aggregate; |
| 123 | |
|
| 124 | |
|
| 125 | |
|
| 126 | |
|
| 127 | 0 | @SuppressWarnings("CanBeFinal") |
| 128 | |
@Parameter(property = "format", defaultValue = "HTML", required = true) |
| 129 | |
private String format = "HTML"; |
| 130 | |
|
| 131 | |
|
| 132 | |
|
| 133 | |
@Parameter(property = "mavenSettings", defaultValue = "${settings}", required = false) |
| 134 | |
private org.apache.maven.settings.Settings mavenSettings; |
| 135 | |
|
| 136 | |
|
| 137 | |
|
| 138 | |
|
| 139 | |
@SuppressWarnings("CanBeFinal") |
| 140 | |
@Parameter(property = "mavenSettingsProxyId", required = false) |
| 141 | |
private String mavenSettingsProxyId; |
| 142 | |
|
| 143 | |
|
| 144 | |
|
| 145 | |
|
| 146 | |
@Parameter(property = "connectionTimeout", defaultValue = "", required = false) |
| 147 | |
private String connectionTimeout; |
| 148 | |
|
| 149 | |
|
| 150 | |
|
| 151 | |
@Parameter(property = "suppressionFile", defaultValue = "", required = false) |
| 152 | |
private String suppressionFile; |
| 153 | |
|
| 154 | |
|
| 155 | |
|
| 156 | 0 | @Parameter(property = "showSummary", defaultValue = "true", required = false) |
| 157 | |
private boolean showSummary = true; |
| 158 | |
|
| 159 | |
|
| 160 | |
|
| 161 | |
|
| 162 | |
@Parameter(property = "jarAnalyzerEnabled", required = false) |
| 163 | |
private Boolean jarAnalyzerEnabled; |
| 164 | |
|
| 165 | |
|
| 166 | |
|
| 167 | |
|
| 168 | |
@Parameter(property = "archiveAnalyzerEnabled", required = false) |
| 169 | |
private Boolean archiveAnalyzerEnabled; |
| 170 | |
|
| 171 | |
|
| 172 | |
|
| 173 | |
|
| 174 | |
@Parameter(property = "pyDistributionAnalyzerEnabled", required = false) |
| 175 | |
private Boolean pyDistributionAnalyzerEnabled; |
| 176 | |
|
| 177 | |
|
| 178 | |
|
| 179 | |
@Parameter(property = "pyPackageAnalyzerEnabled", required = false) |
| 180 | |
private Boolean pyPackageAnalyzerEnabled; |
| 181 | |
|
| 182 | |
|
| 183 | |
|
| 184 | |
@Parameter(property = "rubygemsAnalyzerEnabled", required = false) |
| 185 | |
private Boolean rubygemsAnalyzerEnabled; |
| 186 | |
|
| 187 | |
|
| 188 | |
|
| 189 | |
@Parameter(property = "opensslAnalyzerEnabled", required = false) |
| 190 | |
private Boolean opensslAnalyzerEnabled; |
| 191 | |
|
| 192 | |
|
| 193 | |
|
| 194 | |
@Parameter(property = "cmakeAnalyzerEnabled", required = false) |
| 195 | |
private Boolean cmakeAnalyzerEnabled; |
| 196 | |
|
| 197 | |
|
| 198 | |
|
| 199 | |
@Parameter(property = "autoconfAnalyzerEnabled", required = false) |
| 200 | |
private Boolean autoconfAnalyzerEnabled; |
| 201 | |
|
| 202 | |
|
| 203 | |
|
| 204 | |
@Parameter(property = "composerAnalyzerEnabled", required = false) |
| 205 | |
private Boolean composerAnalyzerEnabled; |
| 206 | |
|
| 207 | |
|
| 208 | |
|
| 209 | |
@Parameter(property = "nodeAnalyzerEnabled", required = false) |
| 210 | |
private Boolean nodeAnalyzerEnabled; |
| 211 | |
|
| 212 | |
|
| 213 | |
|
| 214 | |
|
| 215 | |
@Parameter(property = "assemblyAnalyzerEnabled", required = false) |
| 216 | |
private Boolean assemblyAnalyzerEnabled; |
| 217 | |
|
| 218 | |
|
| 219 | |
|
| 220 | |
|
| 221 | |
@Parameter(property = "nuspecAnalyzerEnabled", required = false) |
| 222 | |
private Boolean nuspecAnalyzerEnabled; |
| 223 | |
|
| 224 | |
|
| 225 | |
|
| 226 | |
|
| 227 | |
@Parameter(property = "centralAnalyzerEnabled", required = false) |
| 228 | |
private Boolean centralAnalyzerEnabled; |
| 229 | |
|
| 230 | |
|
| 231 | |
|
| 232 | |
|
| 233 | |
@Parameter(property = "nexusAnalyzerEnabled", required = false) |
| 234 | |
private Boolean nexusAnalyzerEnabled; |
| 235 | |
|
| 236 | |
|
| 237 | |
|
| 238 | |
|
| 239 | |
@Parameter(property = "nexusUrl", required = false) |
| 240 | |
private String nexusUrl; |
| 241 | |
|
| 242 | |
|
| 243 | |
|
| 244 | |
@Parameter(property = "nexusUsesProxy", required = false) |
| 245 | |
private Boolean nexusUsesProxy; |
| 246 | |
|
| 247 | |
|
| 248 | |
|
| 249 | |
@Parameter(property = "connectionString", defaultValue = "", required = false) |
| 250 | |
private String connectionString; |
| 251 | |
|
| 252 | |
|
| 253 | |
|
| 254 | |
|
| 255 | |
|
| 256 | |
|
| 257 | |
protected String getConnectionString() { |
| 258 | 0 | return connectionString; |
| 259 | |
} |
| 260 | |
|
| 261 | |
|
| 262 | |
|
| 263 | |
@Parameter(property = "databaseDriverName", defaultValue = "", required = false) |
| 264 | |
private String databaseDriverName; |
| 265 | |
|
| 266 | |
|
| 267 | |
|
| 268 | |
@Parameter(property = "databaseDriverPath", defaultValue = "", required = false) |
| 269 | |
private String databaseDriverPath; |
| 270 | |
|
| 271 | |
|
| 272 | |
|
| 273 | |
@Parameter(property = "serverId", defaultValue = "", required = false) |
| 274 | |
private String serverId; |
| 275 | |
|
| 276 | |
|
| 277 | |
|
| 278 | |
@Parameter(defaultValue = "${settings}", readonly = true, required = true) |
| 279 | |
private org.apache.maven.settings.Settings settingsXml; |
| 280 | |
|
| 281 | |
|
| 282 | |
|
| 283 | |
@Component(role = SecDispatcher.class, hint = "default") |
| 284 | |
private SecDispatcher securityDispatcher; |
| 285 | |
|
| 286 | |
|
| 287 | |
|
| 288 | |
@Parameter(property = "databaseUser", defaultValue = "", required = false) |
| 289 | |
private String databaseUser; |
| 290 | |
|
| 291 | |
|
| 292 | |
|
| 293 | |
@Parameter(property = "databasePassword", defaultValue = "", required = false) |
| 294 | |
private String databasePassword; |
| 295 | |
|
| 296 | |
|
| 297 | |
|
| 298 | |
@Parameter(property = "zipExtensions", required = false) |
| 299 | |
private String zipExtensions; |
| 300 | |
|
| 301 | |
|
| 302 | |
|
| 303 | 0 | @SuppressWarnings("CanBeFinal") |
| 304 | |
@Parameter(property = "dependency-check.skip", defaultValue = "false", required = false) |
| 305 | |
private boolean skip = false; |
| 306 | |
|
| 307 | |
|
| 308 | |
|
| 309 | 0 | @SuppressWarnings("CanBeFinal") |
| 310 | |
@Parameter(property = "skipTestScope", defaultValue = "true", required = false) |
| 311 | |
private boolean skipTestScope = true; |
| 312 | |
|
| 313 | |
|
| 314 | |
|
| 315 | 0 | @SuppressWarnings("CanBeFinal") |
| 316 | |
@Parameter(property = "skipRuntimeScope", defaultValue = "false", required = false) |
| 317 | |
private boolean skipRuntimeScope = false; |
| 318 | |
|
| 319 | |
|
| 320 | |
|
| 321 | 0 | @SuppressWarnings("CanBeFinal") |
| 322 | |
@Parameter(property = "skipProvidedScope", defaultValue = "false", required = false) |
| 323 | |
private boolean skipProvidedScope = false; |
| 324 | |
|
| 325 | |
|
| 326 | |
|
| 327 | |
@Parameter(property = "dataDirectory", defaultValue = "", required = false) |
| 328 | |
private String dataDirectory; |
| 329 | |
|
| 330 | |
|
| 331 | |
|
| 332 | |
@Parameter(property = "cveUrl12Modified", defaultValue = "", required = false) |
| 333 | |
private String cveUrl12Modified; |
| 334 | |
|
| 335 | |
|
| 336 | |
|
| 337 | |
@Parameter(property = "cveUrl20Modified", defaultValue = "", required = false) |
| 338 | |
private String cveUrl20Modified; |
| 339 | |
|
| 340 | |
|
| 341 | |
|
| 342 | |
@Parameter(property = "cveUrl12Base", defaultValue = "", required = false) |
| 343 | |
private String cveUrl12Base; |
| 344 | |
|
| 345 | |
|
| 346 | |
|
| 347 | |
@Parameter(property = "cveUrl20Base", defaultValue = "", required = false) |
| 348 | |
private String cveUrl20Base; |
| 349 | |
|
| 350 | |
|
| 351 | |
|
| 352 | |
@Parameter(property = "cveValidForHours", defaultValue = "", required = false) |
| 353 | |
private Integer cveValidForHours; |
| 354 | |
|
| 355 | |
|
| 356 | |
|
| 357 | |
|
| 358 | |
@Parameter(property = "pathToMono", defaultValue = "", required = false) |
| 359 | |
private String pathToMono; |
| 360 | |
|
| 361 | |
|
| 362 | |
|
| 363 | |
|
| 364 | |
|
| 365 | |
|
| 366 | 0 | @SuppressWarnings("CanBeFinal") |
| 367 | |
@Parameter(property = "proxyUrl", defaultValue = "", required = false) |
| 368 | |
@Deprecated |
| 369 | |
private String proxyUrl = null; |
| 370 | |
|
| 371 | |
|
| 372 | |
|
| 373 | |
|
| 374 | |
|
| 375 | 0 | @SuppressWarnings("CanBeFinal") |
| 376 | |
@Parameter(property = "externalReport") |
| 377 | |
@Deprecated |
| 378 | |
private String externalReport = null; |
| 379 | |
|
| 380 | |
|
| 381 | |
|
| 382 | |
|
| 383 | |
|
| 384 | |
|
| 385 | |
|
| 386 | |
|
| 387 | |
|
| 388 | |
@Override |
| 389 | |
public void execute() throws MojoExecutionException, MojoFailureException { |
| 390 | 0 | generatingSite = false; |
| 391 | 0 | if (skip) { |
| 392 | 0 | getLog().info("Skipping " + getName(Locale.US)); |
| 393 | |
} else { |
| 394 | 0 | validateAggregate(); |
| 395 | 0 | project.setContextValue(getOutputDirectoryContextKey(), this.outputDirectory); |
| 396 | 0 | runCheck(); |
| 397 | |
} |
| 398 | 0 | } |
| 399 | |
|
| 400 | |
|
| 401 | |
|
| 402 | |
|
| 403 | |
|
| 404 | |
|
| 405 | |
|
| 406 | |
private void validateAggregate() throws MojoExecutionException { |
| 407 | 0 | if (aggregate != null && aggregate) { |
| 408 | 0 | final String msg = "Aggregate configuration detected - as of dependency-check 1.2.8 this no longer supported. " |
| 409 | |
+ "Please use the aggregate goal instead."; |
| 410 | 0 | throw new MojoExecutionException(msg); |
| 411 | |
} |
| 412 | 0 | } |
| 413 | |
|
| 414 | |
|
| 415 | |
|
| 416 | |
|
| 417 | |
|
| 418 | |
|
| 419 | |
|
| 420 | |
|
| 421 | |
|
| 422 | |
@Override |
| 423 | |
@Deprecated |
| 424 | |
public final void generate(@SuppressWarnings("deprecation") org.codehaus.doxia.sink.Sink sink, Locale locale) throws MavenReportException { |
| 425 | 0 | generate((Sink) sink, locale); |
| 426 | 0 | } |
| 427 | |
|
| 428 | |
|
| 429 | |
|
| 430 | |
|
| 431 | 0 | private boolean generatingSite = false; |
| 432 | |
|
| 433 | |
|
| 434 | |
|
| 435 | |
|
| 436 | |
|
| 437 | |
|
| 438 | |
protected boolean isGeneratingSite() { |
| 439 | 0 | return generatingSite; |
| 440 | |
} |
| 441 | |
|
| 442 | |
|
| 443 | |
|
| 444 | |
|
| 445 | |
|
| 446 | |
|
| 447 | |
|
| 448 | |
|
| 449 | |
public void generate(Sink sink, Locale locale) throws MavenReportException { |
| 450 | 0 | generatingSite = true; |
| 451 | |
try { |
| 452 | 0 | validateAggregate(); |
| 453 | 0 | } catch (MojoExecutionException ex) { |
| 454 | 0 | throw new MavenReportException(ex.getMessage()); |
| 455 | 0 | } |
| 456 | 0 | project.setContextValue(getOutputDirectoryContextKey(), getReportOutputDirectory()); |
| 457 | |
try { |
| 458 | 0 | runCheck(); |
| 459 | 0 | } catch (MojoExecutionException ex) { |
| 460 | 0 | throw new MavenReportException(ex.getMessage(), ex); |
| 461 | 0 | } catch (MojoFailureException ex) { |
| 462 | 0 | getLog().warn("Vulnerabilities were identifies that exceed the CVSS threshold for failing the build"); |
| 463 | 0 | } |
| 464 | 0 | } |
| 465 | |
|
| 466 | |
|
| 467 | |
|
| 468 | |
|
| 469 | |
|
| 470 | |
|
| 471 | |
|
| 472 | |
protected File getCorrectOutputDirectory() throws MojoExecutionException { |
| 473 | 0 | return getCorrectOutputDirectory(this.project); |
| 474 | |
} |
| 475 | |
|
| 476 | |
|
| 477 | |
|
| 478 | |
|
| 479 | |
|
| 480 | |
|
| 481 | |
|
| 482 | |
protected File getCorrectOutputDirectory(MavenProject current) { |
| 483 | 0 | final Object obj = current.getContextValue(getOutputDirectoryContextKey()); |
| 484 | 0 | if (obj != null && obj instanceof File) { |
| 485 | 0 | return (File) obj; |
| 486 | |
} |
| 487 | 0 | File target = new File(current.getBuild().getDirectory()); |
| 488 | 0 | if (target.getParentFile() != null && "target".equals(target.getParentFile().getName())) { |
| 489 | 0 | target = target.getParentFile(); |
| 490 | |
} |
| 491 | 0 | return target; |
| 492 | |
} |
| 493 | |
|
| 494 | |
|
| 495 | |
|
| 496 | |
|
| 497 | |
|
| 498 | |
|
| 499 | |
|
| 500 | |
protected File getDataFile(MavenProject current) { |
| 501 | 0 | if (getLog().isDebugEnabled()) { |
| 502 | 0 | getLog().debug(String.format("Getting data filefor %s using key '%s'", current.getName(), getDataFileContextKey())); |
| 503 | |
} |
| 504 | 0 | final Object obj = current.getContextValue(getDataFileContextKey()); |
| 505 | 0 | if (obj != null) { |
| 506 | 0 | if (obj instanceof String) { |
| 507 | 0 | final File f = new File((String) obj); |
| 508 | 0 | return f; |
| 509 | |
} |
| 510 | |
} else { |
| 511 | 0 | if (getLog().isDebugEnabled()) { |
| 512 | 0 | getLog().debug("Context value not found"); |
| 513 | |
} |
| 514 | |
} |
| 515 | 0 | return null; |
| 516 | |
} |
| 517 | |
|
| 518 | |
|
| 519 | |
|
| 520 | |
|
| 521 | |
|
| 522 | |
|
| 523 | |
|
| 524 | |
protected void scanArtifacts(MavenProject project, Engine engine) { |
| 525 | 0 | for (Artifact a : project.getArtifacts()) { |
| 526 | 0 | if (excludeFromScan(a)) { |
| 527 | 0 | continue; |
| 528 | |
} |
| 529 | 0 | final List<Dependency> deps = engine.scan(a.getFile().getAbsoluteFile()); |
| 530 | 0 | if (deps != null) { |
| 531 | 0 | if (deps.size() == 1) { |
| 532 | 0 | final Dependency d = deps.get(0); |
| 533 | 0 | if (d != null) { |
| 534 | 0 | final MavenArtifact ma = new MavenArtifact(a.getGroupId(), a.getArtifactId(), a.getVersion()); |
| 535 | 0 | d.addAsEvidence("pom", ma, Confidence.HIGHEST); |
| 536 | 0 | d.addProjectReference(project.getName()); |
| 537 | 0 | if (getLog().isDebugEnabled()) { |
| 538 | 0 | getLog().debug(String.format("Adding project reference %s on dependency %s", project.getName(), |
| 539 | 0 | d.getDisplayFileName())); |
| 540 | |
} |
| 541 | |
} |
| 542 | 0 | } else { |
| 543 | 0 | if (getLog().isDebugEnabled()) { |
| 544 | 0 | final String msg = String.format("More then 1 dependency was identified in first pass scan of '%s:%s:%s'", |
| 545 | 0 | a.getGroupId(), a.getArtifactId(), a.getVersion()); |
| 546 | 0 | getLog().debug(msg); |
| 547 | |
} |
| 548 | |
} |
| 549 | |
} |
| 550 | 0 | } |
| 551 | 0 | } |
| 552 | |
|
| 553 | |
|
| 554 | |
|
| 555 | |
|
| 556 | |
|
| 557 | |
|
| 558 | |
|
| 559 | |
public abstract void runCheck() throws MojoExecutionException, MojoFailureException; |
| 560 | |
|
| 561 | |
|
| 562 | |
|
| 563 | |
|
| 564 | |
|
| 565 | |
|
| 566 | |
@Override |
| 567 | |
public void setReportOutputDirectory(File directory) { |
| 568 | 0 | reportOutputDirectory = directory; |
| 569 | 0 | } |
| 570 | |
|
| 571 | |
|
| 572 | |
|
| 573 | |
|
| 574 | |
|
| 575 | |
|
| 576 | |
@Override |
| 577 | |
public File getReportOutputDirectory() { |
| 578 | 0 | return reportOutputDirectory; |
| 579 | |
} |
| 580 | |
|
| 581 | |
|
| 582 | |
|
| 583 | |
|
| 584 | |
|
| 585 | |
|
| 586 | |
public File getOutputDirectory() { |
| 587 | 0 | return outputDirectory; |
| 588 | |
} |
| 589 | |
|
| 590 | |
|
| 591 | |
|
| 592 | |
|
| 593 | |
|
| 594 | |
|
| 595 | |
@Override |
| 596 | |
public final boolean isExternalReport() { |
| 597 | 0 | return true; |
| 598 | |
} |
| 599 | |
|
| 600 | |
|
| 601 | |
|
| 602 | |
|
| 603 | |
|
| 604 | |
|
| 605 | |
@Override |
| 606 | |
public String getOutputName() { |
| 607 | 0 | if ("HTML".equalsIgnoreCase(this.format) || "ALL".equalsIgnoreCase(this.format)) { |
| 608 | 0 | return "dependency-check-report"; |
| 609 | 0 | } else if ("XML".equalsIgnoreCase(this.format)) { |
| 610 | 0 | return "dependency-check-report.xml#"; |
| 611 | 0 | } else if ("VULN".equalsIgnoreCase(this.format)) { |
| 612 | 0 | return "dependency-check-vulnerability"; |
| 613 | |
} else { |
| 614 | 0 | getLog().warn("Unknown report format used during site generation."); |
| 615 | 0 | return "dependency-check-report"; |
| 616 | |
} |
| 617 | |
} |
| 618 | |
|
| 619 | |
|
| 620 | |
|
| 621 | |
|
| 622 | |
|
| 623 | |
|
| 624 | |
@Override |
| 625 | |
public String getCategoryName() { |
| 626 | 0 | return MavenReport.CATEGORY_PROJECT_REPORTS; |
| 627 | |
} |
| 628 | |
|
| 629 | |
|
| 630 | |
|
| 631 | |
|
| 632 | |
|
| 633 | |
|
| 634 | |
|
| 635 | |
|
| 636 | |
protected Engine initializeEngine() throws DatabaseException { |
| 637 | 0 | populateSettings(); |
| 638 | 0 | return new Engine(this.project, |
| 639 | |
this.reactorProjects); |
| 640 | |
} |
| 641 | |
|
| 642 | |
|
| 643 | |
|
| 644 | |
|
| 645 | |
|
| 646 | |
protected void populateSettings() { |
| 647 | 0 | Settings.initialize(); |
| 648 | 0 | InputStream mojoProperties = null; |
| 649 | |
try { |
| 650 | 0 | mojoProperties = this.getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE); |
| 651 | 0 | Settings.mergeProperties(mojoProperties); |
| 652 | 0 | } catch (IOException ex) { |
| 653 | 0 | getLog().warn("Unable to load the dependency-check ant task.properties file."); |
| 654 | 0 | if (getLog().isDebugEnabled()) { |
| 655 | 0 | getLog().debug("", ex); |
| 656 | |
} |
| 657 | |
} finally { |
| 658 | 0 | if (mojoProperties != null) { |
| 659 | |
try { |
| 660 | 0 | mojoProperties.close(); |
| 661 | 0 | } catch (IOException ex) { |
| 662 | 0 | if (getLog().isDebugEnabled()) { |
| 663 | 0 | getLog().debug("", ex); |
| 664 | |
} |
| 665 | 0 | } |
| 666 | |
} |
| 667 | |
} |
| 668 | 0 | Settings.setBooleanIfNotNull(Settings.KEYS.AUTO_UPDATE, autoUpdate); |
| 669 | |
|
| 670 | 0 | if (externalReport != null) { |
| 671 | 0 | getLog().warn("The 'externalReport' option was set; this configuration option has been removed. " |
| 672 | |
+ "Please update the dependency-check-maven plugin's configuration"); |
| 673 | |
} |
| 674 | |
|
| 675 | 0 | if (proxyUrl != null && !proxyUrl.isEmpty()) { |
| 676 | 0 | getLog().warn("Deprecated configuration detected, proxyUrl will be ignored; use the maven settings " + "to configure the proxy instead"); |
| 677 | |
} |
| 678 | 0 | final Proxy proxy = getMavenProxy(); |
| 679 | 0 | if (proxy != null) { |
| 680 | 0 | Settings.setString(Settings.KEYS.PROXY_SERVER, proxy.getHost()); |
| 681 | 0 | Settings.setString(Settings.KEYS.PROXY_PORT, Integer.toString(proxy.getPort())); |
| 682 | 0 | final String userName = proxy.getUsername(); |
| 683 | 0 | final String password = proxy.getPassword(); |
| 684 | 0 | Settings.setStringIfNotNull(Settings.KEYS.PROXY_USERNAME, userName); |
| 685 | 0 | Settings.setStringIfNotNull(Settings.KEYS.PROXY_PASSWORD, password); |
| 686 | 0 | Settings.setStringIfNotNull(Settings.KEYS.PROXY_NON_PROXY_HOSTS, proxy.getNonProxyHosts()); |
| 687 | |
} |
| 688 | |
|
| 689 | 0 | Settings.setStringIfNotEmpty(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); |
| 690 | 0 | Settings.setStringIfNotEmpty(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); |
| 691 | |
|
| 692 | |
|
| 693 | 0 | Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_JAR_ENABLED, jarAnalyzerEnabled); |
| 694 | 0 | Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, nuspecAnalyzerEnabled); |
| 695 | 0 | Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled); |
| 696 | 0 | Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled); |
| 697 | 0 | Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); |
| 698 | 0 | Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY, nexusUsesProxy); |
| 699 | 0 | Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, assemblyAnalyzerEnabled); |
| 700 | 0 | Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, archiveAnalyzerEnabled); |
| 701 | 0 | Settings.setStringIfNotEmpty(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions); |
| 702 | 0 | Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono); |
| 703 | |
|
| 704 | 0 | Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, pyDistributionAnalyzerEnabled); |
| 705 | 0 | Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, pyPackageAnalyzerEnabled); |
| 706 | 0 | Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED, rubygemsAnalyzerEnabled); |
| 707 | 0 | Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, opensslAnalyzerEnabled); |
| 708 | 0 | Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_CMAKE_ENABLED, cmakeAnalyzerEnabled); |
| 709 | 0 | Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, autoconfAnalyzerEnabled); |
| 710 | 0 | Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_COMPOSER_LOCK_ENABLED, composerAnalyzerEnabled); |
| 711 | 0 | Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED, nodeAnalyzerEnabled); |
| 712 | |
|
| 713 | |
|
| 714 | 0 | Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); |
| 715 | 0 | Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); |
| 716 | 0 | Settings.setStringIfNotEmpty(Settings.KEYS.DB_CONNECTION_STRING, connectionString); |
| 717 | |
|
| 718 | 0 | if (databaseUser == null && databasePassword == null && serverId != null) { |
| 719 | 0 | final Server server = settingsXml.getServer(serverId); |
| 720 | 0 | if (server != null) { |
| 721 | 0 | databaseUser = server.getUsername(); |
| 722 | |
try { |
| 723 | |
|
| 724 | |
|
| 725 | |
|
| 726 | |
|
| 727 | |
|
| 728 | |
|
| 729 | |
|
| 730 | 0 | if (securityDispatcher instanceof DefaultSecDispatcher) { |
| 731 | 0 | ((DefaultSecDispatcher) securityDispatcher).setConfigurationFile("~/.m2/settings-security.xml"); |
| 732 | |
} |
| 733 | |
|
| 734 | 0 | databasePassword = securityDispatcher.decrypt(server.getPassword()); |
| 735 | 0 | } catch (SecDispatcherException ex) { |
| 736 | 0 | if (ex.getCause() instanceof FileNotFoundException |
| 737 | 0 | || (ex.getCause() != null && ex.getCause().getCause() instanceof FileNotFoundException)) { |
| 738 | |
|
| 739 | 0 | final String tmp = server.getPassword(); |
| 740 | 0 | if (tmp.startsWith("{") && tmp.endsWith("}")) { |
| 741 | 0 | getLog().error(String.format( |
| 742 | |
"Unable to decrypt the server password for server id '%s' in settings.xml%n\tCause: %s", |
| 743 | 0 | serverId, ex.getMessage())); |
| 744 | |
} else { |
| 745 | 0 | databasePassword = tmp; |
| 746 | |
} |
| 747 | 0 | } else { |
| 748 | 0 | getLog().error(String.format( |
| 749 | |
"Unable to decrypt the server password for server id '%s' in settings.xml%n\tCause: %s", |
| 750 | 0 | serverId, ex.getMessage())); |
| 751 | |
} |
| 752 | 0 | } |
| 753 | |
} else { |
| 754 | 0 | getLog().error(String.format("Server '%s' not found in the settings.xml file", serverId)); |
| 755 | |
} |
| 756 | |
} |
| 757 | |
|
| 758 | 0 | Settings.setStringIfNotEmpty(Settings.KEYS.DB_USER, databaseUser); |
| 759 | 0 | Settings.setStringIfNotEmpty(Settings.KEYS.DB_PASSWORD, databasePassword); |
| 760 | 0 | Settings.setStringIfNotEmpty(Settings.KEYS.DATA_DIRECTORY, dataDirectory); |
| 761 | |
|
| 762 | 0 | Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified); |
| 763 | 0 | Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified); |
| 764 | 0 | Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base); |
| 765 | 0 | Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base); |
| 766 | 0 | Settings.setIntIfNotNull(Settings.KEYS.CVE_CHECK_VALID_FOR_HOURS, cveValidForHours); |
| 767 | |
|
| 768 | 0 | } |
| 769 | |
|
| 770 | |
|
| 771 | |
|
| 772 | |
|
| 773 | |
|
| 774 | |
|
| 775 | |
private Proxy getMavenProxy() { |
| 776 | 0 | if (mavenSettings != null) { |
| 777 | 0 | final List<Proxy> proxies = mavenSettings.getProxies(); |
| 778 | 0 | if (proxies != null && !proxies.isEmpty()) { |
| 779 | 0 | if (mavenSettingsProxyId != null) { |
| 780 | 0 | for (Proxy proxy : proxies) { |
| 781 | 0 | if (mavenSettingsProxyId.equalsIgnoreCase(proxy.getId())) { |
| 782 | 0 | return proxy; |
| 783 | |
} |
| 784 | 0 | } |
| 785 | 0 | } else if (proxies.size() == 1) { |
| 786 | 0 | return proxies.get(0); |
| 787 | |
} else { |
| 788 | 0 | getLog().warn("Multiple proxy definitions exist in the Maven settings. In the dependency-check " |
| 789 | |
+ "configuration set the mavenSettingsProxyId so that the correct proxy will be used."); |
| 790 | 0 | throw new IllegalStateException("Ambiguous proxy definition"); |
| 791 | |
} |
| 792 | |
} |
| 793 | |
} |
| 794 | 0 | return null; |
| 795 | |
} |
| 796 | |
|
| 797 | |
|
| 798 | |
|
| 799 | |
|
| 800 | |
|
| 801 | |
|
| 802 | |
|
| 803 | |
protected boolean excludeFromScan(Artifact a) { |
| 804 | 0 | if (skipTestScope && Artifact.SCOPE_TEST.equals(a.getScope())) { |
| 805 | 0 | return true; |
| 806 | |
} |
| 807 | 0 | if (skipProvidedScope && Artifact.SCOPE_PROVIDED.equals(a.getScope())) { |
| 808 | 0 | return true; |
| 809 | |
} |
| 810 | 0 | if (skipRuntimeScope && !Artifact.SCOPE_RUNTIME.equals(a.getScope())) { |
| 811 | 0 | return true; |
| 812 | |
} |
| 813 | 0 | return false; |
| 814 | |
} |
| 815 | |
|
| 816 | |
|
| 817 | |
|
| 818 | |
|
| 819 | |
|
| 820 | |
|
| 821 | |
|
| 822 | |
|
| 823 | |
|
| 824 | |
protected MavenProject getProject() { |
| 825 | 0 | return project; |
| 826 | |
} |
| 827 | |
|
| 828 | |
|
| 829 | |
|
| 830 | |
|
| 831 | |
|
| 832 | |
|
| 833 | |
protected List<MavenProject> getReactorProjects() { |
| 834 | 0 | return reactorProjects; |
| 835 | |
} |
| 836 | |
|
| 837 | |
|
| 838 | |
|
| 839 | |
|
| 840 | |
|
| 841 | |
|
| 842 | |
protected String getFormat() { |
| 843 | 0 | return format; |
| 844 | |
} |
| 845 | |
|
| 846 | |
|
| 847 | |
|
| 848 | |
|
| 849 | |
|
| 850 | |
|
| 851 | |
|
| 852 | |
|
| 853 | |
protected void writeReports(Engine engine, MavenProject p, File outputDir) { |
| 854 | 0 | DatabaseProperties prop = null; |
| 855 | 0 | CveDB cve = null; |
| 856 | |
try { |
| 857 | 0 | cve = new CveDB(); |
| 858 | 0 | cve.open(); |
| 859 | 0 | prop = cve.getDatabaseProperties(); |
| 860 | 0 | } catch (DatabaseException ex) { |
| 861 | 0 | if (getLog().isDebugEnabled()) { |
| 862 | 0 | getLog().debug("Unable to retrieve DB Properties", ex); |
| 863 | |
} |
| 864 | |
} finally { |
| 865 | 0 | if (cve != null) { |
| 866 | 0 | cve.close(); |
| 867 | |
} |
| 868 | |
} |
| 869 | 0 | final ReportGenerator r = new ReportGenerator(p.getName(), engine.getDependencies(), engine.getAnalyzers(), prop); |
| 870 | |
try { |
| 871 | 0 | r.generateReports(outputDir.getAbsolutePath(), format); |
| 872 | 0 | } catch (IOException ex) { |
| 873 | 0 | getLog().error( |
| 874 | |
"Unexpected exception occurred during analysis; please see the verbose error log for more details."); |
| 875 | 0 | if (getLog().isDebugEnabled()) { |
| 876 | 0 | getLog().debug("", ex); |
| 877 | |
} |
| 878 | 0 | } catch (Throwable ex) { |
| 879 | 0 | getLog().error( |
| 880 | |
"Unexpected exception occurred during analysis; please see the verbose error log for more details."); |
| 881 | 0 | if (getLog().isDebugEnabled()) { |
| 882 | 0 | getLog().debug("", ex); |
| 883 | |
} |
| 884 | 0 | } |
| 885 | 0 | } |
| 886 | |
|
| 887 | |
|
| 888 | |
|
| 889 | |
|
| 890 | |
|
| 891 | |
|
| 892 | |
|
| 893 | |
|
| 894 | |
|
| 895 | |
protected void checkForFailure(List<Dependency> dependencies) throws MojoFailureException { |
| 896 | 0 | if (failBuildOnCVSS <= 10) { |
| 897 | 0 | final StringBuilder ids = new StringBuilder(); |
| 898 | 0 | for (Dependency d : dependencies) { |
| 899 | 0 | boolean addName = true; |
| 900 | 0 | for (Vulnerability v : d.getVulnerabilities()) { |
| 901 | 0 | if (v.getCvssScore() >= failBuildOnCVSS) { |
| 902 | 0 | if (addName) { |
| 903 | 0 | addName = false; |
| 904 | 0 | ids.append(NEW_LINE).append(d.getFileName()).append(": "); |
| 905 | 0 | ids.append(v.getName()); |
| 906 | |
} else { |
| 907 | 0 | ids.append(", ").append(v.getName()); |
| 908 | |
} |
| 909 | |
} |
| 910 | 0 | } |
| 911 | 0 | } |
| 912 | 0 | if (ids.length() > 0) { |
| 913 | 0 | final String msg = String.format("%n%nDependency-Check Failure:%n" |
| 914 | |
+ "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n" |
| 915 | 0 | + "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString()); |
| 916 | 0 | throw new MojoFailureException(msg); |
| 917 | |
} |
| 918 | |
} |
| 919 | 0 | } |
| 920 | |
|
| 921 | |
|
| 922 | |
|
| 923 | |
|
| 924 | |
|
| 925 | |
|
| 926 | |
|
| 927 | |
protected void showSummary(MavenProject mp, List<Dependency> dependencies) { |
| 928 | 0 | if (showSummary) { |
| 929 | 0 | final StringBuilder summary = new StringBuilder(); |
| 930 | 0 | for (Dependency d : dependencies) { |
| 931 | 0 | boolean firstEntry = true; |
| 932 | 0 | final StringBuilder ids = new StringBuilder(); |
| 933 | 0 | for (Vulnerability v : d.getVulnerabilities()) { |
| 934 | 0 | if (firstEntry) { |
| 935 | 0 | firstEntry = false; |
| 936 | |
} else { |
| 937 | 0 | ids.append(", "); |
| 938 | |
} |
| 939 | 0 | ids.append(v.getName()); |
| 940 | 0 | } |
| 941 | 0 | if (ids.length() > 0) { |
| 942 | 0 | summary.append(d.getFileName()).append(" ("); |
| 943 | 0 | firstEntry = true; |
| 944 | 0 | for (Identifier id : d.getIdentifiers()) { |
| 945 | 0 | if (firstEntry) { |
| 946 | 0 | firstEntry = false; |
| 947 | |
} else { |
| 948 | 0 | summary.append(", "); |
| 949 | |
} |
| 950 | 0 | summary.append(id.getValue()); |
| 951 | 0 | } |
| 952 | 0 | summary.append(") : ").append(ids).append(NEW_LINE); |
| 953 | |
} |
| 954 | 0 | } |
| 955 | 0 | if (summary.length() > 0) { |
| 956 | 0 | final String msg = String.format("%n%n" + "One or more dependencies were identified with known vulnerabilities in %s:%n%n%s" |
| 957 | 0 | + "%n%nSee the dependency-check report for more details.%n%n", mp.getName(), summary.toString()); |
| 958 | 0 | getLog().warn(msg); |
| 959 | |
} |
| 960 | |
} |
| 961 | 0 | } |
| 962 | |
|
| 963 | |
|
| 964 | |
|
| 965 | |
|
| 966 | |
|
| 967 | |
|
| 968 | |
|
| 969 | |
|
| 970 | |
|
| 971 | |
protected String getDataFileContextKey() { |
| 972 | 0 | return "dependency-check-path-" + dataFileName; |
| 973 | |
} |
| 974 | |
|
| 975 | |
|
| 976 | |
|
| 977 | |
|
| 978 | |
|
| 979 | |
|
| 980 | |
|
| 981 | |
protected String getOutputDirectoryContextKey() { |
| 982 | 0 | return "dependency-output-dir-" + dataFileName; |
| 983 | |
} |
| 984 | |
|
| 985 | |
|
| 986 | |
|
| 987 | |
|
| 988 | |
|
| 989 | |
|
| 990 | |
|
| 991 | |
|
| 992 | |
protected void writeDataFile(MavenProject mp, File writeTo, List<Dependency> dependencies) { |
| 993 | |
File file; |
| 994 | |
|
| 995 | 0 | if (mp.getContextValue(this.getDataFileContextKey()) == null) { |
| 996 | 0 | if (writeTo == null) { |
| 997 | 0 | file = new File(mp.getBuild().getDirectory()); |
| 998 | 0 | file = new File(file, dataFileName); |
| 999 | |
} else { |
| 1000 | 0 | file = new File(writeTo, dataFileName); |
| 1001 | |
} |
| 1002 | 0 | final File parent = file.getParentFile(); |
| 1003 | 0 | if (!parent.isDirectory() && parent.mkdirs()) { |
| 1004 | 0 | getLog().error(String.format("Directory '%s' does not exist and cannot be created; unable to write data file.", |
| 1005 | 0 | parent.getAbsolutePath())); |
| 1006 | |
} |
| 1007 | |
|
| 1008 | 0 | ObjectOutputStream out = null; |
| 1009 | |
try { |
| 1010 | 0 | if (dependencies != null) { |
| 1011 | 0 | out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file))); |
| 1012 | 0 | out.writeObject(dependencies); |
| 1013 | |
} |
| 1014 | 0 | if (getLog().isDebugEnabled()) { |
| 1015 | 0 | getLog().debug(String.format("Serialized data file written to '%s' for %s, referenced by key %s", |
| 1016 | 0 | file.getAbsolutePath(), mp.getName(), this.getDataFileContextKey())); |
| 1017 | |
} |
| 1018 | 0 | mp.setContextValue(this.getDataFileContextKey(), file.getAbsolutePath()); |
| 1019 | 0 | } catch (IOException ex) { |
| 1020 | 0 | getLog().warn("Unable to create data file used for report aggregation; " |
| 1021 | |
+ "if report aggregation is being used the results may be incomplete."); |
| 1022 | 0 | if (getLog().isDebugEnabled()) { |
| 1023 | 0 | getLog().debug(ex.getMessage(), ex); |
| 1024 | |
} |
| 1025 | |
} finally { |
| 1026 | 0 | if (out != null) { |
| 1027 | |
try { |
| 1028 | 0 | out.close(); |
| 1029 | 0 | } catch (IOException ex) { |
| 1030 | 0 | if (getLog().isDebugEnabled()) { |
| 1031 | 0 | getLog().debug("ignore", ex); |
| 1032 | |
} |
| 1033 | 0 | } |
| 1034 | |
} |
| 1035 | |
} |
| 1036 | |
} |
| 1037 | 0 | } |
| 1038 | |
|
| 1039 | |
|
| 1040 | |
|
| 1041 | |
|
| 1042 | |
|
| 1043 | |
|
| 1044 | |
|
| 1045 | |
|
| 1046 | |
|
| 1047 | |
protected List<Dependency> readDataFile(MavenProject project) { |
| 1048 | 0 | final Object oPath = project.getContextValue(this.getDataFileContextKey()); |
| 1049 | 0 | if (oPath == null) { |
| 1050 | 0 | return null; |
| 1051 | |
} |
| 1052 | 0 | List<Dependency> ret = null; |
| 1053 | 0 | final String path = (String) oPath; |
| 1054 | |
|
| 1055 | 0 | ExpectedOjectInputStream ois = null; |
| 1056 | |
try { |
| 1057 | |
|
| 1058 | 0 | ois = new ExpectedOjectInputStream(new FileInputStream(path), |
| 1059 | |
"java.util.ArrayList", |
| 1060 | |
"java.util.HashSet", |
| 1061 | |
"java.util.TreeSet", |
| 1062 | |
"java.lang.AbstractSet", |
| 1063 | |
"java.lang.AbstractCollection", |
| 1064 | |
"java.lang.Enum", |
| 1065 | |
"org.owasp.dependencycheck.dependency.Confidence", |
| 1066 | |
"org.owasp.dependencycheck.dependency.Dependency", |
| 1067 | |
"org.owasp.dependencycheck.dependency.Evidence", |
| 1068 | |
"org.owasp.dependencycheck.dependency.EvidenceCollection", |
| 1069 | |
"org.owasp.dependencycheck.dependency.Identifier", |
| 1070 | |
"org.owasp.dependencycheck.dependency.Reference", |
| 1071 | |
"org.owasp.dependencycheck.dependency.Vulnerability", |
| 1072 | |
"org.owasp.dependencycheck.dependency.VulnerabilityComparator", |
| 1073 | |
"org.owasp.dependencycheck.dependency.VulnerableSoftware", |
| 1074 | |
"org.owasp.dependencycheck.data.cpe.IndexEntry"); |
| 1075 | 0 | ret = (List<Dependency>) ois.readObject(); |
| 1076 | 0 | } catch (FileNotFoundException ex) { |
| 1077 | |
|
| 1078 | 0 | getLog().error("", ex); |
| 1079 | 0 | } catch (IOException ex) { |
| 1080 | 0 | getLog().error("", ex); |
| 1081 | 0 | } catch (ClassNotFoundException ex) { |
| 1082 | 0 | getLog().error("", ex); |
| 1083 | |
} finally { |
| 1084 | 0 | if (ois != null) { |
| 1085 | |
try { |
| 1086 | 0 | ois.close(); |
| 1087 | 0 | } catch (IOException ex) { |
| 1088 | 0 | getLog().error("", ex); |
| 1089 | 0 | } |
| 1090 | |
} |
| 1091 | |
} |
| 1092 | 0 | return ret; |
| 1093 | |
} |
| 1094 | |
|
| 1095 | |
} |