-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support wildcard SANs and log invalid SANs (#280)
- Loading branch information
1 parent
87a8cb5
commit 2da8376
Showing
3 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
modules/terraform-aws-ca-lambda/unittests/test_validate_sans.py
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,41 @@ | ||
from utils.certs.types import filter_and_validate_sans | ||
|
||
|
||
def test_filter_and_validate_sans(): | ||
sans = ["example.com", "example.org", "example.net"] | ||
output = filter_and_validate_sans("example.com", sans) | ||
expected = ["example.com", "example.org", "example.net"] | ||
|
||
assert output == expected | ||
|
||
|
||
def test_filter_and_validate_sans_invalid_domain(): | ||
sans = ["example.com", "example.org", "net"] | ||
output = filter_and_validate_sans("example.com", sans) | ||
expected = ["example.com", "example.org"] | ||
|
||
assert output == expected | ||
|
||
|
||
def test_filter_and_validate_sans_wildcard_allowed(): | ||
sans = ["example.com", "example.org", "*.example.net"] | ||
output = filter_and_validate_sans("example.com", sans) | ||
expected = ["example.com", "example.org", "*.example.net"] | ||
|
||
assert output == expected | ||
|
||
|
||
def test_filter_and_validate_sans_wildcard_disallowed_if_base_domain_invalid(): | ||
sans = ["example.com", "example.org", "*.net"] | ||
output = filter_and_validate_sans("example.com", sans) | ||
expected = ["example.com", "example.org"] | ||
|
||
assert output == expected | ||
|
||
|
||
def test_filter_and_validate_sans_mixed_domains(): | ||
sans = ["example.com", "example.org", "*.example.net", "*.net", "Invalid DNS name"] | ||
output = filter_and_validate_sans("example.com", sans) | ||
expected = ["example.com", "example.org", "*.example.net"] | ||
|
||
assert output == 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