This repository has been archived by the owner on Jun 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d6b29d
commit 4b8f029
Showing
15 changed files
with
184 additions
and
23 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
44 changes: 44 additions & 0 deletions
44
internal/app/cfsec/rules/aws/vpc/add_description_to_security_group_rule_rule.go
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,44 @@ | ||
package vpc | ||
|
||
import ( | ||
"github.com/aquasecurity/cfsec/internal/app/cfsec/rule" | ||
"github.com/aquasecurity/cfsec/internal/app/cfsec/scanner" | ||
"github.com/aquasecurity/defsec/rules/aws/vpc" | ||
) | ||
|
||
func init() { | ||
scanner.RegisterCheckRule(rule.Rule{ | ||
|
||
BadExample: []string{ | ||
`--- | ||
AWSTemplateFormatVersion: 2010-09-09 | ||
Description: Bad Example of ApiGateway | ||
Resources: | ||
BadSecurityGroup: | ||
Type: AWS::EC2::SecurityGroup | ||
Properties: | ||
GroupDescription: Limits security group egress traffic | ||
SecurityGroupEgress: | ||
- CidrIp: 127.0.0.1/32 | ||
IpProtocol: "-1" | ||
`, | ||
}, | ||
|
||
GoodExample: []string{ | ||
`--- | ||
AWSTemplateFormatVersion: 2010-09-09 | ||
Description: Bad Example of ApiGateway | ||
Resources: | ||
GoodSecurityGroup: | ||
Type: AWS::EC2::SecurityGroup | ||
Properties: | ||
GroupDescription: Limits security group egress traffic | ||
SecurityGroupEgress: | ||
- CidrIp: 127.0.0.1/32 | ||
Description: "Can connect to loopback" | ||
IpProtocol: "-1" | ||
`, | ||
}, | ||
Base: vpc.CheckAddDescriptionToSecurityGroupRule, | ||
}) | ||
} |
17 changes: 17 additions & 0 deletions
17
internal/app/cfsec/rules/aws/vpc/add_description_to_security_group_rule_rule_test.go
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,17 @@ | ||
package vpc | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/aquasecurity/cfsec/internal/app/cfsec/test" | ||
) | ||
|
||
func Test_VPCSGRDescription_FailureExamples(t *testing.T) { | ||
expectedCode := "aws-vpc-add-description-to-security-group-rule" | ||
test.RunFailureExamplesTest(t, expectedCode) | ||
} | ||
|
||
func Test_VPCSGRDescription_PassedExamples(t *testing.T) { | ||
expectedCode := "aws-vpc-add-description-to-security-group-rule" | ||
test.RunPassingExamplesTest(t, expectedCode) | ||
} |
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
49 changes: 49 additions & 0 deletions
49
internal/app/cfsec/rules/aws/vpc/no_excessive_port_access_rule.go
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,49 @@ | ||
package vpc | ||
|
||
import ( | ||
"github.com/aquasecurity/cfsec/internal/app/cfsec/rule" | ||
"github.com/aquasecurity/cfsec/internal/app/cfsec/scanner" | ||
"github.com/aquasecurity/defsec/rules/aws/vpc" | ||
) | ||
|
||
func init() { | ||
scanner.RegisterCheckRule(rule.Rule{ | ||
|
||
BadExample: []string{ | ||
`--- | ||
AWSTemplateFormatVersion: 2010-09-09 | ||
Description: Bad Example of ApiGateway | ||
Resources: | ||
NetworkACL: | ||
Type: AWS::EC2::NetworkAcl | ||
Properties: | ||
VpcId: "something" | ||
Rule: | ||
Type: AWS::EC2::NetworkAclEntry | ||
Properties: | ||
NetworkAclId: | ||
Ref: NetworkACL | ||
Protocol: -1 | ||
`, | ||
}, | ||
|
||
GoodExample: []string{ | ||
`--- | ||
AWSTemplateFormatVersion: 2010-09-09 | ||
Description: Bad Example of ApiGateway | ||
Resources: | ||
NetworkACL: | ||
Type: AWS::EC2::NetworkAcl | ||
Properties: | ||
VpcId: "something" | ||
Rule: | ||
Type: AWS::EC2::NetworkAclEntry | ||
Properties: | ||
NetworkAclId: | ||
Ref: NetworkACL | ||
Protocol: 6 | ||
`, | ||
}, | ||
Base: vpc.CheckNoExcessivePortAccess, | ||
}) | ||
} |
17 changes: 17 additions & 0 deletions
17
internal/app/cfsec/rules/aws/vpc/no_excessive_port_access_rule_test.go
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,17 @@ | ||
package vpc | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/aquasecurity/cfsec/internal/app/cfsec/test" | ||
) | ||
|
||
func Test_VPC_ExcessivePortAccess_FailureExamples(t *testing.T) { | ||
expectedCode := "aws-vpc-no-excessive-port-access" | ||
test.RunFailureExamplesTest(t, expectedCode) | ||
} | ||
|
||
func Test_VPC_ExcessivePortAccess_SuccessExamples(t *testing.T) { | ||
expectedCode := "aws-vpc-no-excessive-port-access" | ||
test.RunPassingExamplesTest(t, expectedCode) | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
vendor/github.com/aquasecurity/defsec/rules/aws/vpc/no_excessive_port_access.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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