Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitelist repo #378

Merged
merged 5 commits into from
May 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
adding tests
  • Loading branch information
zricethezav committed May 9, 2020
commit 4941c9d9fef34daf8c3a5a629e93889fc807b592
10 changes: 10 additions & 0 deletions audit/audit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,16 @@ func TestAudit(t *testing.T) {
},
wantPath: "../test_data/test_local_owner_aws_leak.json",
},
{
description: "test owner path whitelist repo",
opts: options.Options{
OwnerPath: "../test_data/test_repos/",
Report: "../test_data/test_local_owner_aws_leak_whitelist_repo.json.got",
ReportFormat: "json",
Config: "../test_data/test_configs/aws_key_local_owner_whitelist_repo.toml",
},
wantPath: "../test_data/test_local_owner_aws_leak_whitelist_repo.json",
},
{
description: "test entropy and regex",
opts: options.Options{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[[rules]]
description = "AWS Manager ID"
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
tags = ["key", "AWS"]
184 changes: 184 additions & 0 deletions test_data/test_local_owner_aws_leak_whitelist_repo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
[
{
"line": " aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
"offender": "AKIAIO5FODNN7EXAMPLE",
"commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
"repo": "test_repo_1",
"rule": "AWS Manager ID",
"commitMessage": "commit 1 with secrets\n",
"author": "zach rice",
"email": "zricer@protonmail.com",
"file": "server.test.py",
"date": "2019-10-24T09:29:27-04:00",
"tags": "key, AWS"
},
{
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
"offender": "AKIALALEMEL33243OLIB",
"commit": "f61cd8587b7ac1d75a89a0c9af870a2f24c60263",
"repo": "test_repo_2",
"rule": "AWS Manager ID",
"commitMessage": "rm secrets again\n",
"author": "zach rice",
"email": "zricer@protonmail.com",
"file": "secrets.md",
"date": "2019-10-25T13:12:32-04:00",
"tags": "key, AWS"
},
{
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
"offender": "AKIALALEMEL33243OLIB",
"commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
"repo": "test_repo_2",
"rule": "AWS Manager ID",
"commitMessage": "adding another one\n",
"author": "zach rice",
"email": "zricer@protonmail.com",
"file": "secrets.md",
"date": "2019-10-25T13:12:08-04:00",
"tags": "key, AWS"
},
{
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
"offender": "AKIALALEMEL33243OLIA",
"commit": "996865bb912f3bc45898a370a13aadb315014b55",
"repo": "test_repo_2",
"rule": "AWS Manager ID",
"commitMessage": "committing pem\n",
"author": "zach rice",
"email": "zricer@protonmail.com",
"file": "secrets.md",
"date": "2019-10-25T13:07:41-04:00",
"tags": "key, AWS"
},
{
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
"offender": "AKIALALEMEL33243OLIA",
"commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
"repo": "test_repo_2",
"rule": "AWS Manager ID",
"commitMessage": "wait this is actually adding an aws secret\n",
"author": "zach rice",
"email": "zricer@protonmail.com",
"file": "secrets.md",
"date": "2019-10-25T13:01:27-04:00",
"tags": "key, AWS"
},
{
"line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
"offender": "AKIALALEMEL33243OLIA",
"commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
"repo": "test_repo_2",
"rule": "AWS Manager ID",
"commitMessage": "wait this is actually adding an aws secret\n",
"author": "zach rice",
"email": "zricer@protonmail.com",
"file": "secrets.md",
"date": "2019-10-25T13:01:27-04:00",
"tags": "key, AWS"
},
{
"line": "\nHere's an AWS secret: AKIALALEMEL33243OLIAE",
"offender": "AKIALALEMEL33243OLIA",
"commit": "b10b3e2cb320a8c211fda94c4567299d37de7776",
"repo": "test_repo_2",
"rule": "AWS Manager ID",
"commitMessage": "adding aws key\n",
"author": "zach rice",
"email": "zricer@protonmail.com",
"file": "secrets.md",
"date": "2019-10-25T12:58:39-04:00",
"tags": "key, AWS"
},
{
"line": "const AWSKEY = \"AKIALALEMEL33243OLIAE\"",
"offender": "AKIALALEMEL33243OLIA",
"commit": "cd5eb8bef855f73c46b97b4c088badffdc40ebe9",
"repo": "test_repo_3",
"rule": "AWS Manager ID",
"commitMessage": "rm secrets\n",
"author": "zach rice",
"email": "zricer@protonmail.com",
"file": "secrets.md",
"date": "2019-10-25T13:54:26-04:00",
"tags": "key, AWS"
},
{
"line": "const AWSKEY = \"AKIALALEMEL33243OLIAE\"",
"offender": "AKIALALEMEL33243OLIA",
"commit": "84ac4e80d4dbf2c968b64e9d4005f5079795bb81",
"repo": "test_repo_3",
"rule": "AWS Manager ID",
"commitMessage": "more secrets\n",
"author": "zach rice",
"email": "zricer@protonmail.com",
"file": "secrets.md",
"date": "2019-10-25T13:54:08-04:00",
"tags": "key, AWS"
},
{
"line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
"offender": "AKIALALEMEL33243OLIA",
"commit": "64cfcee9aad1c84581631636bfc54f2050718d1a",
"repo": "test_repo_3",
"rule": "AWS Manager ID",
"commitMessage": "rm secrets\n",
"author": "zach rice",
"email": "zricer@protonmail.com",
"file": "secrets.md",
"date": "2019-10-25T13:36:22-04:00",
"tags": "key, AWS"
},
{
"line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
"offender": "AKIALALEMEL33243OLIA",
"commit": "deea550dd6c7acaf0e59432600593533984a2125",
"repo": "test_repo_3",
"rule": "AWS Manager ID",
"commitMessage": "dev branch\n",
"author": "zach rice",
"email": "zricer@protonmail.com",
"file": "secrets.md",
"date": "2019-10-25T13:35:03-04:00",
"tags": "key, AWS"
},
{
"line": "\naws_access_key_id='AKIAIO5FODNN7EXAMPL2'",
"offender": "AKIAIO5FODNN7EXAMPL2",
"commit": "ca71fcdeda15f25f0cc661d90e8785c255925c27",
"repo": "test_repo_5",
"rule": "AWS Manager ID",
"commitMessage": "introduce more secrets\n",
"author": "Zach Rice",
"email": "zrice@gitlab.com",
"file": "secrets.py",
"date": "2020-02-01T10:08:04-05:00",
"tags": "key, AWS"
},
{
"line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE'",
"offender": "AKIAIO5FODNN7EXAMPLE",
"commit": "1f2a4abc47dabf991e6af6f9770867ce0ac1f360",
"repo": "test_repo_5",
"rule": "AWS Manager ID",
"commitMessage": "introduce secrets\n",
"author": "Zach Rice",
"email": "zrice@gitlab.com",
"file": "secrets.py",
"date": "2020-02-01T10:07:34-05:00",
"tags": "key, AWS"
},
{
"line": "aws_access_key_id=AKIAIO5FODNN7EXAMPLE",
"offender": "AKIAIO5FODNN7EXAMPLE",
"commit": "98b6c7cb3fb29a5993c4c95c56a2dc53050b9247",
"repo": "test_repo_6",
"rule": "AWS Manager ID",
"commitMessage": "Adding some secrets in config folder\n\n",
"author": "Noel Algora",
"email": "noealgigu@gmail.com",
"file": "config/application.properties",
"date": "2020-02-24T14:13:15-05:00",
"tags": "key, AWS"
}
]