1
- package com .devonfw .tools .ide .url .model .file . json ;
1
+ package com .devonfw .tools .ide .url .model .file ;
2
2
3
3
import java .io .BufferedWriter ;
4
4
import java .io .IOException ;
14
14
import org .slf4j .LoggerFactory ;
15
15
16
16
import com .devonfw .tools .ide .json .mapping .JsonMapping ;
17
- import com .devonfw .tools .ide .url .model .file .AbstractUrlFile ;
18
17
import com .devonfw .tools .ide .url .model .folder .UrlEdition ;
19
18
import com .devonfw .tools .ide .version .VersionIdentifier ;
20
19
import com .devonfw .tools .ide .version .VersionRange ;
21
20
import com .fasterxml .jackson .core .JsonProcessingException ;
22
21
import com .fasterxml .jackson .core .type .TypeReference ;
23
22
import com .fasterxml .jackson .databind .ObjectMapper ;
24
23
24
+ /**
25
+ * {@link UrlFile} for the "security.json" file.
26
+ */
25
27
public class UrlSecurityJsonFile extends AbstractUrlFile <UrlEdition > {
26
28
29
+ /***
30
+ * A simple container with the information about a security warning.
31
+ *
32
+ * @param versionRange the version range, specifying the versions of the tool to which the security risk applies.
33
+ * @param severity the severity of the security risk.
34
+ * @param severityVersion Indicating from which version the {@code severity} was obtained. As of December 2023, this
35
+ * is either v2 or v3.
36
+ * @param cveName the name of the CVE (Common Vulnerabilities and Exposures).
37
+ * @param description the description of the CVE.
38
+ * @param nistUrl the url to the CVE on the NIST website.
39
+ * @param referenceUrl the urls where additional information about the CVE can be found.
40
+ */
41
+ public record UrlSecurityWarning (VersionRange versionRange , BigDecimal severity , String severityVersion ,
42
+ String cveName , String description , String nistUrl , List <String > referenceUrl ) {
43
+ };
44
+
27
45
/** {@link #getName() Name} of security json file. */
28
46
public static final String FILENAME_SECURITY = "security.json" ;
29
47
30
48
private static final Logger LOG = LoggerFactory .getLogger (UrlSecurityJsonFile .class );
31
49
32
- Set <UrlSecurityWarning > warnings ;
50
+ private Set <UrlSecurityWarning > warnings ;
33
51
34
52
/**
35
53
* The constructor.
@@ -45,21 +63,21 @@ public UrlSecurityJsonFile(UrlEdition parent) {
45
63
/***
46
64
* Adds a new security warning to the security json file.
47
65
*
48
- * @param versionRange the version range, specifying the versions of the tool to which the security risk applies
66
+ * @param versionRange the version range, specifying the versions of the tool to which the security risk applies.
49
67
* @param severity the severity of the security risk.
50
68
* @param severityVersion Indicating from which version the {@code severity} was obtained. As of December 2023, this
51
- * is either v2 or v3.
69
+ * is either v2 or v3.
52
70
* @param cveName the name of the CVE (Common Vulnerabilities and Exposures).
53
71
* @param description the description of the CVE.
54
72
* @param nistUrl the url to the CVE on the NIST website.
55
73
* @param referenceUrl the urls where additional information about the CVE can be found.
56
74
* @return {@code true} if the security match was added, {@code false} if it was already present.
57
75
*/
58
- public boolean addSecurityWarning (VersionRange versionRange , BigDecimal severity , String severityVersion , String cveName ,
59
- String description , String nistUrl , List <String > referenceUrl ) {
76
+ public boolean addSecurityWarning (VersionRange versionRange , BigDecimal severity , String severityVersion ,
77
+ String cveName , String description , String nistUrl , List <String > referenceUrl ) {
60
78
61
- UrlSecurityWarning newWarning = new UrlSecurityWarning (versionRange , severity , severityVersion , cveName , description , nistUrl ,
62
- referenceUrl );
79
+ UrlSecurityWarning newWarning = new UrlSecurityWarning (versionRange , severity , severityVersion , cveName ,
80
+ description , nistUrl , referenceUrl );
63
81
boolean added = warnings .add (newWarning );
64
82
this .modified = this .modified || added ;
65
83
return added ;
@@ -136,8 +154,4 @@ protected void doSave() {
136
154
throw new IllegalStateException ("Failed to save file " + path , e );
137
155
}
138
156
}
139
- }
140
-
141
- record UrlSecurityWarning (VersionRange versionRange , BigDecimal severity , String severityVersion , String cveName , String description , String nistUrl ,
142
- List <String > referenceUrl ) {
143
- };
157
+ }
0 commit comments