interface CfnWebACLProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.WAFv2.CfnWebACLProps |
Java | software.amazon.awscdk.services.wafv2.CfnWebACLProps |
Python | aws_cdk.aws_wafv2.CfnWebACLProps |
TypeScript | @aws-cdk/aws-wafv2 » CfnWebACLProps |
Properties for defining a CfnWebACL
.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as wafv2 from '@aws-cdk/aws-wafv2';
declare const all: any;
declare const allQueryArguments: any;
declare const count: any;
declare const method: any;
declare const none: any;
declare const queryString: any;
declare const singleHeader: any;
declare const singleQueryArgument: any;
declare const statementProperty_: wafv2.CfnWebACL.StatementProperty;
declare const uriPath: any;
const cfnWebACLProps: wafv2.CfnWebACLProps = {
defaultAction: {
allow: {
customRequestHandling: {
insertHeaders: [{
name: 'name',
value: 'value',
}],
},
},
block: {
customResponse: {
responseCode: 123,
// the properties below are optional
customResponseBodyKey: 'customResponseBodyKey',
responseHeaders: [{
name: 'name',
value: 'value',
}],
},
},
},
scope: 'scope',
visibilityConfig: {
cloudWatchMetricsEnabled: false,
metricName: 'metricName',
sampledRequestsEnabled: false,
},
// the properties below are optional
captchaConfig: {
immunityTimeProperty: {
immunityTime: 123,
},
},
challengeConfig: {
immunityTimeProperty: {
immunityTime: 123,
},
},
customResponseBodies: {
customResponseBodiesKey: {
content: 'content',
contentType: 'contentType',
},
},
description: 'description',
name: 'name',
rules: [{
name: 'name',
priority: 123,
statement: {
andStatement: {
statements: [statementProperty_],
},
byteMatchStatement: {
fieldToMatch: {
allQueryArguments: allQueryArguments,
body: {
oversizeHandling: 'oversizeHandling',
},
cookies: {
matchPattern: {
all: all,
excludedCookies: ['excludedCookies'],
includedCookies: ['includedCookies'],
},
matchScope: 'matchScope',
oversizeHandling: 'oversizeHandling',
},
headers: {
matchPattern: {
all: all,
excludedHeaders: ['excludedHeaders'],
includedHeaders: ['includedHeaders'],
},
matchScope: 'matchScope',
oversizeHandling: 'oversizeHandling',
},
jsonBody: {
matchPattern: {
all: all,
includedPaths: ['includedPaths'],
},
matchScope: 'matchScope',
// the properties below are optional
invalidFallbackBehavior: 'invalidFallbackBehavior',
oversizeHandling: 'oversizeHandling',
},
method: method,
queryString: queryString,
singleHeader: singleHeader,
singleQueryArgument: singleQueryArgument,
uriPath: uriPath,
},
positionalConstraint: 'positionalConstraint',
textTransformations: [{
priority: 123,
type: 'type',
}],
// the properties below are optional
searchString: 'searchString',
searchStringBase64: 'searchStringBase64',
},
geoMatchStatement: {
countryCodes: ['countryCodes'],
forwardedIpConfig: {
fallbackBehavior: 'fallbackBehavior',
headerName: 'headerName',
},
},
ipSetReferenceStatement: {
arn: 'arn',
// the properties below are optional
ipSetForwardedIpConfig: {
fallbackBehavior: 'fallbackBehavior',
headerName: 'headerName',
position: 'position',
},
},
labelMatchStatement: {
key: 'key',
scope: 'scope',
},
managedRuleGroupStatement: {
name: 'name',
vendorName: 'vendorName',
// the properties below are optional
excludedRules: [{
name: 'name',
}],
managedRuleGroupConfigs: [{
awsManagedRulesAtpRuleSet: {
loginPath: 'loginPath',
// the properties below are optional
requestInspection: {
passwordField: {
identifier: 'identifier',
},
payloadType: 'payloadType',
usernameField: {
identifier: 'identifier',
},
},
responseInspection: {
bodyContains: {
failureStrings: ['failureStrings'],
successStrings: ['successStrings'],
},
header: {
failureValues: ['failureValues'],
name: 'name',
successValues: ['successValues'],
},
json: {
failureValues: ['failureValues'],
identifier: 'identifier',
successValues: ['successValues'],
},
statusCode: {
failureCodes: [123],
successCodes: [123],
},
},
},
awsManagedRulesBotControlRuleSet: {
inspectionLevel: 'inspectionLevel',
},
loginPath: 'loginPath',
passwordField: {
identifier: 'identifier',
},
payloadType: 'payloadType',
usernameField: {
identifier: 'identifier',
},
}],
ruleActionOverrides: [{
actionToUse: {
allow: {
customRequestHandling: {
insertHeaders: [{
name: 'name',
value: 'value',
}],
},
},
block: {
customResponse: {
responseCode: 123,
// the properties below are optional
customResponseBodyKey: 'customResponseBodyKey',
responseHeaders: [{
name: 'name',
value: 'value',
}],
},
},
captcha: {
customRequestHandling: {
insertHeaders: [{
name: 'name',
value: 'value',
}],
},
},
challenge: {
customRequestHandling: {
insertHeaders: [{
name: 'name',
value: 'value',
}],
},
},
count: {
customRequestHandling: {
insertHeaders: [{
name: 'name',
value: 'value',
}],
},
},
},
name: 'name',
}],
scopeDownStatement: statementProperty_,
version: 'version',
},
notStatement: {
statement: statementProperty_,
},
orStatement: {
statements: [statementProperty_],
},
rateBasedStatement: {
aggregateKeyType: 'aggregateKeyType',
limit: 123,
// the properties below are optional
forwardedIpConfig: {
fallbackBehavior: 'fallbackBehavior',
headerName: 'headerName',
},
scopeDownStatement: statementProperty_,
},
regexMatchStatement: {
fieldToMatch: {
allQueryArguments: allQueryArguments,
body: {
oversizeHandling: 'oversizeHandling',
},
cookies: {
matchPattern: {
all: all,
excludedCookies: ['excludedCookies'],
includedCookies: ['includedCookies'],
},
matchScope: 'matchScope',
oversizeHandling: 'oversizeHandling',
},
headers: {
matchPattern: {
all: all,
excludedHeaders: ['excludedHeaders'],
includedHeaders: ['includedHeaders'],
},
matchScope: 'matchScope',
oversizeHandling: 'oversizeHandling',
},
jsonBody: {
matchPattern: {
all: all,
includedPaths: ['includedPaths'],
},
matchScope: 'matchScope',
// the properties below are optional
invalidFallbackBehavior: 'invalidFallbackBehavior',
oversizeHandling: 'oversizeHandling',
},
method: method,
queryString: queryString,
singleHeader: singleHeader,
singleQueryArgument: singleQueryArgument,
uriPath: uriPath,
},
regexString: 'regexString',
textTransformations: [{
priority: 123,
type: 'type',
}],
},
regexPatternSetReferenceStatement: {
arn: 'arn',
fieldToMatch: {
allQueryArguments: allQueryArguments,
body: {
oversizeHandling: 'oversizeHandling',
},
cookies: {
matchPattern: {
all: all,
excludedCookies: ['excludedCookies'],
includedCookies: ['includedCookies'],
},
matchScope: 'matchScope',
oversizeHandling: 'oversizeHandling',
},
headers: {
matchPattern: {
all: all,
excludedHeaders: ['excludedHeaders'],
includedHeaders: ['includedHeaders'],
},
matchScope: 'matchScope',
oversizeHandling: 'oversizeHandling',
},
jsonBody: {
matchPattern: {
all: all,
includedPaths: ['includedPaths'],
},
matchScope: 'matchScope',
// the properties below are optional
invalidFallbackBehavior: 'invalidFallbackBehavior',
oversizeHandling: 'oversizeHandling',
},
method: method,
queryString: queryString,
singleHeader: singleHeader,
singleQueryArgument: singleQueryArgument,
uriPath: uriPath,
},
textTransformations: [{
priority: 123,
type: 'type',
}],
},
ruleGroupReferenceStatement: {
arn: 'arn',
// the properties below are optional
excludedRules: [{
name: 'name',
}],
ruleActionOverrides: [{
actionToUse: {
allow: {
customRequestHandling: {
insertHeaders: [{
name: 'name',
value: 'value',
}],
},
},
block: {
customResponse: {
responseCode: 123,
// the properties below are optional
customResponseBodyKey: 'customResponseBodyKey',
responseHeaders: [{
name: 'name',
value: 'value',
}],
},
},
captcha: {
customRequestHandling: {
insertHeaders: [{
name: 'name',
value: 'value',
}],
},
},
challenge: {
customRequestHandling: {
insertHeaders: [{
name: 'name',
value: 'value',
}],
},
},
count: {
customRequestHandling: {
insertHeaders: [{
name: 'name',
value: 'value',
}],
},
},
},
name: 'name',
}],
},
sizeConstraintStatement: {
comparisonOperator: 'comparisonOperator',
fieldToMatch: {
allQueryArguments: allQueryArguments,
body: {
oversizeHandling: 'oversizeHandling',
},
cookies: {
matchPattern: {
all: all,
excludedCookies: ['excludedCookies'],
includedCookies: ['includedCookies'],
},
matchScope: 'matchScope',
oversizeHandling: 'oversizeHandling',
},
headers: {
matchPattern: {
all: all,
excludedHeaders: ['excludedHeaders'],
includedHeaders: ['includedHeaders'],
},
matchScope: 'matchScope',
oversizeHandling: 'oversizeHandling',
},
jsonBody: {
matchPattern: {
all: all,
includedPaths: ['includedPaths'],
},
matchScope: 'matchScope',
// the properties below are optional
invalidFallbackBehavior: 'invalidFallbackBehavior',
oversizeHandling: 'oversizeHandling',
},
method: method,
queryString: queryString,
singleHeader: singleHeader,
singleQueryArgument: singleQueryArgument,
uriPath: uriPath,
},
size: 123,
textTransformations: [{
priority: 123,
type: 'type',
}],
},
sqliMatchStatement: {
fieldToMatch: {
allQueryArguments: allQueryArguments,
body: {
oversizeHandling: 'oversizeHandling',
},
cookies: {
matchPattern: {
all: all,
excludedCookies: ['excludedCookies'],
includedCookies: ['includedCookies'],
},
matchScope: 'matchScope',
oversizeHandling: 'oversizeHandling',
},
headers: {
matchPattern: {
all: all,
excludedHeaders: ['excludedHeaders'],
includedHeaders: ['includedHeaders'],
},
matchScope: 'matchScope',
oversizeHandling: 'oversizeHandling',
},
jsonBody: {
matchPattern: {
all: all,
includedPaths: ['includedPaths'],
},
matchScope: 'matchScope',
// the properties below are optional
invalidFallbackBehavior: 'invalidFallbackBehavior',
oversizeHandling: 'oversizeHandling',
},
method: method,
queryString: queryString,
singleHeader: singleHeader,
singleQueryArgument: singleQueryArgument,
uriPath: uriPath,
},
textTransformations: [{
priority: 123,
type: 'type',
}],
// the properties below are optional
sensitivityLevel: 'sensitivityLevel',
},
xssMatchStatement: {
fieldToMatch: {
allQueryArguments: allQueryArguments,
body: {
oversizeHandling: 'oversizeHandling',
},
cookies: {
matchPattern: {
all: all,
excludedCookies: ['excludedCookies'],
includedCookies: ['includedCookies'],
},
matchScope: 'matchScope',
oversizeHandling: 'oversizeHandling',
},
headers: {
matchPattern: {
all: all,
excludedHeaders: ['excludedHeaders'],
includedHeaders: ['includedHeaders'],
},
matchScope: 'matchScope',
oversizeHandling: 'oversizeHandling',
},
jsonBody: {
matchPattern: {
all: all,
includedPaths: ['includedPaths'],
},
matchScope: 'matchScope',
// the properties below are optional
invalidFallbackBehavior: 'invalidFallbackBehavior',
oversizeHandling: 'oversizeHandling',
},
method: method,
queryString: queryString,
singleHeader: singleHeader,
singleQueryArgument: singleQueryArgument,
uriPath: uriPath,
},
textTransformations: [{
priority: 123,
type: 'type',
}],
},
},
visibilityConfig: {
cloudWatchMetricsEnabled: false,
metricName: 'metricName',
sampledRequestsEnabled: false,
},
// the properties below are optional
action: {
allow: {
customRequestHandling: {
insertHeaders: [{
name: 'name',
value: 'value',
}],
},
},
block: {
customResponse: {
responseCode: 123,
// the properties below are optional
customResponseBodyKey: 'customResponseBodyKey',
responseHeaders: [{
name: 'name',
value: 'value',
}],
},
},
captcha: {
customRequestHandling: {
insertHeaders: [{
name: 'name',
value: 'value',
}],
},
},
challenge: {
customRequestHandling: {
insertHeaders: [{
name: 'name',
value: 'value',
}],
},
},
count: {
customRequestHandling: {
insertHeaders: [{
name: 'name',
value: 'value',
}],
},
},
},
captchaConfig: {
immunityTimeProperty: {
immunityTime: 123,
},
},
challengeConfig: {
immunityTimeProperty: {
immunityTime: 123,
},
},
overrideAction: {
count: count,
none: none,
},
ruleLabels: [{
name: 'name',
}],
}],
tags: [{
key: 'key',
value: 'value',
}],
tokenDomains: ['tokenDomains'],
};
Properties
Name | Type | Description |
---|---|---|
default | IResolvable | Default | The action to perform if none of the Rules contained in the WebACL match. |
scope | string | Specifies whether this is for an Amazon CloudFront distribution or for a regional application. |
visibility | IResolvable | Visibility | Defines and enables Amazon CloudWatch metrics and web request sample collection. |
captcha | IResolvable | Captcha | Specifies how AWS WAF should handle CAPTCHA evaluations for rules that don't have their own CaptchaConfig settings. |
challenge | IResolvable | Challenge | Specifies how AWS WAF should handle challenge evaluations for rules that don't have their own ChallengeConfig settings. |
custom | IResolvable | { [string]: IResolvable | Custom } | A map of custom response keys and content bodies. |
description? | string | A description of the web ACL that helps with identification. |
name? | string | The name of the web ACL. |
rules? | IResolvable | IResolvable | Rule [] | The rule statements used to identify the web requests that you want to allow, block, or count. |
tags? | Cfn [] | Key:value pairs associated with an AWS resource. |
token | string[] | Specifies the domains that AWS WAF should accept in a web request token. |
defaultAction
Type:
IResolvable
|
Default
The action to perform if none of the Rules
contained in the WebACL
match.
scope
Type:
string
Specifies whether this is for an Amazon CloudFront distribution or for a regional application.
A regional application can be an Application Load Balancer (ALB), an Amazon API Gateway REST API, an AWS AppSync GraphQL API, an Amazon Cognito user pool, or an AWS App Runner service. Valid Values are CLOUDFRONT
and REGIONAL
.
For
CLOUDFRONT
, you must create your WAFv2 resources in the US East (N. Virginia) Region,us-east-1
.
For information about how to define the association of the web ACL with your resource, see WebACLAssociation
.
visibilityConfig
Type:
IResolvable
|
Visibility
Defines and enables Amazon CloudWatch metrics and web request sample collection.
captchaConfig?
Type:
IResolvable
|
Captcha
(optional)
Specifies how AWS WAF should handle CAPTCHA
evaluations for rules that don't have their own CaptchaConfig
settings.
If you don't specify this, AWS WAF uses its default settings for CaptchaConfig
.
challengeConfig?
Type:
IResolvable
|
Challenge
(optional)
Specifies how AWS WAF should handle challenge evaluations for rules that don't have their own ChallengeConfig
settings.
If you don't specify this, AWS WAF uses its default settings for ChallengeConfig
.
customResponseBodies?
Type:
IResolvable
| { [string]:
IResolvable
|
Custom
}
(optional)
A map of custom response keys and content bodies.
When you create a rule with a block action, you can send a custom response to the web request. You define these for the web ACL, and then use them in the rules and default actions that you define in the web ACL.
For information about customizing web requests and responses, see Customizing web requests and responses in AWS WAF in the AWS WAF Developer Guide .
For information about the limits on count and size for custom request and response settings, see AWS WAF quotas in the AWS WAF Developer Guide .
description?
Type:
string
(optional)
A description of the web ACL that helps with identification.
name?
Type:
string
(optional)
The name of the web ACL.
You cannot change the name of a web ACL after you create it.
rules?
Type:
IResolvable
|
IResolvable
|
Rule
[]
(optional)
The rule statements used to identify the web requests that you want to allow, block, or count.
Each rule includes one top-level statement that AWS WAF uses to identify matching web requests, and parameters that govern how AWS WAF handles them.
tags?
Type:
Cfn
[]
(optional)
Key:value pairs associated with an AWS resource.
The key:value pair can be anything you define. Typically, the tag key represents a category (such as "environment") and the tag value represents a specific value within that category (such as "test," "development," or "production"). You can add up to 50 tags to each AWS resource.
To modify tags on existing resources, use the AWS WAF APIs or command line interface. With AWS CloudFormation , you can only add tags to AWS WAF resources during resource creation.
tokenDomains?
Type:
string[]
(optional)
Specifies the domains that AWS WAF should accept in a web request token.
This enables the use of tokens across multiple protected websites. When AWS WAF provides a token, it uses the domain of the AWS resource that the web ACL is protecting. If you don't specify a list of token domains, AWS WAF accepts tokens only for the domain of the protected resource. With a token domain list, AWS WAF accepts the resource's host domain plus all domains in the token domain list, including their prefixed subdomains.