|
23 | 23 | @EqualsAndHashCode(callSuper = true) |
24 | 24 | @JsonInclude(JsonInclude.Include.NON_NULL) |
25 | 25 | public class Finding extends DefectDojoModel { |
26 | | - @JsonProperty |
27 | | - Long id; |
28 | | - |
29 | | - @JsonProperty |
30 | | - @NonNull |
31 | | - String title; |
32 | | - |
33 | | - @JsonProperty |
34 | | - @NonNull |
35 | | - String description; |
36 | | - |
37 | | - @JsonProperty("found_by") |
38 | | - @NonNull |
39 | | - List<Long> foundBy; |
40 | | - |
41 | | - @JsonProperty |
42 | | - @NonNull |
43 | | - Severity severity; |
44 | | - |
45 | | - @JsonProperty |
46 | | - @NonNull |
47 | | - Long test; |
48 | | - |
49 | | - @JsonProperty |
50 | | - String mitigation; |
51 | | - |
52 | | - @JsonProperty |
53 | | - String impact; |
54 | | - |
55 | | - @JsonProperty |
56 | | - @NonNull |
57 | | - @Builder.Default |
58 | | - Boolean active = true; |
59 | | - |
60 | | - @JsonProperty |
61 | | - @NonNull |
62 | | - @Builder.Default |
63 | | - Boolean verified = true; |
64 | | - |
65 | | - @JsonProperty("risk_accepted") |
66 | | - @NonNull |
67 | | - @Builder.Default |
68 | | - Boolean riskAccepted = false; |
69 | | - |
70 | | - @JsonProperty("out_of_scope") |
71 | | - @NonNull |
72 | | - @Builder.Default |
73 | | - Boolean outOfScope = false; |
74 | | - |
75 | | - @JsonProperty |
76 | | - @NonNull |
77 | | - @Builder.Default |
78 | | - Boolean duplicate = false; |
79 | | - |
80 | | - @JsonProperty("duplicate_finding") |
81 | | - @Builder.Default |
82 | | - Long duplicateFinding = null; |
83 | | - |
84 | | - @JsonProperty("false_p") |
85 | | - @NonNull |
86 | | - @Builder.Default |
87 | | - Boolean falsePositive = false; |
88 | | - |
89 | | - @JsonProperty("component_name") |
90 | | - String componentName; |
91 | | - |
92 | | - @JsonProperty("component_version") |
93 | | - String componentVersion; |
94 | | - |
95 | | - @JsonProperty("file_path") |
96 | | - String filePath; |
97 | | - |
98 | | - @JsonProperty |
99 | | - @NonNull |
100 | | - @Builder.Default |
101 | | - List<Long> endpoints = new LinkedList<>(); |
102 | | - |
103 | | - @JsonProperty("created") |
104 | | - LocalDateTime createdAt; |
105 | | - |
106 | | - @JsonProperty("mitigated") |
107 | | - LocalDateTime mitigatedAt; |
108 | | - |
109 | | - @JsonProperty("accepted_risks") |
110 | | - List<RiskAcceptance> acceptedRisks; |
111 | | - |
112 | | - @JsonProperty("numerical_severity") |
113 | | - public String getNumericalSeverity() { |
114 | | - switch (this.severity) { |
115 | | - case Critical: |
116 | | - return "S0"; |
117 | | - case High: |
118 | | - return "S1"; |
119 | | - case Medium: |
120 | | - return "S2"; |
121 | | - case Low: |
122 | | - return "S3"; |
123 | | - case Informational: |
124 | | - return "S4"; |
125 | | - default: |
126 | | - throw new DefectDojoPersistenceException("Unknown severity: '" + this.severity + "'"); |
| 26 | + @JsonProperty |
| 27 | + Long id; |
| 28 | + |
| 29 | + @JsonProperty |
| 30 | + @NonNull |
| 31 | + String title; |
| 32 | + |
| 33 | + @JsonProperty |
| 34 | + @NonNull |
| 35 | + String description; |
| 36 | + |
| 37 | + @JsonProperty("found_by") |
| 38 | + @NonNull |
| 39 | + List<Long> foundBy; |
| 40 | + |
| 41 | + @JsonProperty |
| 42 | + @NonNull |
| 43 | + Severity severity; |
| 44 | + |
| 45 | + @JsonProperty |
| 46 | + @NonNull |
| 47 | + Long test; |
| 48 | + |
| 49 | + @JsonProperty |
| 50 | + String mitigation; |
| 51 | + |
| 52 | + @JsonProperty |
| 53 | + String impact; |
| 54 | + |
| 55 | + @JsonProperty |
| 56 | + @NonNull |
| 57 | + @Builder.Default |
| 58 | + Boolean active = true; |
| 59 | + |
| 60 | + @JsonProperty |
| 61 | + @NonNull |
| 62 | + @Builder.Default |
| 63 | + Boolean verified = true; |
| 64 | + |
| 65 | + @JsonProperty("risk_accepted") |
| 66 | + @NonNull |
| 67 | + @Builder.Default |
| 68 | + Boolean riskAccepted = false; |
| 69 | + |
| 70 | + @JsonProperty("out_of_scope") |
| 71 | + @NonNull |
| 72 | + @Builder.Default |
| 73 | + Boolean outOfScope = false; |
| 74 | + |
| 75 | + @JsonProperty |
| 76 | + @NonNull |
| 77 | + @Builder.Default |
| 78 | + Boolean duplicate = false; |
| 79 | + |
| 80 | + @JsonProperty("duplicate_finding") |
| 81 | + @Builder.Default |
| 82 | + Long duplicateFinding = null; |
| 83 | + |
| 84 | + @JsonProperty("false_p") |
| 85 | + @NonNull |
| 86 | + @Builder.Default |
| 87 | + Boolean falsePositive = false; |
| 88 | + |
| 89 | + @JsonProperty("component_name") |
| 90 | + String componentName; |
| 91 | + |
| 92 | + @JsonProperty("component_version") |
| 93 | + String componentVersion; |
| 94 | + |
| 95 | + @JsonProperty("file_path") |
| 96 | + String filePath; |
| 97 | + |
| 98 | + @JsonProperty |
| 99 | + @NonNull |
| 100 | + @Builder.Default |
| 101 | + List<Long> endpoints = new LinkedList<>(); |
| 102 | + |
| 103 | + @JsonProperty("created") |
| 104 | + LocalDateTime createdAt; |
| 105 | + |
| 106 | + @JsonProperty("mitigated") |
| 107 | + LocalDateTime mitigatedAt; |
| 108 | + |
| 109 | + @JsonProperty("accepted_risks") |
| 110 | + List<RiskAcceptance> acceptedRisks; |
| 111 | + |
| 112 | + @JsonProperty("numerical_severity") |
| 113 | + public String getNumericalSeverity() { |
| 114 | + switch (this.severity) { |
| 115 | + case Critical: |
| 116 | + return "S0"; |
| 117 | + case High: |
| 118 | + return "S1"; |
| 119 | + case Medium: |
| 120 | + return "S2"; |
| 121 | + case Low: |
| 122 | + return "S3"; |
| 123 | + case Informational: |
| 124 | + return "S4"; |
| 125 | + default: |
| 126 | + throw new DefectDojoPersistenceException("Unknown severity: '" + this.severity + "'"); |
| 127 | + } |
127 | 128 | } |
128 | | - } |
129 | | - |
130 | | - @Override |
131 | | - public boolean equalsQueryString(Map<String, Object> queryParams) { |
132 | | - return queryParams.containsKey("id") && queryParams.get("id").equals(this.id); |
133 | | - } |
134 | | - |
135 | | - public enum Severity { |
136 | | - @JsonProperty("Critical") |
137 | | - Critical(5), |
138 | | - @JsonProperty("High") |
139 | | - High(4), |
140 | | - @JsonProperty("Medium") |
141 | | - Medium(3), |
142 | | - @JsonProperty("Low") |
143 | | - Low(2), |
144 | | - // Depending on the Scanner DefectDojo uses either Info or Informational |
145 | | - // E.g. Nmap uses Info, Zap uses Informational |
146 | | - @JsonProperty("Info") |
147 | | - @JsonAlias("Informational") |
148 | | - Informational(1), |
149 | | - ; |
150 | | - |
151 | | - long severity; |
152 | | - |
153 | | - Severity(long severity) { |
154 | | - this.severity = severity; |
| 129 | + |
| 130 | + @Override |
| 131 | + public boolean equalsQueryString(Map<String, Object> queryParams) { |
| 132 | + return queryParams.containsKey("id") && queryParams.get("id").equals(this.id); |
155 | 133 | } |
156 | 134 |
|
157 | | - public long getNumericRepresentation() { |
158 | | - return severity; |
| 135 | + public enum Severity { |
| 136 | + @JsonProperty("Critical") |
| 137 | + Critical(5), |
| 138 | + @JsonProperty("High") |
| 139 | + High(4), |
| 140 | + @JsonProperty("Medium") |
| 141 | + Medium(3), |
| 142 | + @JsonProperty("Low") |
| 143 | + Low(2), |
| 144 | + // Depending on the Scanner DefectDojo uses either Info or Informational |
| 145 | + // E.g. Nmap uses Info, Zap uses Informational |
| 146 | + @JsonProperty("Info") |
| 147 | + @JsonAlias("Informational") |
| 148 | + Informational(1), |
| 149 | + ; |
| 150 | + |
| 151 | + long severity; |
| 152 | + |
| 153 | + Severity(long severity) { |
| 154 | + this.severity = severity; |
| 155 | + } |
| 156 | + |
| 157 | + public long getNumericRepresentation() { |
| 158 | + return severity; |
| 159 | + } |
159 | 160 | } |
160 | | - } |
161 | 161 | } |
0 commit comments