Repository: tenable/terrascan (language: python)

Issue:
Rule severity field output should be case insensitive
* terrascan version: 1.2
* Operating System: all

### Description

When scanning a repo, if the severity field is not all caps (HIGH|MEDIUM|LOW), when violations are output, the color of the severity field does not show up. The compare should be case-insensitive, OR we can normalize the severity field.

### What I Did

```
terrascan scan -d [dir]
```



Discussion / hints:
can you explain a little bit more.what is the main issue here?
Sure--in the policy rule.json files, the severity field is either marked as HIGH, MEDIUM, or LOW. However, in some policies, lowercase values are used, or only the first letter are capitalized. Because of that, when scanning terraform files that have violations, the color of the output, instead of being red, green, yellow, ends up displaying as gray for those policies. I suspect the colorizer is just not converting the severity field to all-lower or all-upper prior to comparing.

Fix patch:
diff --git a/pkg/termcolor/termcolor.go b/pkg/termcolor/termcolor.go
index 66e47e208..7e5c8639e 100644
--- a/pkg/termcolor/termcolor.go
+++ b/pkg/termcolor/termcolor.go
@@ -177,7 +177,7 @@ func Colorize(st Style, message string) string {
 			pattern := strings.TrimSpace(clause[:eq])
 			style = strings.TrimSpace(clause[eq+1:])
 
-			if pattern != message {
+			if !strings.EqualFold(pattern, message) {
 				style = ""
 				continue
 			}


Test patch:
diff --git a/pkg/termcolor/writer_test.go b/pkg/termcolor/writer_test.go
index 4e4fe4ecd..1db516801 100644
--- a/pkg/termcolor/writer_test.go
+++ b/pkg/termcolor/writer_test.go
@@ -92,6 +92,13 @@ func TestYAMLSeverityIsColorized(t *testing.T) {
 	testSeverity("HIGH")
 	testSeverity("MEDIUM")
 	testSeverity("LOW")
+	testSeverity("Medium")
+	testSeverity("MedIUM")
+	testSeverity("low")
+	testSeverity("Low")
+	testSeverity("high")
+	testSeverity("High")
+
 }
 func TestYAMLResourceNameIsColorized(t *testing.T) {
 	verifyLineWithStringIsColorized("resource_name", yamlData.String(), t)