Skip to content

Commit 4a66d1e

Browse files
Fixing test after merge from main
1 parent 763ebc5 commit 4a66d1e

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

lib/reporting/report_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
var (
2121
ruleID1 = "ruleID1"
2222
ruleID2 = "ruleID2"
23-
ruleID4 = "ruleID4"
23+
ruleID4 = "ruleID4"
2424
RuleName1 = "ruleName1"
2525
RuleName2 = "ruleName2"
2626
RuleName4 = "ruleName4"
@@ -128,7 +128,7 @@ var (
128128
},
129129
}
130130
rule4Sarif = &SarifRule{
131-
ID: ruleID4,
131+
ID: ruleID4,
132132
Name: RuleName4,
133133
FullDescription: &Message{
134134
Text: result4.RuleDescription,
@@ -242,7 +242,7 @@ var (
242242
}
243243
result4Sarif = Results{
244244
Message: Message{
245-
Text: createMessageText(result4.RuleID, result4.Source),
245+
Text: createMessageText(result4.RuleName, result4.Source),
246246
},
247247
RuleId: ruleID4,
248248
Locations: []Locations{
@@ -271,8 +271,8 @@ var (
271271
"cvssScore": result4.CvssScore,
272272
"confluence.pageId": result4.ExtraDetails["confluence.pageId"],
273273
"resultId": result4.ID,
274-
"severity": result4.Severity,
275-
"ruleName": RuleName4,
274+
"severity": result4.Severity,
275+
"ruleName": RuleName4,
276276
},
277277
}
278278
)

tests/testData/input/custom_rules_secrets.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ ghp_1234567890abcdefghijklmnopqrstuvwxyz123
22
export AWS_CONTEXT_CREDENTIAL=ACCAIOSFODNN7EXAMAAA
33
client_secret=6da89121079f83b2eb6acccf8219ea982c3d79bccc3e9c6a85856480661f8fde
44
mock_secret:=very_secret_value
5+
6+
<h3>First Step of the Project<br /></h3><p><a href="https://github.com/SCS-Micro-Engines/2msRunner">2msRunner</a> represents the first phase of a broader project aimed at improving the secret detection capabilities of 2MS. By comparing different versions of 2MS, this tool allows for the identification of potential improvements and regression points, laying the foundation for future enhancements in the detection rules and overall accuracy of the tool. </p><p>This tool automates the process of comparing two versions of the 2MS secret detection project. By systematically comparing the results of different versions of 2MS, <strong>2msRunner</strong> helped identify areas where detection rules could be optimized and where updates might have unintentionally impacted performance.</p><h3>Features</h3><ul><li><p><strong>Version Comparison</strong>: 2msRunner can run both the old and new executables of 2ms and compare the results to identify any differences in the way secrets are detected.</p></li><li><p><strong>Custom Repository Support</strong>: The tool supports loading custom repositories via the <code>--custom-repo</code> flag, where users can specify a custom file (<code>customRepos.json</code>) that contains a list of repositories to scan.</p></li><li><p><strong>Comparison Results for Both Executables</strong>: When using the <code>--compare-results</code> flag, 2msRunner generates detailed reports that highlight the secrets detected in only one of the two versions of 2ms. These reports make it easier to identify secrets, offering valuable insights into the impact of changes made between versions. By analyzing these reports, users can better understand how updates to the detection rules affect performance and identify areas for further optimization.</p></li><li><p><strong>Result Output</strong>: The tool outputs the results of the comparison in a CSV file (<code>repos/repos.csv</code>), which can be analyzed to track trends and improvements in secret detection performance.</p></li></ul><p /><p><strong>Repos.csv example</strong><br />When executing the flag <code>--custom-repo</code> we obtain the following results for the repos in <code>repos/repos.csv</code> .</p><table data-table-width="760" data-layout="default" ac:local-id="77013a21-9f7b-4193-8923-5563b181287e"><colgroup><col style="width: 145.0px;" /><col style="width: 161.0px;" /><col style="width: 115.0px;" /><col style="width: 88.0px;" /><col style="width: 82.0px;" /><col style="width: 121.0px;" /><col style="width: 139.0px;" /><col style="width: 149.0px;" /><col style="width: 104.0px;" /><col style="width: 109.0px;" /><col style="width: 123.0px;" /><col style="width: 105.0px;" /><col style="width: 101.0px;" /><col style="width: 151.0px;" /><col style="width: 115.0px;" /><col style="width: 107.0px;" /><col style="width: 229.0px;" /><col style="width: 225.0px;" /><col style="width: 189.0px;" /><col style="width: 197.0px;" /><col style="width: 179.0px;" /><col style="width: 129.0px;" /><col style="width: 127.0px;" /><col style="width: 129.0px;" /><col style="width: 49.0px;" /></colgroup><tbody><tr><td><p>Repo</p></td><td><p>URL</p></td><td><p>LOC</p></td><td><p>Files</p></td><td><p>Size</p></td><td><p>Old Memory</p></td><td><p>New Memory</p></td><td><p>Memory Change</p></td><td><p>Old CPU</p></td><td><p>New CPU</p></td><td><p>CPU Change</p></td><td><p>Old Time</p></td><td><p>New Time</p></td><td><p>Time Change %</p></td><td><p>Old Results</p></td><td><p>New Results</p></td><td><p>Different Results Old</p></td><td><p>Different Results New</p></td><td><p>Top Extensions Old</p></td><td><p>Top Extensions New</p></td><td><p>Main Language</p></td><td><p>Valid Secrets</p></td><td><p>Similarity Old</p></td><td><p>Similarity New</p></td><td><p>Info</p></td></tr><tr><td><p>Checkmarx/2ms</p></td><td><p><a href="https://github.com/Checkmarx/2ms.git">checkmarx/2ms</a> </p></td><td><p>13361</p></td><td><p>102</p></td><td><p>566.44</p></td><td><p>38.92</p></td><td><p>38.47</p></td><td><p>-1.16</p></td><td><p>17.97</p></td><td><p>24.21</p></td><td><p>34.67</p></td><td><p>0.81</p></td><td><p>1.44</p></td><td><p>78.37%</p></td><td><p>69</p></td><td><p>41</p></td><td><p>github-pat (27),<br />jwt (21),<br />generic-api-key (9)<br /><br /><br /></p></td><td><p>jwt (21),<br />generic-api-key (7),<br />,authenticated-url (6)</p></td><td><p>.go (36),<br />.json (27),<br />.txt (6)</p></td><td><p>.go (25),<br />.json (13),<br />.txt (3)</p></td><td><p>Go</p></td><td><p>0</p></td><td><p>138</p></td><td><p>109</p></td><td><p /></td></tr></tbody></table><p /><p /><table data-table-width="1471" data-layout="center" ac:local-id="2a27f922-0557-440b-819d-fcfd1bdf5022"><colgroup><col style="width: 1471.0px;" /></colgroup><tbody><tr><td><p /></td></tr></tbody></table>;cx-file-end

0 commit comments

Comments
 (0)