Skip to content

Commit

Permalink
adding alt config test
Browse files Browse the repository at this point in the history
  • Loading branch information
zricethezav committed Nov 11, 2019
1 parent 41ef2a8 commit 2ccd406
Show file tree
Hide file tree
Showing 65 changed files with 283 additions and 0 deletions.
10 changes: 10 additions & 0 deletions audit/audit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,16 @@ func TestAudit(t *testing.T) {
},
wantPath: "../test_data/test_entropy.json",
},
{
description: "test local repo four entropy alternative config",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_4",
Report: "../test_data/test_local_repo_four_alt_config_entropy.json.got",
RepoConfig: true,

},
wantPath: "../test_data/test_local_repo_four_alt_config_entropy.json.got",
},
}

for _, test := range tests {
Expand Down
140 changes: 140 additions & 0 deletions test_data/test_local_owner_aws_leak.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,5 +236,145 @@
"date": "2019-10-25T12:58:39-04:00",
"tags": "key, AWS",
"severity": ""
},
{
"line": "const AWSKEY = \"AKIALALEMEL33243OLIAE\"",
"offender": "AKIALALEMEL33243OLIA",
"commit": "cd5eb8bef855f73c46b97b4c088badffdc40ebe9",
"repo": "test_repo_4",
"rule": "AWS Manager ID",
"commitMessage": "rm secrets\n",
"author": "zach rice",
"email": "[email protected]",
"file": "secrets.md",
"date": "2019-10-25T13:54:26-04:00",
"tags": "key, AWS",
"severity": ""
},
{
"line": "const AWSKEY = \"AKIALALEMEL33243OLIAE\"",
"offender": "AKIALALEMEL33243OLIA",
"commit": "84ac4e80d4dbf2c968b64e9d4005f5079795bb81",
"repo": "test_repo_4",
"rule": "AWS Manager ID",
"commitMessage": "more secrets\n",
"author": "zach rice",
"email": "[email protected]",
"file": "secrets.md",
"date": "2019-10-25T13:54:08-04:00",
"tags": "key, AWS",
"severity": ""
},
{
"line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
"offender": "AKIALALEMEL33243OLIA",
"commit": "64cfcee9aad1c84581631636bfc54f2050718d1a",
"repo": "test_repo_4",
"rule": "AWS Manager ID",
"commitMessage": "rm secrets\n",
"author": "zach rice",
"email": "[email protected]",
"file": "secrets.md",
"date": "2019-10-25T13:36:22-04:00",
"tags": "key, AWS",
"severity": ""
},
{
"line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
"offender": "AKIALALEMEL33243OLIA",
"commit": "deea550dd6c7acaf0e59432600593533984a2125",
"repo": "test_repo_4",
"rule": "AWS Manager ID",
"commitMessage": "dev branch\n",
"author": "zach rice",
"email": "[email protected]",
"file": "secrets.md",
"date": "2019-10-25T13:35:03-04:00",
"tags": "key, AWS",
"severity": ""
},
{
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
"offender": "AKIALALEMEL33243OLIB",
"commit": "f61cd8587b7ac1d75a89a0c9af870a2f24c60263",
"repo": "test_repo_4",
"rule": "AWS Manager ID",
"commitMessage": "rm secrets again\n",
"author": "zach rice",
"email": "[email protected]",
"file": "secrets.md",
"date": "2019-10-25T13:12:32-04:00",
"tags": "key, AWS",
"severity": ""
},
{
"line": " const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
"offender": "AKIALALEMEL33243OLIB",
"commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
"repo": "test_repo_4",
"rule": "AWS Manager ID",
"commitMessage": "adding another one\n",
"author": "zach rice",
"email": "[email protected]",
"file": "secrets.md",
"date": "2019-10-25T13:12:08-04:00",
"tags": "key, AWS",
"severity": ""
},
{
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
"offender": "AKIALALEMEL33243OLIA",
"commit": "996865bb912f3bc45898a370a13aadb315014b55",
"repo": "test_repo_4",
"rule": "AWS Manager ID",
"commitMessage": "committing pem\n",
"author": "zach rice",
"email": "[email protected]",
"file": "secrets.md",
"date": "2019-10-25T13:07:41-04:00",
"tags": "key, AWS",
"severity": ""
},
{
"line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
"offender": "AKIALALEMEL33243OLIA",
"commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
"repo": "test_repo_4",
"rule": "AWS Manager ID",
"commitMessage": "wait this is actually adding an aws secret\n",
"author": "zach rice",
"email": "[email protected]",
"file": "secrets.md",
"date": "2019-10-25T13:01:27-04:00",
"tags": "key, AWS",
"severity": ""
},
{
"line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
"offender": "AKIALALEMEL33243OLIA",
"commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
"repo": "test_repo_4",
"rule": "AWS Manager ID",
"commitMessage": "wait this is actually adding an aws secret\n",
"author": "zach rice",
"email": "[email protected]",
"file": "secrets.md",
"date": "2019-10-25T13:01:27-04:00",
"tags": "key, AWS",
"severity": ""
},
{
"line": "\nHere's an AWS secret: AKIALALEMEL33243OLIAE",
"offender": "AKIALALEMEL33243OLIA",
"commit": "b10b3e2cb320a8c211fda94c4567299d37de7776",
"repo": "test_repo_4",
"rule": "AWS Manager ID",
"commitMessage": "adding aws key\n",
"author": "zach rice",
"email": "[email protected]",
"file": "secrets.md",
"date": "2019-10-25T12:58:39-04:00",
"tags": "key, AWS",
"severity": ""
}
]
30 changes: 30 additions & 0 deletions test_data/test_local_repo_four_alt_config_entropy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
{
"line": " Just moments after the Cessna's inquiry, a Twin Beech piped up on frequency, in a rather superior tone, asking for his ground speed. \"I have you at one hundred and twenty-five knots of ground spe",
"offender": "Entropy range [{P1:4.5 P2:4.7}]",
"commit": "d8ac0b73aeeb45843319cdc5ce506516eb49bf7a",
"repo": "test_repo_4",
"rule": "entropy",
"commitMessage": "removing secret.pem\n",
"author": "zach rice",
"email": "[email protected]",
"file": "secret.pem",
"date": "2019-10-25T13:08:39-04:00",
"tags": "entropy",
"severity": ""
},
{
"line": " Just moments after the Cessna's inquiry, a Twin Beech piped up on frequency, in a rather superior tone, asking for his ground speed. \"I have you at one hundred and twenty-five knots of ground spe",
"offender": "Entropy range [{P1:4.5 P2:4.7}]",
"commit": "996865bb912f3bc45898a370a13aadb315014b55",
"repo": "test_repo_4",
"rule": "entropy",
"commitMessage": "committing pem\n",
"author": "zach rice",
"email": "[email protected]",
"file": "secret.pem",
"date": "2019-10-25T13:07:41-04:00",
"tags": "entropy",
"severity": ""
}
]
1 change: 1 addition & 0 deletions test_data/test_repos/test_repo_4/dotGit/COMMIT_EDITMSG
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gitleaks toml
1 change: 1 addition & 0 deletions test_data/test_repos/test_repo_4/dotGit/HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref: refs/heads/master
7 changes: 7 additions & 0 deletions test_data/test_repos/test_repo_4/dotGit/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
1 change: 1 addition & 0 deletions test_data/test_repos/test_repo_4/dotGit/description
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.
Binary file added test_data/test_repos/test_repo_4/dotGit/index
Binary file not shown.
6 changes: 6 additions & 0 deletions test_data/test_repos/test_repo_4/dotGit/info/exclude
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
18 changes: 18 additions & 0 deletions test_data/test_repos/test_repo_4/dotGit/logs/HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
0000000000000000000000000000000000000000 85699e429f33e75541530998a5b5d457a12e6285 zach rice <[email protected]> 1572022632 -0400 commit (initial): init
85699e429f33e75541530998a5b5d457a12e6285 b10b3e2cb320a8c211fda94c4567299d37de7776 zach rice <[email protected]> 1572022719 -0400 commit: adding aws key
b10b3e2cb320a8c211fda94c4567299d37de7776 51f6dcf6b89b93f4075ba92c400b075631a6cc93 zach rice <[email protected]> 1572022773 -0400 commit: no secrets
51f6dcf6b89b93f4075ba92c400b075631a6cc93 17471a5fda722a9e423f1a0d3f0d267ea009d41c zach rice <[email protected]> 1572022887 -0400 commit: wait this is actually adding an aws secret
17471a5fda722a9e423f1a0d3f0d267ea009d41c 996865bb912f3bc45898a370a13aadb315014b55 zach rice <[email protected]> 1572023261 -0400 commit: committing pem
996865bb912f3bc45898a370a13aadb315014b55 d8ac0b73aeeb45843319cdc5ce506516eb49bf7a zach rice <[email protected]> 1572023319 -0400 commit: removing secret.pem
d8ac0b73aeeb45843319cdc5ce506516eb49bf7a b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba zach rice <[email protected]> 1572023528 -0400 commit: adding another one
b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba f61cd8587b7ac1d75a89a0c9af870a2f24c60263 zach rice <[email protected]> 1572023552 -0400 commit: rm secrets again
f61cd8587b7ac1d75a89a0c9af870a2f24c60263 f61cd8587b7ac1d75a89a0c9af870a2f24c60263 zach rice <[email protected]> 1572024822 -0400 checkout: moving from master to dev
f61cd8587b7ac1d75a89a0c9af870a2f24c60263 deea550dd6c7acaf0e59432600593533984a2125 zach rice <[email protected]> 1572024903 -0400 commit: dev branch
deea550dd6c7acaf0e59432600593533984a2125 64cfcee9aad1c84581631636bfc54f2050718d1a zach rice <[email protected]> 1572024982 -0400 commit: rm secrets
64cfcee9aad1c84581631636bfc54f2050718d1a f61cd8587b7ac1d75a89a0c9af870a2f24c60263 zach rice <[email protected]> 1572024992 -0400 checkout: moving from dev to master
f61cd8587b7ac1d75a89a0c9af870a2f24c60263 84ac4e80d4dbf2c968b64e9d4005f5079795bb81 zach rice <[email protected]> 1572026048 -0400 commit: more secrets
84ac4e80d4dbf2c968b64e9d4005f5079795bb81 cd5eb8bef855f73c46b97b4c088badffdc40ebe9 zach rice <[email protected]> 1572026066 -0400 commit: rm secrets
cd5eb8bef855f73c46b97b4c088badffdc40ebe9 828595723b76e4a35b5253d9f2ccb4f897f1845a zach rice <[email protected]> 1573429084 -0500 commit: adding repo config
828595723b76e4a35b5253d9f2ccb4f897f1845a ce835da266b3f8c34e4b7f398693ed068f67cb30 zach rice <[email protected]> 1573431270 -0500 commit: epstein didnt kill himself
ce835da266b3f8c34e4b7f398693ed068f67cb30 5accbc40c35906d99f073881fb8746c314f9d59f zach rice <[email protected]> 1573431335 -0500 commit: removing a really important link
5accbc40c35906d99f073881fb8746c314f9d59f 7b2eba252004b7c867413def2a0984d545daab8b zach rice <[email protected]> 1573431386 -0500 commit: gitleaks toml
3 changes: 3 additions & 0 deletions test_data/test_repos/test_repo_4/dotGit/logs/refs/heads/dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
0000000000000000000000000000000000000000 f61cd8587b7ac1d75a89a0c9af870a2f24c60263 zach rice <[email protected]> 1572024822 -0400 branch: Created from HEAD
f61cd8587b7ac1d75a89a0c9af870a2f24c60263 deea550dd6c7acaf0e59432600593533984a2125 zach rice <[email protected]> 1572024903 -0400 commit: dev branch
deea550dd6c7acaf0e59432600593533984a2125 64cfcee9aad1c84581631636bfc54f2050718d1a zach rice <[email protected]> 1572024982 -0400 commit: rm secrets
14 changes: 14 additions & 0 deletions test_data/test_repos/test_repo_4/dotGit/logs/refs/heads/master
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
0000000000000000000000000000000000000000 85699e429f33e75541530998a5b5d457a12e6285 zach rice <[email protected]> 1572022632 -0400 commit (initial): init
85699e429f33e75541530998a5b5d457a12e6285 b10b3e2cb320a8c211fda94c4567299d37de7776 zach rice <[email protected]> 1572022719 -0400 commit: adding aws key
b10b3e2cb320a8c211fda94c4567299d37de7776 51f6dcf6b89b93f4075ba92c400b075631a6cc93 zach rice <[email protected]> 1572022773 -0400 commit: no secrets
51f6dcf6b89b93f4075ba92c400b075631a6cc93 17471a5fda722a9e423f1a0d3f0d267ea009d41c zach rice <[email protected]> 1572022887 -0400 commit: wait this is actually adding an aws secret
17471a5fda722a9e423f1a0d3f0d267ea009d41c 996865bb912f3bc45898a370a13aadb315014b55 zach rice <[email protected]> 1572023261 -0400 commit: committing pem
996865bb912f3bc45898a370a13aadb315014b55 d8ac0b73aeeb45843319cdc5ce506516eb49bf7a zach rice <[email protected]> 1572023319 -0400 commit: removing secret.pem
d8ac0b73aeeb45843319cdc5ce506516eb49bf7a b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba zach rice <[email protected]> 1572023528 -0400 commit: adding another one
b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba f61cd8587b7ac1d75a89a0c9af870a2f24c60263 zach rice <[email protected]> 1572023552 -0400 commit: rm secrets again
f61cd8587b7ac1d75a89a0c9af870a2f24c60263 84ac4e80d4dbf2c968b64e9d4005f5079795bb81 zach rice <[email protected]> 1572026048 -0400 commit: more secrets
84ac4e80d4dbf2c968b64e9d4005f5079795bb81 cd5eb8bef855f73c46b97b4c088badffdc40ebe9 zach rice <[email protected]> 1572026066 -0400 commit: rm secrets
cd5eb8bef855f73c46b97b4c088badffdc40ebe9 828595723b76e4a35b5253d9f2ccb4f897f1845a zach rice <[email protected]> 1573429084 -0500 commit: adding repo config
828595723b76e4a35b5253d9f2ccb4f897f1845a ce835da266b3f8c34e4b7f398693ed068f67cb30 zach rice <[email protected]> 1573431270 -0500 commit: epstein didnt kill himself
ce835da266b3f8c34e4b7f398693ed068f67cb30 5accbc40c35906d99f073881fb8746c314f9d59f zach rice <[email protected]> 1573431335 -0500 commit: removing a really important link
5accbc40c35906d99f073881fb8746c314f9d59f 7b2eba252004b7c867413def2a0984d545daab8b zach rice <[email protected]> 1573431386 -0500 commit: gitleaks toml
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
x��A
1 E]���Ҥ�f
"^%M#8S�u������{<���u@4F7�� ��EfC��������X�϶ ��nۀ��#-���J��*9j�S�5p5fNN���:|D��58~ӯ��F�VY'm�pb�D��>z�v�_�W�/�n���fG�
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x��Qj!��S�����*���hOϮ�8b��gr�|<�AIo�N��p�C0zDt�����q�(�%Ni ����#�'�F�K�1Z��SW�J)r:E�q� ���_����<`TQx�a|�Ͼ�\�����9B"o�[k��L������w��ah޶���c�3~����v�PK
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
x}�1O�0���+u@B���T���tB*00�͵6q�Ql+2���$-!Hd�Ǿ{ﻷ�n����l6�7m<�E88
ʐ�*����,�V��=,Ac��!�!��d�@��~��X ^�� ��˷�k�u�Z����\:R�f1�.z
`�+���uIU*՞:���L�o�J�i�shPY��F��{�l h���8(��;+�*��w�N����VZ� �@4�Ύ�(�).;�o��!���+b�����g?�� �J����7��
9S(L�dK�imw����'�s F��d����b�����$���+F�(A��V�'���G�����6��3������� ����0
*$���qH��c@�da��b����$��g�7�D
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
x��Q
�0P�s����Y�l
"^e��҂1��Oo�~�0�`���v �Cof��q��^t�y��<�@�U����=�٣Ü�N9fY�O%�c�Qh�� )����R�Eh�\��h�g��>�����r�v�!�����b���+�l����>��G�
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
x��K
�0@]�se2���2M&�`�⦧�.����XKY:���T5� *��죤+2��I���yvh��M�� ;6�s&�Q�l�͘(�
☜����\�ghKT��_���j�k��u����x&$K���p�c��_�^�'lZ��>J$
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
x��]
�0�}�)�J��D�J��҂i�6����+�40�1�j]; �Kf09�}���4Q(�3k�l���etXԞ���$2t1%�Hх� �b����>�hsw�>}ig�d%��� y��z�jZ�7j� w�Q����U��������
�p?���G|
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x��Aj�0 Eg�S�-�lE �W�����ป9}�+t��?>��j-�O��U!z���"#96D �$�3#-ѫM�攮ǀp��]�Y�8����%cJ��p��'1�3���-i�^������}�6�Q�쟩�/���w��K֚{����l����ֲ޹��ﰕz��/F�Mq
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x��Aj1 E��)t�۲b B�UdEI���]���^!��kom�1}�ad�%�WO��$\3#'ΨY �pÐ�m2l��|,G��C�a�D��`�P�Z1��9���>�%�������?㲍>��d�9hog���G�����n���i�nX��z���yج�7�&J/
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x��A
� E��s�5J�UƙI�1���^���x��S-e�`s�M<{��:�!I&J�.������GQ6Y;d+yp8J1��);DL�>Rd�'�8��O�k�i������M{n���\�7�����ཅ�vZ�Ӟ���V`j�w�.����K�
1 change: 1 addition & 0 deletions test_data/test_repos/test_repo_4/dotGit/refs/heads/dev
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
64cfcee9aad1c84581631636bfc54f2050718d1a
1 change: 1 addition & 0 deletions test_data/test_repos/test_repo_4/dotGit/refs/heads/master
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7b2eba252004b7c867413def2a0984d545daab8b
6 changes: 6 additions & 0 deletions test_data/test_repos/test_repo_4/gitleaks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[[rules]]
description = "entropy"
entropies = [
"4.5-4.7",
]
tags = ["entropy"]
1 change: 1 addition & 0 deletions test_data/test_repos/test_repo_4/no_secrets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
### This file does not contain any secrets
21 changes: 21 additions & 0 deletions test_data/test_repos/test_repo_4/secrets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### This file contains some secrets


<Cthon98> hey, if you type in your pw, it will show as stars
<Cthon98> ********* see!
<AzureDiamond> hunter2
<AzureDiamond> doesnt look like stars to me
<Cthon98> <AzureDiamond> *******
<Cthon98> thats what I see
<AzureDiamond> oh, really?
<Cthon98> Absolutely
<AzureDiamond> you can go hunter2 my hunter2-ing hunter2
<AzureDiamond> haha, does that look funny to you?
<Cthon98> lol, yes. See, when YOU type hunter2, it shows to us as *******
<AzureDiamond> thats neat, I didnt know IRC did that
<Cthon98> yep, no matter how many times you type hunter2, it will show to us as *******
<AzureDiamond> awesome!
<AzureDiamond> wait, how do you know my pw?
<Cthon98> er, I just copy pasted YOUR ******'s and it appears to YOU as hunter2 cause its your pw
<AzureDiamond> oh, ok.

0 comments on commit 2ccd406

Please sign in to comment.