From a677136fbaa5115fc84f7cfecbcf563fed8f43f0 Mon Sep 17 00:00:00 2001 From: Ivan Date: Tue, 10 Aug 2021 17:31:21 -0500 Subject: [PATCH] fix: feedback and unit tests --- config/earlybird.json | 2 +- pkg/scan/scan_test.go | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/config/earlybird.json b/config/earlybird.json index 1e79f92..8b30d48 100644 --- a/config/earlybird.json +++ b/config/earlybird.json @@ -57,6 +57,6 @@ "display_threshold_level": 3, "display_confidence_threshold_level": 2, "earlybird_config_url": "https://raw.githubusercontent.com/americanexpress/earlybird/main/config/earlybird.json", - "version": "2.0.1", + "version": "2.0.0", "name": "earlybird" } diff --git a/pkg/scan/scan_test.go b/pkg/scan/scan_test.go index ec5c8c0..11dae76 100644 --- a/pkg/scan/scan_test.go +++ b/pkg/scan/scan_test.go @@ -249,6 +249,26 @@ func Test_scanLine(t *testing.T) { }, wantIsHit: false, }, + { + name: "Find twitter API key as a password", + args: args{ + line: Line{ + LineValue: `twitterApiSecret:"111aAa222bBb333cCc444dDd555eEe666fFf777"`, + }, + fileLines: fileLines, + }, + wantIsHit: true, + }, + { + name: "Ignore potential twitter API key separated by too many characters", + args: args{ + line: Line{ + LineValue: `twitter="twitter";//This LineValue emulates extremely long one-liner code files that can cause false positives "111aAa222bBb333cCc444dDd555eEe666fFf777"`, + }, + fileLines: fileLines, + }, + wantIsHit: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {