[update] entropy check

This commit is contained in:
zricethezav committed 2018-01-28 17:39:00 -05:00
1 parent 8af639d7ff
commit ec2fc9d6cb
3 files changed
+50 -10

No files matched your search

+19
View File
@@ -10,6 +10,7 @@ func TestCheckRegex(t *testing.T) {
checks := map[string]bool{
"github.com": false,
"github.com/user/": false,
"github.com/user -- Sys": false,
"github_api_client = \"sample key\"": true,
"aws=\"afewafewafewafewaf\"": true,
"aws\"afewafewafewafewaf\"": false,
@@ -25,3 +26,21 @@ func TestCheckRegex(t *testing.T) {
}
}
}
func TestEntropy(t *testing.T) {
var enoughEntropy bool
checks := map[string]bool{
"heroku_client_secret = settings.HEROKU_CLIENT": false,
"heroku_client_secret = conf.heroku": false,
"reddit_secret = settings.REDDIT_API": false,
"reddit_api_secret = \"Fwe4fa431FgklreF\"": true,
"aws_secret= \"AKIAIMNOJVGFDXXXE4OA\"": true,
}
for k, v := range checks {
enoughEntropy = checkEntropy(k)
if v != enoughEntropy {
t.Errorf("checkEntropy failed for %s. Expected %t, got %t", k, v, enoughEntropy)
}
}
}