Skip to content

Commit

Permalink
fix: update tests and always include bool
Browse files Browse the repository at this point in the history
  • Loading branch information
cfabianski committed Aug 17, 2023
1 parent c492606 commit c8d6d8c
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5


Expand Down
1 change: 1 addition & 0 deletions e2e/rules/.snapshots/TestSecrets-secrets
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ medium:
display_severity: medium
sensitive_data_category_weighting: 2
rule_severity_weighting: 2
trigger_weighting: false
final_weighting: 4


Expand Down
6 changes: 6 additions & 0 deletions new/detector/composition/java/.snapshots/TestScope--scope.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -68,6 +69,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -103,6 +105,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -138,6 +141,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -173,6 +177,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -208,5 +213,6 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -68,5 +69,6 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -68,6 +69,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -103,6 +105,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -138,6 +141,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -173,6 +177,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -208,5 +213,6 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -68,6 +69,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -103,6 +105,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -138,6 +141,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -173,5 +177,6 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5

Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ low:
rule_severity: ""
display_severity: low
rule_severity_weighting: 2
trigger_weighting: false
final_weighting: 2

Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ low:
rule_severity: ""
display_severity: low
rule_severity_weighting: 2
trigger_weighting: false
final_weighting: 2

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -72,6 +73,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -113,5 +115,6 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5

6 changes: 6 additions & 0 deletions new/detector/composition/ruby/.snapshots/TestScope--scope.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -68,6 +69,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -103,6 +105,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -138,6 +141,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -173,6 +177,7 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5
- rule:
cwe_ids:
Expand Down Expand Up @@ -208,5 +213,6 @@ high:
rule_severity: high
display_severity: high
rule_severity_weighting: 5
trigger_weighting: false
final_weighting: 5

10 changes: 5 additions & 5 deletions pkg/report/output/security/.snapshots/TestCalculateSeverity
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,39 @@
DisplaySeverity: (string) (len=8) "critical",
SensitiveDataCategoryWeighting: (int) 3,
RuleSeverityWeighting: (int) 2,
TriggerWeighting: (bool) true,
TriggerWeighting: (*bool)(true),
FinalWeighting: (int) 8
},
(security.SeverityWeighting) {
RuleSeverity: (string) (len=3) "low",
DisplaySeverity: (string) (len=4) "high",
SensitiveDataCategoryWeighting: (int) 3,
RuleSeverityWeighting: (int) 2,
TriggerWeighting: (bool) false,
TriggerWeighting: (*bool)(false),
FinalWeighting: (int) 5
},
(security.SeverityWeighting) {
RuleSeverity: (string) (len=3) "low",
DisplaySeverity: (string) (len=6) "medium",
SensitiveDataCategoryWeighting: (int) 2,
RuleSeverityWeighting: (int) 2,
TriggerWeighting: (bool) false,
TriggerWeighting: (*bool)(false),
FinalWeighting: (int) 4
},
(security.SeverityWeighting) {
RuleSeverity: (string) (len=7) "warning",
DisplaySeverity: (string) (len=7) "warning",
SensitiveDataCategoryWeighting: (int) 0,
RuleSeverityWeighting: (int) 0,
TriggerWeighting: (bool) false,
TriggerWeighting: (*bool)(<nil>),
FinalWeighting: (int) 0
},
(security.SeverityWeighting) {
RuleSeverity: (string) (len=7) "warning",
DisplaySeverity: (string) (len=7) "warning",
SensitiveDataCategoryWeighting: (int) 0,
RuleSeverityWeighting: (int) 0,
TriggerWeighting: (bool) false,
TriggerWeighting: (*bool)(<nil>),
FinalWeighting: (int) 0
}
}
4 changes: 2 additions & 2 deletions pkg/report/output/security/.snapshots/TestGetOutput
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
DisplaySeverity: (string) (len=8) "critical",
SensitiveDataCategoryWeighting: (int) 3,
RuleSeverityWeighting: (int) 2,
TriggerWeighting: (bool) true,
TriggerWeighting: (*bool)(true),
FinalWeighting: (int) 8
},
RawCodeExtract: ([]file.Line) {
Expand Down Expand Up @@ -115,7 +115,7 @@
DisplaySeverity: (string) (len=4) "high",
SensitiveDataCategoryWeighting: (int) 2,
RuleSeverityWeighting: (int) 3,
TriggerWeighting: (bool) false,
TriggerWeighting: (*bool)(false),
FinalWeighting: (int) 5
},
RawCodeExtract: ([]file.Line) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
DisplaySeverity: (string) (len=8) "critical",
SensitiveDataCategoryWeighting: (int) 3,
RuleSeverityWeighting: (int) 2,
TriggerWeighting: (bool) true,
TriggerWeighting: (*bool)(true),
FinalWeighting: (int) 8
},
RawCodeExtract: ([]file.Line) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/report/output/security/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type SeverityWeighting struct {
DisplaySeverity string `json:"display_severity" yaml:"display_severity"`
SensitiveDataCategoryWeighting int `json:"sensitive_data_category_weighting,omitempty" yaml:"sensitive_data_category_weighting,omitempty"`
RuleSeverityWeighting int `json:"rule_severity_weighting,omitempty" yaml:"rule_severity_weighting,omitempty"`
TriggerWeighting bool `json:"trigger_weighting,omitempty" yaml:"trigger_weighting,omitempty"`
TriggerWeighting *bool `json:"trigger_weighting,omitempty" yaml:"trigger_weighting,omitempty"`
FinalWeighting int `json:"final_weighting,omitempty" yaml:"final_weighting,omitempty"`
}

Expand Down Expand Up @@ -478,7 +478,7 @@ func CalculateSeverity(groups []string, severity string, hasLocalDataTypes bool)
RuleSeverity: severity,
SensitiveDataCategoryWeighting: sensitiveDataCategoryWeighting,
RuleSeverityWeighting: ruleSeverityWeighting,
TriggerWeighting: hasLocalDataTypes,
TriggerWeighting: &hasLocalDataTypes,
FinalWeighting: finalWeighting,
DisplaySeverity: displaySeverity,
}
Expand Down

0 comments on commit c8d6d8c

Please sign in to comment.