-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup unneeded ResourceType/LogType fields in policy/rule tests (#34)
The ResourceType (in policy tests) and LogType (in rule tests) fields are not necessary since they can be inferred from the policy/rule under test. The tool has been changed to successfully parse older policy/rule tests that include these fields. However, this is a backwards-incompatible change for the analysis-api and the fields must be present in the tests when deploying them to older Panther versions. See https://github.com/panther-labs/panther/issues/610 for more context.
- Loading branch information
Showing
13 changed files
with
92 additions
and
27 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 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 |
---|---|---|
|
@@ -13,5 +13,4 @@ Tests: | |
- | ||
Name: Dummy Test | ||
ExpectedResult: true | ||
ResourceType: AWS.Dummy.Type | ||
Resource: {} |
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
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
33 changes: 33 additions & 0 deletions
33
tests/fixtures/valid_analysis/policies/example_policy_extraneous_fields.yml
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,33 @@ | ||
AnalysisType: policy | ||
Filename: example_policy.py | ||
DisplayName: MFA Is Enabled For User | ||
Description: MFA is a security best practice that adds an extra layer of protection for your AWS account logins. | ||
Severity: High | ||
PolicyID: AWS.IAM.MFAEnabled Extra Fields | ||
Enabled: true | ||
ResourceTypes: | ||
- AWS.IAM.RootUser.Snapshot | ||
- AWS.IAM.User.Snapshot | ||
Tags: | ||
- AWS Managed Rules - Security, Identity & Compliance | ||
- AWS | ||
- CIS | ||
- SOC2 | ||
Runbook: > | ||
Find out who disabled MFA on the account. | ||
Reference: https://www.link-to-info.io | ||
Suppressions: | ||
- aws:resource:1 | ||
- aws:.*:other-resource | ||
Tests: | ||
- | ||
Name: Root MFA not enabled triggers a violation. | ||
ExpectedResult: false | ||
ResourceType: AWS.IAM.User.Snapshot (extraneous field) | ||
Resource: | ||
Arn: arn:aws:iam::123456789012:user/root | ||
CreateDate: 2019-01-01T00:00:00Z | ||
CredentialReport: | ||
MfaActive: false | ||
PasswordEnabled: true | ||
UserName: root |
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
43 changes: 43 additions & 0 deletions
43
tests/fixtures/valid_analysis/rules/example_rule_extraneous_fields.yml
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,43 @@ | ||
AnalysisType: rule | ||
Filename: example_rule.py | ||
DisplayName: MFA Rule | ||
Description: MFA is a security best practice that adds an extra layer of protection for your AWS account logins. | ||
Severity: High | ||
RuleID: AWS.CloudTrail.MFAEnabled Extra Fields | ||
Enabled: true | ||
LogTypes: | ||
- AWS.CloudTrail | ||
Tags: | ||
- AWS Managed Rules - Security, Identity & Compliance | ||
- AWS | ||
- CIS | ||
- SOC2 | ||
Runbook: > | ||
Find out who disabled MFA on the account. | ||
Reference: https://www.link-to-info.io | ||
Tests: | ||
- | ||
Name: Root MFA not enabled fails compliance | ||
LogType: AWS.CloudTrail (extraneous Field) | ||
ExpectedResult: false | ||
Log: | ||
Arn: arn:aws:iam::123456789012:user/root | ||
CreateDate: 2019-01-01T00:00:00Z | ||
CredentialReport: | ||
MfaActive: false | ||
PasswordEnabled: true | ||
UserName: root | ||
- | ||
Name: User MFA not enabled fails compliance | ||
LogType: AWS.CloudTrail (extraneous Field) | ||
ExpectedResult: false | ||
Log: | ||
{ | ||
"Arn": "arn:aws:iam::123456789012:user/test", | ||
"CreateDate": "2019-01-01T00:00:00", | ||
"CredentialReport": { | ||
"MfaActive": false, | ||
"PasswordEnabled": true | ||
}, | ||
"UserName": "test" | ||
} |