1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.owasp.dependencycheck.taskdefs;
19
20 import java.io.File;
21 import java.util.List;
22 import org.apache.tools.ant.BuildException;
23 import org.apache.tools.ant.Project;
24 import org.apache.tools.ant.types.EnumeratedAttribute;
25 import org.apache.tools.ant.types.Reference;
26 import org.apache.tools.ant.types.Resource;
27 import org.apache.tools.ant.types.ResourceCollection;
28 import org.apache.tools.ant.types.resources.FileProvider;
29 import org.apache.tools.ant.types.resources.Resources;
30 import org.owasp.dependencycheck.Engine;
31 import org.owasp.dependencycheck.data.nvdcve.CveDB;
32 import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
33 import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties;
34 import org.owasp.dependencycheck.data.update.exception.UpdateException;
35 import org.owasp.dependencycheck.dependency.Dependency;
36 import org.owasp.dependencycheck.dependency.Identifier;
37 import org.owasp.dependencycheck.dependency.Vulnerability;
38 import org.owasp.dependencycheck.exception.ExceptionCollection;
39 import org.owasp.dependencycheck.exception.ReportException;
40 import org.owasp.dependencycheck.reporting.ReportGenerator;
41 import org.owasp.dependencycheck.reporting.ReportGenerator.Format;
42 import org.owasp.dependencycheck.utils.Settings;
43 import org.slf4j.impl.StaticLoggerBinder;
44
45
46
47
48
49
50 public class Check extends Update {
51
52
53
54
55 private static final String NEW_LINE = System.getProperty("line.separator", "\n").intern();
56
57
58
59
60 public Check() {
61 super();
62
63
64 StaticLoggerBinder.getSingleton().setTask(this);
65 }
66
67
68
69
70
71 private Resources path = null;
72
73
74
75 private Reference refid = null;
76
77
78
79
80
81
82
83 public void add(ResourceCollection rc) {
84 if (isReference()) {
85 throw new BuildException("Nested elements are not allowed when using the refid attribute.");
86 }
87 getPath().add(rc);
88 }
89
90
91
92
93
94
95
96 private synchronized Resources getPath() {
97 if (path == null) {
98 path = new Resources(getProject());
99 path.setCache(true);
100 }
101 return path;
102 }
103
104
105
106
107
108
109 public boolean isReference() {
110 return refid != null;
111 }
112
113
114
115
116
117
118
119 public void setRefid(Reference r) {
120 if (path != null) {
121 throw new BuildException("Nested elements are not allowed when using the refid attribute.");
122 }
123 refid = r;
124 }
125
126
127
128
129
130
131
132 private void dealWithReferences() throws BuildException {
133 if (isReference()) {
134 final Object o = refid.getReferencedObject(getProject());
135 if (!(o instanceof ResourceCollection)) {
136 throw new BuildException("refid '" + refid.getRefId()
137 + "' does not refer to a resource collection.");
138 }
139 getPath().add((ResourceCollection) o);
140 }
141 }
142
143
144
145
146
147
148 @Deprecated
149 private String applicationName = null;
150
151
152
153
154
155
156
157
158 @Deprecated
159 public String getApplicationName() {
160 return applicationName;
161 }
162
163
164
165
166
167
168
169 @Deprecated
170 public void setApplicationName(String applicationName) {
171 this.applicationName = applicationName;
172 }
173
174
175
176 private String projectName = "dependency-check";
177
178
179
180
181
182
183 public String getProjectName() {
184 if (applicationName != null) {
185 log("Configuration 'applicationName' has been deprecated, please use 'projectName' instead", Project.MSG_WARN);
186 if ("dependency-check".equals(projectName)) {
187 projectName = applicationName;
188 }
189 }
190 return projectName;
191 }
192
193
194
195
196
197
198 public void setProjectName(String projectName) {
199 this.projectName = projectName;
200 }
201
202
203
204
205
206 private String reportOutputDirectory = ".";
207
208
209
210
211
212
213 public String getReportOutputDirectory() {
214 return reportOutputDirectory;
215 }
216
217
218
219
220
221
222 public void setReportOutputDirectory(String reportOutputDirectory) {
223 this.reportOutputDirectory = reportOutputDirectory;
224 }
225
226
227
228
229
230
231
232 private float failBuildOnCVSS = 11;
233
234
235
236
237
238
239 public float getFailBuildOnCVSS() {
240 return failBuildOnCVSS;
241 }
242
243
244
245
246
247
248 public void setFailBuildOnCVSS(float failBuildOnCVSS) {
249 this.failBuildOnCVSS = failBuildOnCVSS;
250 }
251
252
253
254
255 private Boolean autoUpdate;
256
257
258
259
260
261
262 public Boolean isAutoUpdate() {
263 return autoUpdate;
264 }
265
266
267
268
269
270
271 public void setAutoUpdate(Boolean autoUpdate) {
272 this.autoUpdate = autoUpdate;
273 }
274
275
276
277
278
279 @Deprecated
280 private boolean updateOnly = false;
281
282
283
284
285
286
287
288 @Deprecated
289 public boolean isUpdateOnly() {
290 return updateOnly;
291 }
292
293
294
295
296
297
298
299 @Deprecated
300 public void setUpdateOnly(boolean updateOnly) {
301 this.updateOnly = updateOnly;
302 }
303
304
305
306
307
308 private String reportFormat = "HTML";
309
310
311
312
313
314
315 public String getReportFormat() {
316 return reportFormat;
317 }
318
319
320
321
322
323
324 public void setReportFormat(ReportFormats reportFormat) {
325 this.reportFormat = reportFormat.getValue();
326 }
327
328
329
330 private String suppressionFile;
331
332
333
334
335
336
337 public String getSuppressionFile() {
338 return suppressionFile;
339 }
340
341
342
343
344
345
346 public void setSuppressionFile(String suppressionFile) {
347 this.suppressionFile = suppressionFile;
348 }
349
350
351
352 private String hintsFile;
353
354
355
356
357
358
359 public String getHintsFile() {
360 return hintsFile;
361 }
362
363
364
365
366
367
368 public void setHintsFile(String hintsFile) {
369 this.hintsFile = hintsFile;
370 }
371
372
373
374 private boolean showSummary = true;
375
376
377
378
379
380
381 public boolean isShowSummary() {
382 return showSummary;
383 }
384
385
386
387
388
389
390 public void setShowSummary(boolean showSummary) {
391 this.showSummary = showSummary;
392 }
393
394
395
396
397 private Boolean enableExperimental;
398
399
400
401
402
403
404 public Boolean isEnableExperimental() {
405 return enableExperimental;
406 }
407
408
409
410
411
412
413 public void setEnableExperimental(Boolean enableExperimental) {
414 this.enableExperimental = enableExperimental;
415 }
416
417
418
419
420 private Boolean jarAnalyzerEnabled;
421
422
423
424
425
426
427 public Boolean isJarAnalyzerEnabled() {
428 return jarAnalyzerEnabled;
429 }
430
431
432
433
434
435
436 public void setJarAnalyzerEnabled(Boolean jarAnalyzerEnabled) {
437 this.jarAnalyzerEnabled = jarAnalyzerEnabled;
438 }
439
440
441
442 private Boolean archiveAnalyzerEnabled;
443
444
445
446
447
448
449 public Boolean isArchiveAnalyzerEnabled() {
450 return archiveAnalyzerEnabled;
451 }
452
453
454
455 private Boolean assemblyAnalyzerEnabled;
456
457
458
459
460
461
462 public void setArchiveAnalyzerEnabled(Boolean archiveAnalyzerEnabled) {
463 this.archiveAnalyzerEnabled = archiveAnalyzerEnabled;
464 }
465
466
467
468
469
470
471 public Boolean isAssemblyAnalyzerEnabled() {
472 return assemblyAnalyzerEnabled;
473 }
474
475
476
477
478
479
480 public void setAssemblyAnalyzerEnabled(Boolean assemblyAnalyzerEnabled) {
481 this.assemblyAnalyzerEnabled = assemblyAnalyzerEnabled;
482 }
483
484
485
486 private Boolean nuspecAnalyzerEnabled;
487
488
489
490
491
492
493 public Boolean isNuspecAnalyzerEnabled() {
494 return nuspecAnalyzerEnabled;
495 }
496
497
498
499
500
501
502 public void setNuspecAnalyzerEnabled(Boolean nuspecAnalyzerEnabled) {
503 this.nuspecAnalyzerEnabled = nuspecAnalyzerEnabled;
504 }
505
506
507
508 private Boolean composerAnalyzerEnabled;
509
510
511
512
513
514
515 public Boolean isComposerAnalyzerEnabled() {
516 return composerAnalyzerEnabled;
517 }
518
519
520
521
522
523
524 public void setComposerAnalyzerEnabled(Boolean composerAnalyzerEnabled) {
525 this.composerAnalyzerEnabled = composerAnalyzerEnabled;
526 }
527
528
529
530 private Boolean autoconfAnalyzerEnabled;
531
532
533
534
535
536
537 public Boolean isAutoconfAnalyzerEnabled() {
538 return autoconfAnalyzerEnabled;
539 }
540
541
542
543
544
545
546 public void setAutoconfAnalyzerEnabled(Boolean autoconfAnalyzerEnabled) {
547 this.autoconfAnalyzerEnabled = autoconfAnalyzerEnabled;
548 }
549
550
551
552 private Boolean cmakeAnalyzerEnabled;
553
554
555
556
557
558
559 public Boolean isCMakeAnalyzerEnabled() {
560 return cmakeAnalyzerEnabled;
561 }
562
563
564
565
566
567
568 public void setCMakeAnalyzerEnabled(Boolean cmakeAnalyzerEnabled) {
569 this.cmakeAnalyzerEnabled = cmakeAnalyzerEnabled;
570 }
571
572
573
574
575
576 private Boolean bundleAuditAnalyzerEnabled;
577
578
579
580
581
582
583 public Boolean isBundleAuditAnalyzerEnabled() {
584 return bundleAuditAnalyzerEnabled;
585 }
586
587
588
589
590
591
592
593 public void setBundleAuditAnalyzerEnabled(Boolean bundleAuditAnalyzerEnabled) {
594 this.bundleAuditAnalyzerEnabled = bundleAuditAnalyzerEnabled;
595 }
596
597
598
599
600 private String bundleAuditPath;
601
602
603
604
605
606
607 public String getBundleAuditPath() {
608 return bundleAuditPath;
609 }
610
611
612
613
614
615
616 public void setBundleAuditPath(String bundleAuditPath) {
617 this.bundleAuditPath = bundleAuditPath;
618 }
619
620
621
622 private Boolean cocoapodsAnalyzerEnabled;
623
624
625
626
627
628
629 public boolean isCocoapodsAnalyzerEnabled() {
630 return cocoapodsAnalyzerEnabled;
631 }
632
633
634
635
636
637
638 public void setCocoapodsAnalyzerEnabled(Boolean cocoapodsAnalyzerEnabled) {
639 this.cocoapodsAnalyzerEnabled = cocoapodsAnalyzerEnabled;
640 }
641
642
643
644
645 private Boolean swiftPackageManagerAnalyzerEnabled;
646
647
648
649
650
651
652 public Boolean isSwiftPackageManagerAnalyzerEnabled() {
653 return swiftPackageManagerAnalyzerEnabled;
654 }
655
656
657
658
659
660
661
662 public void setSwiftPackageManagerAnalyzerEnabled(Boolean swiftPackageManagerAnalyzerEnabled) {
663 this.swiftPackageManagerAnalyzerEnabled = swiftPackageManagerAnalyzerEnabled;
664 }
665
666
667
668
669
670 private Boolean opensslAnalyzerEnabled;
671
672
673
674
675
676
677 public Boolean isOpensslAnalyzerEnabled() {
678 return opensslAnalyzerEnabled;
679 }
680
681
682
683
684
685
686 public void setOpensslAnalyzerEnabled(Boolean opensslAnalyzerEnabled) {
687 this.opensslAnalyzerEnabled = opensslAnalyzerEnabled;
688 }
689
690
691
692 private Boolean nodeAnalyzerEnabled;
693
694
695
696
697
698
699 public Boolean isNodeAnalyzerEnabled() {
700 return nodeAnalyzerEnabled;
701 }
702
703
704
705
706
707
708 public void setNodeAnalyzerEnabled(Boolean nodeAnalyzerEnabled) {
709 this.nodeAnalyzerEnabled = nodeAnalyzerEnabled;
710 }
711
712
713
714 private Boolean rubygemsAnalyzerEnabled;
715
716
717
718
719
720
721 public Boolean isRubygemsAnalyzerEnabled() {
722 return rubygemsAnalyzerEnabled;
723 }
724
725
726
727
728
729
730 public void setRubygemsAnalyzerEnabled(Boolean rubygemsAnalyzerEnabled) {
731 this.rubygemsAnalyzerEnabled = rubygemsAnalyzerEnabled;
732 }
733
734
735
736 private Boolean pyPackageAnalyzerEnabled;
737
738
739
740
741
742
743 public Boolean isPyPackageAnalyzerEnabled() {
744 return pyPackageAnalyzerEnabled;
745 }
746
747
748
749
750
751
752 public void setPyPackageAnalyzerEnabled(Boolean pyPackageAnalyzerEnabled) {
753 this.pyPackageAnalyzerEnabled = pyPackageAnalyzerEnabled;
754 }
755
756
757
758
759 private Boolean pyDistributionAnalyzerEnabled;
760
761
762
763
764
765
766 public Boolean isPyDistributionAnalyzerEnabled() {
767 return pyDistributionAnalyzerEnabled;
768 }
769
770
771
772
773
774
775
776 public void setPyDistributionAnalyzerEnabled(Boolean pyDistributionAnalyzerEnabled) {
777 this.pyDistributionAnalyzerEnabled = pyDistributionAnalyzerEnabled;
778 }
779
780
781
782
783 private Boolean centralAnalyzerEnabled;
784
785
786
787
788
789
790 public Boolean isCentralAnalyzerEnabled() {
791 return centralAnalyzerEnabled;
792 }
793
794
795
796
797
798
799 public void setCentralAnalyzerEnabled(Boolean centralAnalyzerEnabled) {
800 this.centralAnalyzerEnabled = centralAnalyzerEnabled;
801 }
802
803
804
805
806 private Boolean nexusAnalyzerEnabled;
807
808
809
810
811
812
813 public Boolean isNexusAnalyzerEnabled() {
814 return nexusAnalyzerEnabled;
815 }
816
817
818
819
820
821
822 public void setNexusAnalyzerEnabled(Boolean nexusAnalyzerEnabled) {
823 this.nexusAnalyzerEnabled = nexusAnalyzerEnabled;
824 }
825
826
827
828
829
830 private String nexusUrl;
831
832
833
834
835
836
837 public String getNexusUrl() {
838 return nexusUrl;
839 }
840
841
842
843
844
845
846 public void setNexusUrl(String nexusUrl) {
847 this.nexusUrl = nexusUrl;
848 }
849
850
851
852 private Boolean nexusUsesProxy;
853
854
855
856
857
858
859 public Boolean isNexusUsesProxy() {
860 return nexusUsesProxy;
861 }
862
863
864
865
866
867
868 public void setNexusUsesProxy(Boolean nexusUsesProxy) {
869 this.nexusUsesProxy = nexusUsesProxy;
870 }
871
872
873
874
875
876 private String zipExtensions;
877
878
879
880
881
882
883 public String getZipExtensions() {
884 return zipExtensions;
885 }
886
887
888
889
890
891
892 public void setZipExtensions(String zipExtensions) {
893 this.zipExtensions = zipExtensions;
894 }
895
896
897
898
899 private String pathToMono;
900
901
902
903
904
905
906 public String getPathToMono() {
907 return pathToMono;
908 }
909
910
911
912
913
914
915 public void setPathToMono(String pathToMono) {
916 this.pathToMono = pathToMono;
917 }
918
919 @Override
920 public void execute() throws BuildException {
921 dealWithReferences();
922 validateConfiguration();
923 populateSettings();
924 Engine engine = null;
925 try {
926 engine = new Engine(Check.class.getClassLoader());
927 if (isUpdateOnly()) {
928 log("Deprecated 'UpdateOnly' property set; please use the UpdateTask instead", Project.MSG_WARN);
929 try {
930 engine.doUpdates();
931 } catch (UpdateException ex) {
932 if (this.isFailOnError()) {
933 throw new BuildException(ex);
934 }
935 log(ex.getMessage(), Project.MSG_ERR);
936 }
937 } else {
938 for (Resource resource : path) {
939 final FileProvider provider = resource.as(FileProvider.class);
940 if (provider != null) {
941 final File file = provider.getFile();
942 if (file != null && file.exists()) {
943 engine.scan(file);
944 }
945 }
946 }
947
948 try {
949 engine.analyzeDependencies();
950 } catch (ExceptionCollection ex) {
951 if (this.isFailOnError()) {
952 throw new BuildException(ex);
953 }
954 }
955 DatabaseProperties prop = null;
956 CveDB cve = null;
957 try {
958 cve = new CveDB();
959 cve.open();
960 prop = cve.getDatabaseProperties();
961 } catch (DatabaseException ex) {
962 log("Unable to retrieve DB Properties", ex, Project.MSG_DEBUG);
963 } finally {
964 if (cve != null) {
965 cve.close();
966 }
967 }
968 final ReportGenerator reporter = new ReportGenerator(getProjectName(), engine.getDependencies(), engine.getAnalyzers(), prop);
969 reporter.generateReports(reportOutputDirectory, reportFormat);
970
971 if (this.failBuildOnCVSS <= 10) {
972 checkForFailure(engine.getDependencies());
973 }
974 if (this.showSummary) {
975 showSummary(engine.getDependencies());
976 }
977 }
978 } catch (DatabaseException ex) {
979 final String msg = "Unable to connect to the dependency-check database; analysis has stopped";
980 if (this.isFailOnError()) {
981 throw new BuildException(msg, ex);
982 }
983 log(msg, ex, Project.MSG_ERR);
984 } catch (ReportException ex) {
985 final String msg = "Unable to generate the dependency-check report";
986 if (this.isFailOnError()) {
987 throw new BuildException(msg, ex);
988 }
989 log(msg, ex, Project.MSG_ERR);
990 } finally {
991 Settings.cleanup(true);
992 if (engine != null) {
993 engine.cleanup();
994 }
995 }
996 }
997
998
999
1000
1001
1002
1003
1004 private void validateConfiguration() throws BuildException {
1005 if (path == null) {
1006 throw new BuildException("No project dependencies have been defined to analyze.");
1007 }
1008 if (failBuildOnCVSS < 0 || failBuildOnCVSS > 11) {
1009 throw new BuildException("Invalid configuration, failBuildOnCVSS must be between 0 and 11.");
1010 }
1011 }
1012
1013
1014
1015
1016
1017
1018
1019
1020 @Override
1021 protected void populateSettings() throws BuildException {
1022 super.populateSettings();
1023 Settings.setBooleanIfNotNull(Settings.KEYS.AUTO_UPDATE, autoUpdate);
1024 Settings.setStringIfNotEmpty(Settings.KEYS.SUPPRESSION_FILE, suppressionFile);
1025 Settings.setStringIfNotEmpty(Settings.KEYS.HINTS_FILE, hintsFile);
1026 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_EXPERIMENTAL_ENABLED, enableExperimental);
1027 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_JAR_ENABLED, jarAnalyzerEnabled);
1028 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, pyDistributionAnalyzerEnabled);
1029 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, pyPackageAnalyzerEnabled);
1030 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED, rubygemsAnalyzerEnabled);
1031 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, opensslAnalyzerEnabled);
1032 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_CMAKE_ENABLED, cmakeAnalyzerEnabled);
1033 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_SWIFT_PACKAGE_MANAGER_ENABLED, swiftPackageManagerAnalyzerEnabled);
1034 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_COCOAPODS_ENABLED, cocoapodsAnalyzerEnabled);
1035 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_ENABLED, bundleAuditAnalyzerEnabled);
1036 Settings.setStringIfNotNull(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_PATH, bundleAuditPath);
1037 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, autoconfAnalyzerEnabled);
1038 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_COMPOSER_LOCK_ENABLED, composerAnalyzerEnabled);
1039 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED, nodeAnalyzerEnabled);
1040 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, nuspecAnalyzerEnabled);
1041 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled);
1042 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled);
1043 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, archiveAnalyzerEnabled);
1044 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, assemblyAnalyzerEnabled);
1045 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl);
1046 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY, nexusUsesProxy);
1047 Settings.setStringIfNotEmpty(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions);
1048 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono);
1049 }
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059 private void checkForFailure(List<Dependency> dependencies) throws BuildException {
1060 final StringBuilder ids = new StringBuilder();
1061 for (Dependency d : dependencies) {
1062 for (Vulnerability v : d.getVulnerabilities()) {
1063 if (v.getCvssScore() >= failBuildOnCVSS) {
1064 if (ids.length() == 0) {
1065 ids.append(v.getName());
1066 } else {
1067 ids.append(", ").append(v.getName());
1068 }
1069 }
1070 }
1071 }
1072 if (ids.length() > 0) {
1073 final String msg = String.format("%n%nDependency-Check Failure:%n"
1074 + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n"
1075 + "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString());
1076 throw new BuildException(msg);
1077 }
1078 }
1079
1080
1081
1082
1083
1084
1085
1086 private void showSummary(List<Dependency> dependencies) {
1087 final StringBuilder summary = new StringBuilder();
1088 for (Dependency d : dependencies) {
1089 boolean firstEntry = true;
1090 final StringBuilder ids = new StringBuilder();
1091 for (Vulnerability v : d.getVulnerabilities()) {
1092 if (firstEntry) {
1093 firstEntry = false;
1094 } else {
1095 ids.append(", ");
1096 }
1097 ids.append(v.getName());
1098 }
1099 if (ids.length() > 0) {
1100 summary.append(d.getFileName()).append(" (");
1101 firstEntry = true;
1102 for (Identifier id : d.getIdentifiers()) {
1103 if (firstEntry) {
1104 firstEntry = false;
1105 } else {
1106 summary.append(", ");
1107 }
1108 summary.append(id.getValue());
1109 }
1110 summary.append(") : ").append(ids).append(NEW_LINE);
1111 }
1112 }
1113 if (summary.length() > 0) {
1114 final String msg = String.format("%n%n"
1115 + "One or more dependencies were identified with known vulnerabilities:%n%n%s"
1116 + "%n%nSee the dependency-check report for more details.%n%n", summary.toString());
1117 log(msg, Project.MSG_WARN);
1118 }
1119 }
1120
1121
1122
1123
1124
1125 public static class ReportFormats extends EnumeratedAttribute {
1126
1127
1128
1129
1130
1131
1132 @Override
1133 public String[] getValues() {
1134 int i = 0;
1135 final Format[] formats = Format.values();
1136 final String[] values = new String[formats.length];
1137 for (Format format : formats) {
1138 values[i++] = format.name();
1139 }
1140 return values;
1141 }
1142 }
1143 }