Skip to content

Commit 6b6d06b

Browse files
committed
add test for low entropy base64 string
1 parent 65a0c10 commit 6b6d06b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

detector/filecontent_detector_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ func TestShouldNotFlag4CharSafeText(t *testing.T) {
4141
assert.False(t, results.HasFailures(), "Expected file to not to contain base64 encoded texts")
4242
}
4343

44+
func TestShouldNotFlagLowEntropyBase64Text(t *testing.T) {
45+
const lowEntropyString string = "YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWEK"
46+
results := NewDetectionResults()
47+
content := []byte(lowEntropyString)
48+
filename := "filename"
49+
additions := []git_repo.Addition{git_repo.NewAddition(filename, content)}
50+
51+
NewFileContentDetector().Test(additions, NewIgnores(), results)
52+
assert.False(t, results.HasFailures(), "Expected file to not to contain base64 encoded texts")
53+
}
54+
4455
func TestShouldFlagPotentialAWSSecretKeys(t *testing.T) {
4556
const awsSecretAccessKey string = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
4657
results := NewDetectionResults()

0 commit comments

Comments
 (0)