-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Mozilla SOPS detection * Move is_static to utils * AWS ARN parsing and rule * Reorder args * Create common text parser class * Common operations * Common string ops
- Loading branch information
Showing
22 changed files
with
274 additions
and
147 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<tests> | ||
<compliant> | ||
<ok01>aws:arn:</ok01> | ||
<ok02>arn:aws:kms:{REGION}:{ACCOUNT}:key/{KEY_ID}</ok02> | ||
</compliant> | ||
<noncompliant> | ||
<arn01>arn:aws:kms:eu-central-1:123456123456:key/hardcoded</arn01> | ||
<arn02>arn:aws:kms:ap-southeast-1:123456123456:key/hardcoded</arn02> | ||
<arn03>arn:aws:iam::123456123456:oidc-provider/auth-dev.mozilla.auth0.com</arn03> | ||
</noncompliant> | ||
</tests> |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
compliant: | ||
arn01: "aws:arn:" | ||
arn02: arn:aws:kms:{REGION}:{ACCOUNT}:key/{KEY_ID} | ||
|
||
|
||
noncompliant: | ||
arn01: arn:aws:kms:eu-central-1:123456123456:key/hardcoded | ||
arn02: arn:aws:kms:ap-southeast-1:123456123456:key/hardcoded | ||
arn03: arn:aws:iam::123456123456:oidc-provider/auth-dev.mozilla.auth0.com | ||
arn_list: | ||
- arn:aws:kms:eu-central-1:123456123456:key/hardcoded |
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ Compliant: | |
|
||
-----ok | ||
---ok--- | ||
-----ok----- | ||
|
||
|
||
Noncompliant: | ||
|
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# https://github.com/mozilla/sops | ||
|
||
compliant: | ||
password: ENC[AES256_GCM,data:HARDCODED,iv:1=,aad:No=,tag:k=] | ||
|
||
noncompliant: | ||
password: hardcoded01 |
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 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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import pytest | ||
|
||
from whispers.plugins.common import Common | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("text", "expected"), | ||
[ | ||
("", None), | ||
(123, None), | ||
("jdbc:mysql://localhost/authority?userpass=hardcoded0", "hardcoded0"), | ||
("arn:aws:kms:eu-central-1:123456123456:key/hardcoded", "123456123456"), | ||
], | ||
) | ||
def test_pairs(text, expected): | ||
plugin = Common() | ||
for pair in plugin.pairs(text): | ||
assert pair.value == expected | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("text", "expected"), | ||
[ | ||
("http", None), | ||
("jdbc:mysql://localhost/authority?userpass=hardcoded0", "hardcoded0"), | ||
("jdbc:mysql://localhost/authority?user=&userpass=", None), | ||
("amqp://root:[email protected]:5434/topic", "root:hardcoded2"), | ||
("amqp://[email protected]:5434/topic", None), | ||
("amqp://localhost.local:5434/topic", None), | ||
], | ||
) | ||
def test_parse_uri(text, expected): | ||
plugin = Common() | ||
for pair in plugin.parse_uri(text): | ||
assert pair.value == expected | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("text", "expected"), | ||
[ | ||
("invalid:", None), | ||
("arn:aws:kms:eu-central-1", None), | ||
("arn:aws:kms:eu-central-1:", None), | ||
("arn:aws:kms:eu-central-1:123456123456:key/hardcoded", "123456123456"), | ||
], | ||
) | ||
def test_parse_arn(text, expected): | ||
plugin = Common() | ||
for pair in plugin.parse_arn(text): | ||
assert pair.value == expected |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
VERSION = (2, 0, 4) | ||
VERSION = (2, 0, 5) | ||
|
||
__version__ = ".".join(map(str, VERSION)) | ||
|
||
|
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 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
Oops, something went wrong.