Skip to content

Commit 47204df

Browse files
authored
Merge pull request #4475 from cservakt/add-rule-title
[feat] Adding rule title column for Guideline stat
2 parents b8f90ed + 26e881f commit 47204df

File tree

4 files changed

+58
-34
lines changed

4 files changed

+58
-34
lines changed

analyzer/tests/unit/test_guidelines.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,28 @@ def initialize_guidelines_dir(self):
3535
"rule_url": "https://wiki.sei.cmu.edu/confluence/display"
3636
"/cplusplus/CON50-CPP.+Do+not+destroy+a+mutex"
3737
"+while+it+is+locked",
38-
"rule_title": ""
38+
"title": ""
3939
},
4040
{
4141
"rule_id": "con51-cpp",
4242
"rule_url": "https://wiki.sei.cmu.edu/confluence/display"
4343
"/cplusplus/CON51-CPP.+Ensure+actively+held+"
4444
"locks+are+released+on+exceptional+conditions",
45-
"rule_title": ""
45+
"title": ""
4646
},
4747
{
4848
"rule_id": "con52-cpp",
4949
"rule_url": "https://wiki.sei.cmu.edu/confluence/display"
5050
"/cplusplus/CON52-CPP.+Prevent+data+races+when"
5151
"+accessing+bit-fields+from+multiple+threads",
52-
"rule_title": ""
52+
"title": ""
5353
},
5454
{
5555
"rule_id": "con53-cpp",
5656
"rule_url": "https://wiki.sei.cmu.edu/confluence/display"
5757
"/cplusplus/CON53-CPP.+Avoid+deadlock+by+"
5858
"locking+in+a+predefined+order",
59-
"rule_title": ""
59+
"title": ""
6060
},
6161
]
6262
}
@@ -81,24 +81,24 @@ def test_guidelines(self):
8181
"rule_url": "https://wiki.sei.cmu.edu/confluence/display"
8282
"/cplusplus/CON50-CPP.+Do+not+destroy+a+mutex"
8383
"+while+it+is+locked",
84-
"rule_title": ""
84+
"title": ""
8585
},
8686
"con51-cpp": {
8787
"rule_url": "https://wiki.sei.cmu.edu/confluence/display"
8888
"/cplusplus/CON51-CPP.+Ensure+actively+held+"
8989
"locks+are+released+on+exceptional+conditions",
90-
"rule_title": ""
90+
"title": ""
9191
},
9292
"con52-cpp": {
9393
"rule_url": "https://wiki.sei.cmu.edu/confluence/display"
9494
"/cplusplus/CON52-CPP.+Prevent+data+races+when"
9595
"+accessing+bit-fields+from+multiple+threads",
96-
"rule_title": ""
96+
"title": ""
9797
},
9898
"con53-cpp": {
9999
"rule_url": "https://wiki.sei.cmu.edu/confluence/display"
100100
"/cplusplus/CON53-CPP.+Avoid+deadlock+by+"
101101
"locking+in+a+predefined+order",
102-
"rule_title": ""
102+
"title": ""
103103
},
104104
})

config/guidelines/cwe-top-25-2024.yaml

+25-25
Original file line numberDiff line numberDiff line change
@@ -2,77 +2,77 @@ guideline: cwe-top-25-2024
22
guideline_title: CWE Top 25 Most Dangerous Software Weaknesses 2024
33
rules:
44
- rule_id: cwe-20
5-
rule_title: Improper Input Validation
5+
title: Improper Input Validation
66
rule_url: https://cwe.mitre.org/data/definitions/20.html
77
- rule_id: cwe-22
8-
rule_title: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
8+
title: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
99
rule_url: https://cwe.mitre.org/data/definitions/22.html
1010
- rule_id: cwe-77
11-
rule_title: Improper Neutralization of Special Elements used in a Command ('Command Injection')
11+
title: Improper Neutralization of Special Elements used in a Command ('Command Injection')
1212
rule_url: https://cwe.mitre.org/data/definitions/77.html
1313
- rule_id: cwe-78
14-
rule_title: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
14+
title: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
1515
rule_url: https://cwe.mitre.org/data/definitions/78.html
1616
- rule_id: cwe-79
17-
rule_title: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
17+
title: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
1818
rule_url: https://cwe.mitre.org/data/definitions/79.html
1919
- rule_id: cwe-89
20-
rule_title: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
20+
title: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
2121
rule_url: https://cwe.mitre.org/data/definitions/89.html
2222
- rule_id: cwe-94
23-
rule_title: Improper Control of Generation of Code ('Code Injection')
23+
title: Improper Control of Generation of Code ('Code Injection')
2424
rule_url: https://cwe.mitre.org/data/definitions/94.html
2525
- rule_id: cwe-119
26-
rule_title: Improper Restriction of Operations within the Bounds of a Memory Buffer
26+
title: Improper Restriction of Operations within the Bounds of a Memory Buffer
2727
rule_url: https://cwe.mitre.org/data/definitions/119.html
2828
- rule_id: cwe-125
29-
rule_title: Out-of-bounds Read
29+
title: Out-of-bounds Read
3030
rule_url: https://cwe.mitre.org/data/definitions/125.html
3131
- rule_id: cwe-190
32-
rule_title: Integer Overflow or Wraparound
32+
title: Integer Overflow or Wraparound
3333
rule_url: https://cwe.mitre.org/data/definitions/190.html
3434
- rule_id: cwe-200
35-
rule_title: Exposure of Sensitive Information to an Unauthorized Actor
35+
title: Exposure of Sensitive Information to an Unauthorized Actor
3636
rule_url: https://cwe.mitre.org/data/definitions/200.html
3737
- rule_id: cwe-269
38-
rule_title: Improper Privilege Management
38+
title: Improper Privilege Management
3939
rule_url: https://cwe.mitre.org/data/definitions/269.html
4040
- rule_id: cwe-287
41-
rule_title: Improper Authentication
41+
title: Improper Authentication
4242
rule_url: https://cwe.mitre.org/data/definitions/287.html
4343
- rule_id: cwe-306
44-
rule_title: Missing Authentication for Critical Function
44+
title: Missing Authentication for Critical Function
4545
rule_url: https://cwe.mitre.org/data/definitions/306.html
4646
- rule_id: cwe-352
47-
rule_title: Cross-Site Request Forgery (CSRF)
47+
title: Cross-Site Request Forgery (CSRF)
4848
rule_url: https://cwe.mitre.org/data/definitions/352.html
4949
- rule_id: cwe-400
50-
rule_title: Uncontrolled Resource Consumption
50+
title: Uncontrolled Resource Consumption
5151
rule_url: https://cwe.mitre.org/data/definitions/400.html
5252
- rule_id: cwe-416
53-
rule_title: Use After Free
53+
title: Use After Free
5454
rule_url: https://cwe.mitre.org/data/definitions/416.html
5555
- rule_id: cwe-434
56-
rule_title: Unrestricted Upload of File with Dangerous Type
56+
title: Unrestricted Upload of File with Dangerous Type
5757
rule_url: https://cwe.mitre.org/data/definitions/434.html
5858
- rule_id: cwe-476
59-
rule_title: NULL Pointer Dereference
59+
title: NULL Pointer Dereference
6060
rule_url: https://cwe.mitre.org/data/definitions/476.html
6161
- rule_id: cwe-502
62-
rule_title: Deserialization of Untrusted Data
62+
title: Deserialization of Untrusted Data
6363
rule_url: https://cwe.mitre.org/data/definitions/502.html
6464
- rule_id: cwe-787
65-
rule_title: Out-of-bounds Write
65+
title: Out-of-bounds Write
6666
rule_url: https://cwe.mitre.org/data/definitions/787.html
6767
- rule_id: cwe-798
68-
rule_title: Use of Hard-coded Credentials
68+
title: Use of Hard-coded Credentials
6969
rule_url: https://cwe.mitre.org/data/definitions/798.html
7070
- rule_id: cwe-862
71-
rule_title: Missing Authorization
71+
title: Missing Authorization
7272
rule_url: https://cwe.mitre.org/data/definitions/862.html
7373
- rule_id: cwe-863
74-
rule_title: Incorrect Authorization
74+
title: Incorrect Authorization
7575
rule_url: https://cwe.mitre.org/data/definitions/863.html
7676
- rule_id: cwe-918
77-
rule_title: Server-Side Request Forgery (SSRF)
77+
title: Server-Side Request Forgery (SSRF)
7878
rule_url: https://cwe.mitre.org/data/definitions/918.html

web/server/vue-cli/src/components/Statistics/Guideline/GuidelineStatistics.vue

+1
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ export default {
229229
guidelineName: guideline,
230230
guidelineRule: rule.ruleId,
231231
guidelineUrl: rule.url,
232+
guidelineRuleTitle: rule.title,
232233
checkers: filtered_stat.length
233234
? filtered_stat.map(checkerId => {
234235
return {

web/server/vue-cli/src/components/Statistics/Guideline/GuidelineStatisticsTable.vue

+24-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<base-statistics-table
3-
:headers="headers"
3+
:headers="tableHeaders"
44
:items="items"
55
:loading="loading"
66
:mobile-breakpoint="1000"
@@ -36,6 +36,10 @@ export default {
3636
text: "Rule Name",
3737
value: "guidelineRule"
3838
},
39+
{
40+
text: "Title",
41+
value: "guidelineRuleTitle"
42+
},
3943
{
4044
text: "Related Checker(s)",
4145
value: "checkers.name"
@@ -63,6 +67,25 @@ export default {
6367
]
6468
};
6569
},
70+
71+
computed: {
72+
hasTitle() {
73+
return this.items.some(item => item.guidelineRuleTitle);
74+
},
75+
76+
tableHeaders() {
77+
if (!this.headers) return;
78+
79+
return this.headers.filter(header => {
80+
if (header.value === "guidelineRuleTitle") {
81+
return this.hasTitle;
82+
}
83+
84+
return true;
85+
});
86+
}
87+
},
88+
6689
methods: {
6790
enabledClick(type, checker_name) {
6891
this.$emit("enabled-click", type, checker_name);

0 commit comments

Comments
 (0)