Skip to content

Commit

Permalink
Change severity for some detectors (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
tinamthomas committed Sep 20, 2020
1 parent f72e918 commit 3fe938c
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .talismanrc
Expand Up @@ -20,7 +20,7 @@ fileignoreconfig:
- filename: detector/pattern_detector_test.go
checksum: 4d70b790f28f2d23d506f808d489aa43f1efd2514549ae6a83a535e1223382e3
- filename: detector/severity/severity_config.go
checksum: 7e5442d7ee07a6fad12cf636c5dc2880c69b9593fd286e44d567e178ffdd0194
checksum: b66d979756af47c780b1fda356f48b1ab354488ae77f7e93283a5ec360ac93a0
- filename: global_install_scripts/install.bash
checksum: 5d659125ecbe619ea99f5bc71c2d761b586ce3ec9ccab7683ee54f4ebde9f748
- filename: upx_compress.sh
Expand Down
20 changes: 3 additions & 17 deletions detector/filecontent/filecontent_detector_test.go
Expand Up @@ -79,20 +79,6 @@ func TestShouldFlagPotentialAWSSecretKeys(t *testing.T) {
assert.Len(t, results.Results, 1)
}

func TestShouldNotFlagBase64ContentIfThresholdIsHigher(t *testing.T) {
const awsSecretAccessKey string = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
results := helpers.NewDetectionResults()
content := []byte(awsSecretAccessKey)
filename := "filename"
additions := []gitrepo.Addition{gitrepo.NewAddition(filename, content)}
var talismanRCContents = "threshold: high"
talismanRCWithThreshold := talismanrc.NewTalismanRC([]byte(talismanRCContents))

NewFileContentDetector(talismanRC).Test(helpers.NewChecksumCompare(nil, utility.DefaultSHA256Hasher{}, talismanRCWithThreshold), additions, talismanRCWithThreshold, results)
assert.False(t, results.HasFailures(), "Expected file to not flag base64 encoded texts if threshold is higher")
assert.True(t, results.HasWarnings(), "Expected file to have warngings for base64 encoded texts if threshold is higher")
}

func TestShouldFlagPotentialSecretWithoutTrimmingWhenLengthLessThan50Characters(t *testing.T) {
const secret string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9asdfa"
results := helpers.NewDetectionResults()
Expand Down Expand Up @@ -174,10 +160,10 @@ func TestShouldFlagPotentialSecretsEncodedInHex(t *testing.T) {
assert.Len(t, results.Results, 1)
}

func TestShouldNotFlagSecretsEncodedInHexIfAboveThreshold(t *testing.T) {
const hex string = "68656C6C6F20776F726C6421"
func TestShouldNotFlagPotentialCreditCardNumberIfAboveThreshold(t *testing.T) {
const creditCardNumber string = "340000000000009"
results := helpers.NewDetectionResults()
content := []byte(hex)
content := []byte(creditCardNumber)
filename := "filename"
additions := []gitrepo.Addition{gitrepo.NewAddition(filename, content)}

Expand Down
110 changes: 55 additions & 55 deletions detector/severity/severity_config.go
@@ -1,59 +1,59 @@
package severity

var SeverityConfiguration = map[string]Severity{
"ConsumerKeyPattern": High(),
"ConsumerSecretParrern": High(),
"AWSKeyPattern": High(),
"AWSSecretPattern": High(),
"RSAKeyPattern": High(),
"DSAFile": High(),
"PrivateKeyFile":High(),
"CreditCardContent": High(),
"PemFile": High(),
"PpkFile": High(),
"SecretToken": High(),
"KeyPairFile": High(),
"CustomPattern": High(),
"PKCSFile": High(),
"PFXFile": High(),
"P12File": High(),
"NetrcFile": High(),
"RSAFile": High(),
"KeyChainFile": High(),
"KeyStoreFile": High(),
"OauthTokenFile":High(),
"HTPASSWDFile": High(),
"TunnelBlockFile": High(),
"CredentialsXML": High(),
"ConsumerKeyPattern": High(),
"ConsumerSecretParrern": High(),
"AWSKeyPattern": High(),
"AWSSecretPattern": High(),
"RSAKeyPattern": High(),
"DSAFile": High(),
"PrivateKeyFile": High(),
"PemFile": High(),
"PpkFile": High(),
"SecretToken": High(),
"KeyPairFile": High(),
"CustomPattern": High(),
"PKCSFile": High(),
"PFXFile": High(),
"P12File": High(),
"NetrcFile": High(),
"RSAFile": High(),
"KeyChainFile": High(),
"KeyStoreFile": High(),
"OauthTokenFile": High(),
"HTPASSWDFile": High(),
"TunnelBlockFile": High(),
"CredentialsXML": High(),
"JenkinsPublishOverSSHFile": High(),
"PasswordPhrasePattern": Medium(),
"OpenVPNFile": Medium(),
"s3Config": Medium(),
"LargeFileSize": Medium(),
"Base64Content": Medium(),
"HexContent": Medium(),
"DatabaseYml": Medium(),
"ShellHistory": Low(),
"ASCFile": Low(),
"KDBFile": Low(),
"AgileKeyChainFile": Low(),
"PubXML": Low(),
"GitRobRC": Low(),
"ShellRC": Low(),
"ShellProfile": Low(),
"ShellAlias": Low(),
"OmniAuth": Low(),
"CarrierWaveRB": Low(),
"SchemaRB": Low(),
"PythonSettings": Low(),
"PhpConfig": Low(),
"PhpLocalSettings": Low(),
"EnvFile": Low(),
"BDumpFile": Low(),
"BSQLFile": Low(),
"PasswordFile":Low(),
"BackupFile":Low(),
"LogFile":Low(),
"KWallet":Low(),
"GNUCash":Low(),
}
"Base64Content": High(),
"HexContent": High(),
"s3Config": Medium(),
"OpenVPNFile": Medium(),
"DatabaseYml": Medium(),
"ShellHistory": Low(),
"ASCFile": Low(),
"KDBFile": Low(),
"AgileKeyChainFile": Low(),
"PubXML": Low(),
"GitRobRC": Low(),
"ShellRC": Low(),
"CreditCardContent": Low(),
"ShellProfile": Low(),
"ShellAlias": Low(),
"OmniAuth": Low(),
"CarrierWaveRB": Low(),
"SchemaRB": Low(),
"PythonSettings": Low(),
"PhpConfig": Low(),
"PhpLocalSettings": Low(),
"EnvFile": Low(),
"BDumpFile": Low(),
"BSQLFile": Low(),
"PasswordFile": Low(),
"BackupFile": Low(),
"LogFile": Low(),
"KWallet": Low(),
"GNUCash": Low(),
"PasswordPhrasePattern": Low(),
"LargeFileSize": Low(),
}

0 comments on commit 3fe938c

Please sign in to comment.