forked from Yelp/detect-secrets
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Delete GHDetector V1 Follow up of Yelp#184 * Move verify functionality to GHv2 * Addressed @xianjun comment * Address @xianjun comments
- Loading branch information
1 parent
17fa276
commit 753d001
Showing
9 changed files
with
92 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
from detect_secrets.core.constants import VerifiedResult | ||
from detect_secrets.plugins.gh import GHDetector | ||
|
||
|
||
GHE_TOKEN = 'abcdef0123456789abcdef0123456789abcdef01' | ||
GHE_TOKEN_BYTES = b'abcdef0123456789abcdef0123456789abcdef01' | ||
|
||
|
@@ -15,15 +16,42 @@ class TestGHDetector(object): | |
@pytest.mark.parametrize( | ||
'payload, should_flag', | ||
[ | ||
('2764d47e6bf540911b7da8fe55caa9451e783549', True), # not real key | ||
('key :53d49d5081266d939bac57a3d86c517ded974b19', True), # not real key | ||
('53d49dnotakeyata9bac57a3d86c517ded974b19', False), # has non-hex | ||
('a654fd9e3758a65235c765cf51e10df0c80b7a9', False), # only 39 | ||
('a654fd9e3758a65235c765cf51e10df0c80b7a923', False), # 41 | ||
('2764d47e6bf540911b7da8fe55caa9451e783549 ', True), # not real key | ||
('2764d47e6bf540911b7da8fe55caa9451e7835492 ', False), # not real key | ||
('2764d47e6bf540911b7da8fe55caa9451e783549_ ', False), # not real key | ||
('2764d47e6bf540911b7da8fe55caa9451e783549z ', False), # not real key | ||
('github-key 2764d47e6bf540911b7da8fe55caa9451e783549', True), | ||
('github_pwd :53d49d5081266d939bac57a3d86c517ded974b19', True), | ||
('gh-api-key=2764d47e6bf540911b7da8fe55caa9451e783549 ', True), | ||
('git-token => "abcdef0123456789abcdef0123456789abcdef01"', True), | ||
('"GHE_API_KEY": "abcdef0123456789abcdef0123456789abcdef01"', True), | ||
('GITHUB_API_TOKEN := "abcdef0123456789abcdef0123456789abcdef01"', True), | ||
('https://username:[email protected]', True,), | ||
( | ||
'https://username:abcdef0123456789abcdef0123456789abcdef01@' | ||
'api.github.ibm.com', True, | ||
), | ||
('Authorization: token abcdef0123456789abcdef0123456789abcdef01', True), | ||
( | ||
'Authorization: Basic ' | ||
'YWJjZWRmYWJlZmQzMzMzMTQ1OTA4YWJjZGRmY2JkZGUxMTQ1Njc4OQo=', True, | ||
), | ||
('password abcdef0123456789abcdef0123456789abcdef01', True,), | ||
('git+https://[email protected]', True,), | ||
('sonar.github.oauth=abcdef0123456789abcdef0123456789abcdef01', True,), | ||
( | ||
'https://x-oauth-basic:abcdef0123456789abcdef0123456789abcdef01' | ||
'@github.ibm.com/org/repo.git', True, | ||
), | ||
('abcdef0123456789abcdef0123456789abcdef01', False), # no keyword prefix | ||
('gh-token=53d49dnotakeyata9bac57a3d86c517ded974b19', False), # has non-hex | ||
('GIT-KEY: a654fd9e3758a65235c765cf51e10df0c80b7a9', False), # only 39 | ||
('github_api_key: a654fd9e3758a65235c765cf51e10df0c80b7a923', False), # 41 | ||
('gh_key:=2764d47e6bf540911b7da8fe55caa9451e7835492 ', False), | ||
('github-api-token: 2764d47e6bf540911b7da8fe55caa9451e783549_ ', False), | ||
('git_key=2764d47e6bf540911b7da8fe55caa9451e783549z ', False), | ||
('https://<fake-username>:<fake-pass>@github.ibm.com', False), | ||
( | ||
'Authorization: llama ' | ||
'YWJjZWRmYWJlZmQzMzMzMTQ1OTA4YWJjZGRmY2JkZGUxMTQ1Njc4OQo=', False, | ||
), | ||
('Authorization: token %s', False), | ||
], | ||
) | ||
def test_analyze_string(self, payload, should_flag): | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters