📖
@aws-cdk/aws-wafv2 の L2 の設計を考えてみる
考え中の公開ノート。
WebACL
CFn
CloudFormation はこんな感じ。
Statementはめんどいやつ。別パッケージ切るパターンか。
Design
WebACL
Rule
Statements
- Logical
- AndStatement
- NotStatement
- OrStatement
- Depends on other resources
- IPSetReferenceStatement
- RegexPatternSetReferenceStatement
- RuleGroupReferenceStatement
- Others
- ByteMatchStatement
- GeoMatchStatement
- LabelMatchStatement
- ManagedRuleGroupStatement
- RateBasedStatement
- SizeConstraintStatement
- SqliMatchStatement
- XssMatchStatement
Usage
new wafv2.WebACL(this, "WebACL", {
scope: wafv2.Scope.REGIONAL,
defaultAction: wafv2.DefaultAction.block(),
rules: [
{
name: "IPSetAllow",
action: wafv2.RuleAction.allow(),
statement: new wafv2Statement.IPSetReferenceStatement(ipSet),
},
{
name: "OWASP",
overrideAction: wafv2.OverrideAction.count(),
statement: new wafv2Statement.ManagedRuleGroupStatement({
vendorName: "AWS",
name: "AWSManagedRulesCommonRuleSet",
}),
},
],
});
Note:
priority
of therules
is automatically numbered according to the order of therules
.
Ifpriority
is set specifically, all rules must be setpriority
.
Note:
visibilityConfig
have default value.
IfWebACLProps.visibilityConfig
is set, Rules inherit it.
Roadmap
- implement
WebACL
with only required properties- It will not be able to use Rules
- implement
Rule
with oneStatement
(LabelMatchStatement) - implement other remaining properties
- implement Statements
Discussion