CfnRuleGroup

class aws_cdk.aws_wafv2.CfnRuleGroup(scope_, id, *, capacity, scope, visibility_config, available_labels=None, consumed_labels=None, custom_response_bodies=None, description=None, name=None, rules=None, tags=None)

Bases: CfnResource

This is the latest version of AWS WAF , named AWS WAF V2, released in November, 2019.

For information, including how to migrate your AWS WAF resources from the prior release, see the AWS WAF developer guide .

Use an RuleGroup to define a collection of rules for inspecting and controlling web requests. You use a rule group in an WebACL by providing its Amazon Resource Name (ARN) to the rule statement RuleGroupReferenceStatement , when you add rules to the web ACL.

When you create a rule group, you define an immutable capacity limit. If you update a rule group, you must stay within the capacity. This allows others to reuse the rule group with confidence in its capacity requirements.

see:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-rulegroup.html

cloudformationResource:

AWS::WAFv2::RuleGroup

exampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any
# allow: Any
# all_query_arguments: Any
# block: Any
# captcha: Any
# challenge: Any
# count: Any
# forwarded_ip: Any
# http_method: Any
# ip: Any
# method: Any
# query_string: Any
# single_header: Any
# single_query_argument: Any
# statement_property_: wafv2.CfnRuleGroup.StatementProperty
# uri_path: Any

cfn_rule_group = wafv2.CfnRuleGroup(self, "MyCfnRuleGroup",
    capacity=123,
    scope="scope",
    visibility_config=wafv2.CfnRuleGroup.VisibilityConfigProperty(
        cloud_watch_metrics_enabled=False,
        metric_name="metricName",
        sampled_requests_enabled=False
    ),

    # the properties below are optional
    available_labels=[wafv2.CfnRuleGroup.LabelSummaryProperty(
        name="name"
    )],
    consumed_labels=[wafv2.CfnRuleGroup.LabelSummaryProperty(
        name="name"
    )],
    custom_response_bodies={
        "custom_response_bodies_key": wafv2.CfnRuleGroup.CustomResponseBodyProperty(
            content="content",
            content_type="contentType"
        )
    },
    description="description",
    name="name",
    rules=[wafv2.CfnRuleGroup.RuleProperty(
        name="name",
        priority=123,
        statement=wafv2.CfnRuleGroup.StatementProperty(
            and_statement=wafv2.CfnRuleGroup.AndStatementProperty(
                statements=[statement_property_]
            ),
            byte_match_statement=wafv2.CfnRuleGroup.ByteMatchStatementProperty(
                field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                    all_query_arguments=all_query_arguments,
                    body=wafv2.CfnRuleGroup.BodyProperty(
                        oversize_handling="oversizeHandling"
                    ),
                    cookies=wafv2.CfnRuleGroup.CookiesProperty(
                        match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                            all=all,
                            excluded_cookies=["excludedCookies"],
                            included_cookies=["includedCookies"]
                        ),
                        match_scope="matchScope",
                        oversize_handling="oversizeHandling"
                    ),
                    headers=wafv2.CfnRuleGroup.HeadersProperty(
                        match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                            all=all,
                            excluded_headers=["excludedHeaders"],
                            included_headers=["includedHeaders"]
                        ),
                        match_scope="matchScope",
                        oversize_handling="oversizeHandling"
                    ),
                    ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                        fallback_behavior="fallbackBehavior"
                    ),
                    json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                        match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                            all=all,
                            included_paths=["includedPaths"]
                        ),
                        match_scope="matchScope",

                        # the properties below are optional
                        invalid_fallback_behavior="invalidFallbackBehavior",
                        oversize_handling="oversizeHandling"
                    ),
                    method=method,
                    query_string=query_string,
                    single_header=single_header,
                    single_query_argument=single_query_argument,
                    uri_path=uri_path
                ),
                positional_constraint="positionalConstraint",
                text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                    priority=123,
                    type="type"
                )],

                # the properties below are optional
                search_string="searchString",
                search_string_base64="searchStringBase64"
            ),
            geo_match_statement=wafv2.CfnRuleGroup.GeoMatchStatementProperty(
                country_codes=["countryCodes"],
                forwarded_ip_config=wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty(
                    fallback_behavior="fallbackBehavior",
                    header_name="headerName"
                )
            ),
            ip_set_reference_statement={
                "arn": "arn",

                # the properties below are optional
                "ip_set_forwarded_ip_config": {
                    "fallback_behavior": "fallbackBehavior",
                    "header_name": "headerName",
                    "position": "position"
                }
            },
            label_match_statement=wafv2.CfnRuleGroup.LabelMatchStatementProperty(
                key="key",
                scope="scope"
            ),
            not_statement=wafv2.CfnRuleGroup.NotStatementProperty(
                statement=statement_property_
            ),
            or_statement=wafv2.CfnRuleGroup.OrStatementProperty(
                statements=[statement_property_]
            ),
            rate_based_statement=wafv2.CfnRuleGroup.RateBasedStatementProperty(
                aggregate_key_type="aggregateKeyType",
                limit=123,

                # the properties below are optional
                custom_keys=[wafv2.CfnRuleGroup.RateBasedStatementCustomKeyProperty(
                    cookie=wafv2.CfnRuleGroup.RateLimitCookieProperty(
                        name="name",
                        text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                            priority=123,
                            type="type"
                        )]
                    ),
                    forwarded_ip=forwarded_ip,
                    header=wafv2.CfnRuleGroup.RateLimitHeaderProperty(
                        name="name",
                        text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                            priority=123,
                            type="type"
                        )]
                    ),
                    http_method=http_method,
                    ip=ip,
                    label_namespace=wafv2.CfnRuleGroup.RateLimitLabelNamespaceProperty(
                        namespace="namespace"
                    ),
                    query_argument=wafv2.CfnRuleGroup.RateLimitQueryArgumentProperty(
                        name="name",
                        text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                            priority=123,
                            type="type"
                        )]
                    ),
                    query_string=wafv2.CfnRuleGroup.RateLimitQueryStringProperty(
                        text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                            priority=123,
                            type="type"
                        )]
                    ),
                    uri_path=wafv2.CfnRuleGroup.RateLimitUriPathProperty(
                        text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                            priority=123,
                            type="type"
                        )]
                    )
                )],
                evaluation_window_sec=123,
                forwarded_ip_config=wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty(
                    fallback_behavior="fallbackBehavior",
                    header_name="headerName"
                ),
                scope_down_statement=statement_property_
            ),
            regex_match_statement=wafv2.CfnRuleGroup.RegexMatchStatementProperty(
                field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                    all_query_arguments=all_query_arguments,
                    body=wafv2.CfnRuleGroup.BodyProperty(
                        oversize_handling="oversizeHandling"
                    ),
                    cookies=wafv2.CfnRuleGroup.CookiesProperty(
                        match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                            all=all,
                            excluded_cookies=["excludedCookies"],
                            included_cookies=["includedCookies"]
                        ),
                        match_scope="matchScope",
                        oversize_handling="oversizeHandling"
                    ),
                    headers=wafv2.CfnRuleGroup.HeadersProperty(
                        match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                            all=all,
                            excluded_headers=["excludedHeaders"],
                            included_headers=["includedHeaders"]
                        ),
                        match_scope="matchScope",
                        oversize_handling="oversizeHandling"
                    ),
                    ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                        fallback_behavior="fallbackBehavior"
                    ),
                    json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                        match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                            all=all,
                            included_paths=["includedPaths"]
                        ),
                        match_scope="matchScope",

                        # the properties below are optional
                        invalid_fallback_behavior="invalidFallbackBehavior",
                        oversize_handling="oversizeHandling"
                    ),
                    method=method,
                    query_string=query_string,
                    single_header=single_header,
                    single_query_argument=single_query_argument,
                    uri_path=uri_path
                ),
                regex_string="regexString",
                text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                    priority=123,
                    type="type"
                )]
            ),
            regex_pattern_set_reference_statement=wafv2.CfnRuleGroup.RegexPatternSetReferenceStatementProperty(
                arn="arn",
                field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                    all_query_arguments=all_query_arguments,
                    body=wafv2.CfnRuleGroup.BodyProperty(
                        oversize_handling="oversizeHandling"
                    ),
                    cookies=wafv2.CfnRuleGroup.CookiesProperty(
                        match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                            all=all,
                            excluded_cookies=["excludedCookies"],
                            included_cookies=["includedCookies"]
                        ),
                        match_scope="matchScope",
                        oversize_handling="oversizeHandling"
                    ),
                    headers=wafv2.CfnRuleGroup.HeadersProperty(
                        match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                            all=all,
                            excluded_headers=["excludedHeaders"],
                            included_headers=["includedHeaders"]
                        ),
                        match_scope="matchScope",
                        oversize_handling="oversizeHandling"
                    ),
                    ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                        fallback_behavior="fallbackBehavior"
                    ),
                    json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                        match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                            all=all,
                            included_paths=["includedPaths"]
                        ),
                        match_scope="matchScope",

                        # the properties below are optional
                        invalid_fallback_behavior="invalidFallbackBehavior",
                        oversize_handling="oversizeHandling"
                    ),
                    method=method,
                    query_string=query_string,
                    single_header=single_header,
                    single_query_argument=single_query_argument,
                    uri_path=uri_path
                ),
                text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                    priority=123,
                    type="type"
                )]
            ),
            size_constraint_statement=wafv2.CfnRuleGroup.SizeConstraintStatementProperty(
                comparison_operator="comparisonOperator",
                field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                    all_query_arguments=all_query_arguments,
                    body=wafv2.CfnRuleGroup.BodyProperty(
                        oversize_handling="oversizeHandling"
                    ),
                    cookies=wafv2.CfnRuleGroup.CookiesProperty(
                        match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                            all=all,
                            excluded_cookies=["excludedCookies"],
                            included_cookies=["includedCookies"]
                        ),
                        match_scope="matchScope",
                        oversize_handling="oversizeHandling"
                    ),
                    headers=wafv2.CfnRuleGroup.HeadersProperty(
                        match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                            all=all,
                            excluded_headers=["excludedHeaders"],
                            included_headers=["includedHeaders"]
                        ),
                        match_scope="matchScope",
                        oversize_handling="oversizeHandling"
                    ),
                    ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                        fallback_behavior="fallbackBehavior"
                    ),
                    json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                        match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                            all=all,
                            included_paths=["includedPaths"]
                        ),
                        match_scope="matchScope",

                        # the properties below are optional
                        invalid_fallback_behavior="invalidFallbackBehavior",
                        oversize_handling="oversizeHandling"
                    ),
                    method=method,
                    query_string=query_string,
                    single_header=single_header,
                    single_query_argument=single_query_argument,
                    uri_path=uri_path
                ),
                size=123,
                text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                    priority=123,
                    type="type"
                )]
            ),
            sqli_match_statement=wafv2.CfnRuleGroup.SqliMatchStatementProperty(
                field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                    all_query_arguments=all_query_arguments,
                    body=wafv2.CfnRuleGroup.BodyProperty(
                        oversize_handling="oversizeHandling"
                    ),
                    cookies=wafv2.CfnRuleGroup.CookiesProperty(
                        match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                            all=all,
                            excluded_cookies=["excludedCookies"],
                            included_cookies=["includedCookies"]
                        ),
                        match_scope="matchScope",
                        oversize_handling="oversizeHandling"
                    ),
                    headers=wafv2.CfnRuleGroup.HeadersProperty(
                        match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                            all=all,
                            excluded_headers=["excludedHeaders"],
                            included_headers=["includedHeaders"]
                        ),
                        match_scope="matchScope",
                        oversize_handling="oversizeHandling"
                    ),
                    ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                        fallback_behavior="fallbackBehavior"
                    ),
                    json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                        match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                            all=all,
                            included_paths=["includedPaths"]
                        ),
                        match_scope="matchScope",

                        # the properties below are optional
                        invalid_fallback_behavior="invalidFallbackBehavior",
                        oversize_handling="oversizeHandling"
                    ),
                    method=method,
                    query_string=query_string,
                    single_header=single_header,
                    single_query_argument=single_query_argument,
                    uri_path=uri_path
                ),
                text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                    priority=123,
                    type="type"
                )],

                # the properties below are optional
                sensitivity_level="sensitivityLevel"
            ),
            xss_match_statement=wafv2.CfnRuleGroup.XssMatchStatementProperty(
                field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                    all_query_arguments=all_query_arguments,
                    body=wafv2.CfnRuleGroup.BodyProperty(
                        oversize_handling="oversizeHandling"
                    ),
                    cookies=wafv2.CfnRuleGroup.CookiesProperty(
                        match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                            all=all,
                            excluded_cookies=["excludedCookies"],
                            included_cookies=["includedCookies"]
                        ),
                        match_scope="matchScope",
                        oversize_handling="oversizeHandling"
                    ),
                    headers=wafv2.CfnRuleGroup.HeadersProperty(
                        match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                            all=all,
                            excluded_headers=["excludedHeaders"],
                            included_headers=["includedHeaders"]
                        ),
                        match_scope="matchScope",
                        oversize_handling="oversizeHandling"
                    ),
                    ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                        fallback_behavior="fallbackBehavior"
                    ),
                    json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                        match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                            all=all,
                            included_paths=["includedPaths"]
                        ),
                        match_scope="matchScope",

                        # the properties below are optional
                        invalid_fallback_behavior="invalidFallbackBehavior",
                        oversize_handling="oversizeHandling"
                    ),
                    method=method,
                    query_string=query_string,
                    single_header=single_header,
                    single_query_argument=single_query_argument,
                    uri_path=uri_path
                ),
                text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                    priority=123,
                    type="type"
                )]
            )
        ),
        visibility_config=wafv2.CfnRuleGroup.VisibilityConfigProperty(
            cloud_watch_metrics_enabled=False,
            metric_name="metricName",
            sampled_requests_enabled=False
        ),

        # the properties below are optional
        action=wafv2.CfnRuleGroup.RuleActionProperty(
            allow=allow,
            block=block,
            captcha=captcha,
            challenge=challenge,
            count=count
        ),
        captcha_config=wafv2.CfnRuleGroup.CaptchaConfigProperty(
            immunity_time_property=wafv2.CfnRuleGroup.ImmunityTimePropertyProperty(
                immunity_time=123
            )
        ),
        challenge_config=wafv2.CfnRuleGroup.ChallengeConfigProperty(
            immunity_time_property=wafv2.CfnRuleGroup.ImmunityTimePropertyProperty(
                immunity_time=123
            )
        ),
        rule_labels=[wafv2.CfnRuleGroup.LabelProperty(
            name="name"
        )]
    )],
    tags=[CfnTag(
        key="key",
        value="value"
    )]
)
Parameters:
  • scope (str) – Scope in which this resource is defined.

  • id (str) – Construct identifier for this resource (unique in its scope).

  • capacity (Union[int, float]) – The web ACL capacity units (WCUs) required for this rule group. When you create your own rule group, you define this, and you cannot change it after creation. When you add or modify the rules in a rule group, AWS WAF enforces this limit. AWS WAF uses WCUs to calculate and control the operating resources that are used to run your rules, rule groups, and web ACLs. AWS WAF calculates capacity differently for each rule type, to reflect the relative cost of each rule. Simple rules that cost little to run use fewer WCUs than more complex rules that use more processing power. Rule group capacity is fixed at creation, which helps users plan their web ACL WCU usage when they use a rule group. The WCU limit for web ACLs is 1,500.

  • scope – 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, an AWS App Runner service, or an AWS Verified Access instance. Valid Values are CLOUDFRONT and REGIONAL . .. epigraph:: For CLOUDFRONT , you must create your WAFv2 resources in the US East (N. Virginia) Region, us-east-1 .

  • visibility_config (Union[IResolvable, VisibilityConfigProperty, Dict[str, Any]]) – Defines and enables Amazon CloudWatch metrics and web request sample collection.

  • available_labels (Union[IResolvable, Sequence[Union[IResolvable, LabelSummaryProperty, Dict[str, Any]]], None]) – The labels that one or more rules in this rule group add to matching web requests. These labels are defined in the RuleLabels for a Rule .

  • consumed_labels (Union[IResolvable, Sequence[Union[IResolvable, LabelSummaryProperty, Dict[str, Any]]], None]) – The labels that one or more rules in this rule group match against in label match statements. These labels are defined in a LabelMatchStatement specification, in the Statement definition of a rule.

  • custom_response_bodies (Union[IResolvable, Mapping[str, Union[IResolvable, CustomResponseBodyProperty, Dict[str, Any]]], None]) – 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 rule group, and then use them in the rules that you define in the rule group. 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 (Optional[str]) – A description of the rule group that helps with identification.

  • name (Optional[str]) – The name of the rule group. You cannot change the name of a rule group after you create it.

  • rules (Union[IResolvable, Sequence[Union[IResolvable, RuleProperty, Dict[str, Any]]], None]) – 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 (Optional[Sequence[Union[CfnTag, Dict[str, Any]]]]) – 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. .. epigraph:: 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.

Methods

add_deletion_override(path)

Syntactic sugar for addOverride(path, undefined).

Parameters:

path (str) – The path of the value to delete.

Return type:

None

add_dependency(target)

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

Parameters:

target (CfnResource) –

Return type:

None

add_depends_on(target)

(deprecated) Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

Parameters:

target (CfnResource) –

Deprecated:

use addDependency

Stability:

deprecated

Return type:

None

add_metadata(key, value)

Add a value to the CloudFormation Resource Metadata.

Parameters:
  • key (str) –

  • value (Any) –

See:

Return type:

None

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

add_override(path, value)

Adds an override to the synthesized CloudFormation resource.

To add a property override, either use addPropertyOverride or prefix path with “Properties.” (i.e. Properties.TopicName).

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example:

cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"])
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")

would add the overrides Example:

"Properties": {
  "GlobalSecondaryIndexes": [
    {
      "Projection": {
        "NonKeyAttributes": [ "myattribute" ]
        ...
      }
      ...
    },
    {
      "ProjectionType": "INCLUDE"
      ...
    },
  ]
  ...
}

The value argument to addOverride will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.

Parameters:
  • path (str) –

    • The path of the property, you can use dot notation to override values in complex types. Any intermediate keys will be created as needed.

  • value (Any) –

    • The value. Could be primitive or complex.

Return type:

None

add_property_deletion_override(property_path)

Adds an override that deletes the value of a property from the resource definition.

Parameters:

property_path (str) – The path to the property.

Return type:

None

add_property_override(property_path, value)

Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).

Parameters:
  • property_path (str) – The path of the property.

  • value (Any) – The value.

Return type:

None

apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)

Sets the deletion policy of the resource based on the removal policy specified.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT). A list of resources that support this policy can be found in the following link:

Parameters:
  • policy (Optional[RemovalPolicy]) –

  • apply_to_update_replace_policy (Optional[bool]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: true

  • default (Optional[RemovalPolicy]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resource, please consult that specific resource’s documentation.

See:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options

Return type:

None

get_att(attribute_name, type_hint=None)

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.

Parameters:
  • attribute_name (str) – The name of the attribute.

  • type_hint (Optional[ResolutionTypeHint]) –

Return type:

Reference

get_metadata(key)

Retrieve a value value from the CloudFormation Resource Metadata.

Parameters:

key (str) –

See:

Return type:

Any

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

inspect(inspector)

Examines the CloudFormation resource and discloses attributes.

Parameters:

inspector (TreeInspector) – tree inspector to collect and process attributes.

Return type:

None

obtain_dependencies()

Retrieves an array of resources this resource depends on.

This assembles dependencies on resources across stacks (including nested stacks) automatically.

Return type:

List[Union[Stack, CfnResource]]

obtain_resource_dependencies()

Get a shallow copy of dependencies between this resource and other resources in the same stack.

Return type:

List[CfnResource]

override_logical_id(new_logical_id)

Overrides the auto-generated logical ID with a specific ID.

Parameters:

new_logical_id (str) – The new logical ID to use for this stack element.

Return type:

None

remove_dependency(target)

Indicates that this resource no longer depends on another resource.

This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.

Parameters:

target (CfnResource) –

Return type:

None

replace_dependency(target, new_target)

Replaces one dependency with another.

Parameters:
Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Returns:

a string representation of this resource

Attributes

CFN_RESOURCE_TYPE_NAME = 'AWS::WAFv2::RuleGroup'
attr_arn

The Amazon Resource Name (ARN) of the rule group.

CloudformationAttribute:

Arn

attr_id

The ID of the rule group.

CloudformationAttribute:

Id

attr_label_namespace

The label namespace prefix for this rule group.

All labels added by rules in this rule group have this prefix.

The syntax for the label namespace prefix for a rule group is the following: awswaf:<account ID>:rule group:<rule group name>:

When a rule with a label matches a web request, AWS WAF adds the fully qualified label to the request. A fully qualified label is made up of the label namespace from the rule group or web ACL where the rule is defined and the label from the rule, separated by a colon.

CloudformationAttribute:

LabelNamespace

available_labels

The labels that one or more rules in this rule group add to matching web requests.

capacity

The web ACL capacity units (WCUs) required for this rule group.

cfn_options

Options for this resource, such as condition, update policy etc.

cfn_resource_type

AWS resource type.

consumed_labels

The labels that one or more rules in this rule group match against in label match statements.

creation_stack

return:

the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.

custom_response_bodies

A map of custom response keys and content bodies.

description

A description of the rule group that helps with identification.

logical_id

The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Returns:

the logical ID as a stringified token. This value will only get resolved during synthesis.

name

The name of the rule group.

node

The tree node.

ref

Return a string that will be resolved to a CloudFormation { Ref } for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).

rules

The rule statements used to identify the web requests that you want to allow, block, or count.

scope

Specifies whether this is for an Amazon CloudFront distribution or for a regional application.

stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

tags

Tag Manager which manages the tags for this resource.

tags_raw

value pairs associated with an AWS resource.

Type:

Key

visibility_config

Defines and enables Amazon CloudWatch metrics and web request sample collection.

Static Methods

classmethod is_cfn_element(x)

Returns true if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.

Parameters:

x (Any) –

Return type:

bool

Returns:

The construct as a stack element or undefined if it is not a stack element.

classmethod is_cfn_resource(x)

Check whether the given object is a CfnResource.

Parameters:

x (Any) –

Return type:

bool

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.

AllowProperty

class CfnRuleGroup.AllowProperty(*, custom_request_handling=None)

Bases: object

Allow traffic towards application.

Parameters:

custom_request_handling (Union[IResolvable, CustomRequestHandlingProperty, Dict[str, Any], None]) – Custom request handling.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-allow.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

allow_property = wafv2.CfnRuleGroup.AllowProperty(
    custom_request_handling=wafv2.CfnRuleGroup.CustomRequestHandlingProperty(
        insert_headers=[wafv2.CfnRuleGroup.CustomHTTPHeaderProperty(
            name="name",
            value="value"
        )]
    )
)

Attributes

custom_request_handling

Custom request handling.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-allow.html#cfn-wafv2-rulegroup-allow-customrequesthandling

AndStatementProperty

class CfnRuleGroup.AndStatementProperty(*, statements)

Bases: object

A logical rule statement used to combine other rule statements with AND logic.

You provide more than one Statement within the AndStatement .

Parameters:

statements (Union[IResolvable, Sequence[Union[IResolvable, StatementProperty, Dict[str, Any]]]]) – The statements to combine with AND logic. You can use any statements that can be nested.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-andstatement.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any
# all_query_arguments: Any
# and_statement_property_: wafv2.CfnRuleGroup.AndStatementProperty
# forwarded_ip: Any
# http_method: Any
# ip: Any
# method: Any
# query_string: Any
# single_header: Any
# single_query_argument: Any
# statement_property_: wafv2.CfnRuleGroup.StatementProperty
# uri_path: Any

and_statement_property = wafv2.CfnRuleGroup.AndStatementProperty(
    statements=[wafv2.CfnRuleGroup.StatementProperty(
        and_statement=and_statement_property_,
        byte_match_statement=wafv2.CfnRuleGroup.ByteMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            positional_constraint="positionalConstraint",
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )],

            # the properties below are optional
            search_string="searchString",
            search_string_base64="searchStringBase64"
        ),
        geo_match_statement=wafv2.CfnRuleGroup.GeoMatchStatementProperty(
            country_codes=["countryCodes"],
            forwarded_ip_config=wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty(
                fallback_behavior="fallbackBehavior",
                header_name="headerName"
            )
        ),
        ip_set_reference_statement={
            "arn": "arn",

            # the properties below are optional
            "ip_set_forwarded_ip_config": {
                "fallback_behavior": "fallbackBehavior",
                "header_name": "headerName",
                "position": "position"
            }
        },
        label_match_statement=wafv2.CfnRuleGroup.LabelMatchStatementProperty(
            key="key",
            scope="scope"
        ),
        not_statement=wafv2.CfnRuleGroup.NotStatementProperty(
            statement=statement_property_
        ),
        or_statement=wafv2.CfnRuleGroup.OrStatementProperty(
            statements=[statement_property_]
        ),
        rate_based_statement=wafv2.CfnRuleGroup.RateBasedStatementProperty(
            aggregate_key_type="aggregateKeyType",
            limit=123,

            # the properties below are optional
            custom_keys=[wafv2.CfnRuleGroup.RateBasedStatementCustomKeyProperty(
                cookie=wafv2.CfnRuleGroup.RateLimitCookieProperty(
                    name="name",
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                ),
                forwarded_ip=forwarded_ip,
                header=wafv2.CfnRuleGroup.RateLimitHeaderProperty(
                    name="name",
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                ),
                http_method=http_method,
                ip=ip,
                label_namespace=wafv2.CfnRuleGroup.RateLimitLabelNamespaceProperty(
                    namespace="namespace"
                ),
                query_argument=wafv2.CfnRuleGroup.RateLimitQueryArgumentProperty(
                    name="name",
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                ),
                query_string=wafv2.CfnRuleGroup.RateLimitQueryStringProperty(
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                ),
                uri_path=wafv2.CfnRuleGroup.RateLimitUriPathProperty(
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                )
            )],
            evaluation_window_sec=123,
            forwarded_ip_config=wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty(
                fallback_behavior="fallbackBehavior",
                header_name="headerName"
            ),
            scope_down_statement=statement_property_
        ),
        regex_match_statement=wafv2.CfnRuleGroup.RegexMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            regex_string="regexString",
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        regex_pattern_set_reference_statement=wafv2.CfnRuleGroup.RegexPatternSetReferenceStatementProperty(
            arn="arn",
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        size_constraint_statement=wafv2.CfnRuleGroup.SizeConstraintStatementProperty(
            comparison_operator="comparisonOperator",
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            size=123,
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        sqli_match_statement=wafv2.CfnRuleGroup.SqliMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )],

            # the properties below are optional
            sensitivity_level="sensitivityLevel"
        ),
        xss_match_statement=wafv2.CfnRuleGroup.XssMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        )
    )]
)

Attributes

statements

The statements to combine with AND logic.

You can use any statements that can be nested.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-andstatement.html#cfn-wafv2-rulegroup-andstatement-statements

BlockProperty

class CfnRuleGroup.BlockProperty(*, custom_response=None)

Bases: object

Block traffic towards application.

Parameters:

custom_response (Union[IResolvable, CustomResponseProperty, Dict[str, Any], None]) – Custom response.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-block.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

block_property = wafv2.CfnRuleGroup.BlockProperty(
    custom_response=wafv2.CfnRuleGroup.CustomResponseProperty(
        response_code=123,

        # the properties below are optional
        custom_response_body_key="customResponseBodyKey",
        response_headers=[wafv2.CfnRuleGroup.CustomHTTPHeaderProperty(
            name="name",
            value="value"
        )]
    )
)

Attributes

custom_response

Custom response.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-block.html#cfn-wafv2-rulegroup-block-customresponse

BodyProperty

class CfnRuleGroup.BodyProperty(*, oversize_handling=None)

Bases: object

Inspect the body of the web request. The body immediately follows the request headers.

This is used to indicate the web request component to inspect, in the FieldToMatch specification.

Parameters:

oversize_handling (Optional[str]) – What AWS WAF should do if the body is larger than AWS WAF can inspect. AWS WAF does not support inspecting the entire contents of the web request body if the body exceeds the limit for the resource type. When a web request body is larger than the limit, the underlying host service only forwards the contents that are within the limit to AWS WAF for inspection. - For Application Load Balancer and AWS AppSync , the limit is fixed at 8 KB (8,192 bytes). - For CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access, the default limit is 16 KB (16,384 bytes), and you can increase the limit for each resource type in the web ACL AssociationConfig , for additional processing fees. The options for oversize handling are the following: - CONTINUE - Inspect the available body contents normally, according to the rule inspection criteria. - MATCH - Treat the web request as matching the rule statement. AWS WAF applies the rule action to the request. - NO_MATCH - Treat the web request as not matching the rule statement. You can combine the MATCH or NO_MATCH settings for oversize handling with your rule and web ACL action settings, so that you block any request whose body is over the limit. Default: CONTINUE

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-body.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

body_property = wafv2.CfnRuleGroup.BodyProperty(
    oversize_handling="oversizeHandling"
)

Attributes

oversize_handling

What AWS WAF should do if the body is larger than AWS WAF can inspect.

AWS WAF does not support inspecting the entire contents of the web request body if the body exceeds the limit for the resource type. When a web request body is larger than the limit, the underlying host service only forwards the contents that are within the limit to AWS WAF for inspection.

  • For Application Load Balancer and AWS AppSync , the limit is fixed at 8 KB (8,192 bytes).

  • For CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access, the default limit is 16 KB (16,384 bytes), and you can increase the limit for each resource type in the web ACL AssociationConfig , for additional processing fees.

The options for oversize handling are the following:

  • CONTINUE - Inspect the available body contents normally, according to the rule inspection criteria.

  • MATCH - Treat the web request as matching the rule statement. AWS WAF applies the rule action to the request.

  • NO_MATCH - Treat the web request as not matching the rule statement.

You can combine the MATCH or NO_MATCH settings for oversize handling with your rule and web ACL action settings, so that you block any request whose body is over the limit.

Default: CONTINUE

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-body.html#cfn-wafv2-rulegroup-body-oversizehandling

ByteMatchStatementProperty

class CfnRuleGroup.ByteMatchStatementProperty(*, field_to_match, positional_constraint, text_transformations, search_string=None, search_string_base64=None)

Bases: object

A rule statement that defines a string match search for AWS WAF to apply to web requests.

The byte match statement provides the bytes to search for, the location in requests that you want AWS WAF to search, and other settings. The bytes to search for are typically a string that corresponds with ASCII characters. In the AWS WAF console and the developer guide, this is called a string match statement.

Parameters:
  • field_to_match (Union[IResolvable, FieldToMatchProperty, Dict[str, Any]]) – The part of the web request that you want AWS WAF to inspect.

  • positional_constraint (str) – The area within the portion of the web request that you want AWS WAF to search for SearchString . Valid values include the following: CONTAINS The specified part of the web request must include the value of SearchString , but the location doesn’t matter. CONTAINS_WORD The specified part of the web request must include the value of SearchString , and SearchString must contain only alphanumeric characters or underscore (A-Z, a-z, 0-9, or _). In addition, SearchString must be a word, which means that both of the following are true: - SearchString is at the beginning of the specified part of the web request or is preceded by a character other than an alphanumeric character or underscore (_). Examples include the value of a header and ;BadBot . - SearchString is at the end of the specified part of the web request or is followed by a character other than an alphanumeric character or underscore (_), for example, BadBot; and -BadBot; . EXACTLY The value of the specified part of the web request must exactly match the value of SearchString . STARTS_WITH The value of SearchString must appear at the beginning of the specified part of the web request. ENDS_WITH The value of SearchString must appear at the end of the specified part of the web request.

  • text_transformations (Union[IResolvable, Sequence[Union[IResolvable, TextTransformationProperty, Dict[str, Any]]]]) – Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection. If you specify one or more transformations in a rule statement, AWS WAF performs all transformations on the content of the request component identified by FieldToMatch , starting from the lowest priority setting, before inspecting the content for a match.

  • search_string (Optional[str]) – A string value that you want AWS WAF to search for. AWS WAF searches only in the part of web requests that you designate for inspection in FieldToMatch . The maximum length of the value is 200 bytes. For alphabetic characters A-Z and a-z, the value is case sensitive. Don’t encode this string. Provide the value that you want AWS WAF to search for. AWS CloudFormation automatically base64 encodes the value for you. For example, suppose the value of Type is HEADER and the value of Data is User-Agent . If you want to search the User-Agent header for the value BadBot , you provide the string BadBot in the value of SearchString . You must specify either SearchString or SearchStringBase64 in a ByteMatchStatement .

  • search_string_base64 (Optional[str]) – String to search for in a web request component, base64-encoded. If you don’t want to encode the string, specify the unencoded value in SearchString instead. You must specify either SearchString or SearchStringBase64 in a ByteMatchStatement .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-bytematchstatement.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any
# all_query_arguments: Any
# method: Any
# query_string: Any
# single_header: Any
# single_query_argument: Any
# uri_path: Any

byte_match_statement_property = wafv2.CfnRuleGroup.ByteMatchStatementProperty(
    field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
        all_query_arguments=all_query_arguments,
        body=wafv2.CfnRuleGroup.BodyProperty(
            oversize_handling="oversizeHandling"
        ),
        cookies=wafv2.CfnRuleGroup.CookiesProperty(
            match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                all=all,
                excluded_cookies=["excludedCookies"],
                included_cookies=["includedCookies"]
            ),
            match_scope="matchScope",
            oversize_handling="oversizeHandling"
        ),
        headers=wafv2.CfnRuleGroup.HeadersProperty(
            match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                all=all,
                excluded_headers=["excludedHeaders"],
                included_headers=["includedHeaders"]
            ),
            match_scope="matchScope",
            oversize_handling="oversizeHandling"
        ),
        ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
            fallback_behavior="fallbackBehavior"
        ),
        json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
            match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                all=all,
                included_paths=["includedPaths"]
            ),
            match_scope="matchScope",

            # the properties below are optional
            invalid_fallback_behavior="invalidFallbackBehavior",
            oversize_handling="oversizeHandling"
        ),
        method=method,
        query_string=query_string,
        single_header=single_header,
        single_query_argument=single_query_argument,
        uri_path=uri_path
    ),
    positional_constraint="positionalConstraint",
    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
        priority=123,
        type="type"
    )],

    # the properties below are optional
    search_string="searchString",
    search_string_base64="searchStringBase64"
)

Attributes

field_to_match

The part of the web request that you want AWS WAF to inspect.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-bytematchstatement.html#cfn-wafv2-rulegroup-bytematchstatement-fieldtomatch

positional_constraint

The area within the portion of the web request that you want AWS WAF to search for SearchString .

Valid values include the following:

CONTAINS

The specified part of the web request must include the value of SearchString , but the location doesn’t matter.

CONTAINS_WORD

The specified part of the web request must include the value of SearchString , and SearchString must contain only alphanumeric characters or underscore (A-Z, a-z, 0-9, or _). In addition, SearchString must be a word, which means that both of the following are true:

  • SearchString is at the beginning of the specified part of the web request or is preceded by a character other than an alphanumeric character or underscore (_). Examples include the value of a header and ;BadBot .

  • SearchString is at the end of the specified part of the web request or is followed by a character other than an alphanumeric character or underscore (_), for example, BadBot; and -BadBot; .

EXACTLY

The value of the specified part of the web request must exactly match the value of SearchString .

STARTS_WITH

The value of SearchString must appear at the beginning of the specified part of the web request.

ENDS_WITH

The value of SearchString must appear at the end of the specified part of the web request.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-bytematchstatement.html#cfn-wafv2-rulegroup-bytematchstatement-positionalconstraint

search_string

A string value that you want AWS WAF to search for.

AWS WAF searches only in the part of web requests that you designate for inspection in FieldToMatch . The maximum length of the value is 200 bytes. For alphabetic characters A-Z and a-z, the value is case sensitive.

Don’t encode this string. Provide the value that you want AWS WAF to search for. AWS CloudFormation automatically base64 encodes the value for you.

For example, suppose the value of Type is HEADER and the value of Data is User-Agent . If you want to search the User-Agent header for the value BadBot , you provide the string BadBot in the value of SearchString .

You must specify either SearchString or SearchStringBase64 in a ByteMatchStatement .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-bytematchstatement.html#cfn-wafv2-rulegroup-bytematchstatement-searchstring

search_string_base64

String to search for in a web request component, base64-encoded.

If you don’t want to encode the string, specify the unencoded value in SearchString instead.

You must specify either SearchString or SearchStringBase64 in a ByteMatchStatement .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-bytematchstatement.html#cfn-wafv2-rulegroup-bytematchstatement-searchstringbase64

text_transformations

Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection.

If you specify one or more transformations in a rule statement, AWS WAF performs all transformations on the content of the request component identified by FieldToMatch , starting from the lowest priority setting, before inspecting the content for a match.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-bytematchstatement.html#cfn-wafv2-rulegroup-bytematchstatement-texttransformations

CaptchaConfigProperty

class CfnRuleGroup.CaptchaConfigProperty(*, immunity_time_property=None)

Bases: object

Specifies how AWS WAF should handle CAPTCHA evaluations.

This is available at the web ACL level and in each rule.

Parameters:

immunity_time_property (Union[IResolvable, ImmunityTimePropertyProperty, Dict[str, Any], None]) – Determines how long a CAPTCHA timestamp in the token remains valid after the client successfully solves a CAPTCHA puzzle.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-captchaconfig.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

captcha_config_property = wafv2.CfnRuleGroup.CaptchaConfigProperty(
    immunity_time_property=wafv2.CfnRuleGroup.ImmunityTimePropertyProperty(
        immunity_time=123
    )
)

Attributes

immunity_time_property

Determines how long a CAPTCHA timestamp in the token remains valid after the client successfully solves a CAPTCHA puzzle.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-captchaconfig.html#cfn-wafv2-rulegroup-captchaconfig-immunitytimeproperty

CaptchaProperty

class CfnRuleGroup.CaptchaProperty(*, custom_request_handling=None)

Bases: object

Checks valid token exists with request.

Parameters:

custom_request_handling (Union[IResolvable, CustomRequestHandlingProperty, Dict[str, Any], None]) – Custom request handling.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-captcha.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

captcha_property = wafv2.CfnRuleGroup.CaptchaProperty(
    custom_request_handling=wafv2.CfnRuleGroup.CustomRequestHandlingProperty(
        insert_headers=[wafv2.CfnRuleGroup.CustomHTTPHeaderProperty(
            name="name",
            value="value"
        )]
    )
)

Attributes

custom_request_handling

Custom request handling.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-captcha.html#cfn-wafv2-rulegroup-captcha-customrequesthandling

ChallengeConfigProperty

class CfnRuleGroup.ChallengeConfigProperty(*, immunity_time_property=None)

Bases: object

Specifies how AWS WAF should handle Challenge evaluations.

This is available at the web ACL level and in each rule.

Parameters:

immunity_time_property (Union[IResolvable, ImmunityTimePropertyProperty, Dict[str, Any], None]) – Determines how long a challenge timestamp in the token remains valid after the client successfully responds to a challenge.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-challengeconfig.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

challenge_config_property = wafv2.CfnRuleGroup.ChallengeConfigProperty(
    immunity_time_property=wafv2.CfnRuleGroup.ImmunityTimePropertyProperty(
        immunity_time=123
    )
)

Attributes

immunity_time_property

Determines how long a challenge timestamp in the token remains valid after the client successfully responds to a challenge.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-challengeconfig.html#cfn-wafv2-rulegroup-challengeconfig-immunitytimeproperty

ChallengeProperty

class CfnRuleGroup.ChallengeProperty(*, custom_request_handling=None)

Bases: object

Checks that the request has a valid token with an unexpired challenge timestamp and, if not, returns a browser challenge to the client.

Parameters:

custom_request_handling (Union[IResolvable, CustomRequestHandlingProperty, Dict[str, Any], None]) – Custom request handling.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-challenge.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

challenge_property = wafv2.CfnRuleGroup.ChallengeProperty(
    custom_request_handling=wafv2.CfnRuleGroup.CustomRequestHandlingProperty(
        insert_headers=[wafv2.CfnRuleGroup.CustomHTTPHeaderProperty(
            name="name",
            value="value"
        )]
    )
)

Attributes

custom_request_handling

Custom request handling.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-challenge.html#cfn-wafv2-rulegroup-challenge-customrequesthandling

CookieMatchPatternProperty

class CfnRuleGroup.CookieMatchPatternProperty(*, all=None, excluded_cookies=None, included_cookies=None)

Bases: object

The filter to use to identify the subset of cookies to inspect in a web request.

You must specify exactly one setting: either All , IncludedCookies , or ExcludedCookies .

Example JSON: "MatchPattern": { "IncludedCookies": [ "session-id-time", "session-id" ] }

Parameters:
  • all (Optional[Any]) – Inspect all cookies.

  • excluded_cookies (Optional[Sequence[str]]) – Inspect only the cookies whose keys don’t match any of the strings specified here.

  • included_cookies (Optional[Sequence[str]]) – Inspect only the cookies that have a key that matches one of the strings specified here.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-cookiematchpattern.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any

cookie_match_pattern_property = wafv2.CfnRuleGroup.CookieMatchPatternProperty(
    all=all,
    excluded_cookies=["excludedCookies"],
    included_cookies=["includedCookies"]
)

Attributes

all

Inspect all cookies.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-cookiematchpattern.html#cfn-wafv2-rulegroup-cookiematchpattern-all

excluded_cookies

Inspect only the cookies whose keys don’t match any of the strings specified here.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-cookiematchpattern.html#cfn-wafv2-rulegroup-cookiematchpattern-excludedcookies

included_cookies

Inspect only the cookies that have a key that matches one of the strings specified here.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-cookiematchpattern.html#cfn-wafv2-rulegroup-cookiematchpattern-includedcookies

CookiesProperty

class CfnRuleGroup.CookiesProperty(*, match_pattern, match_scope, oversize_handling)

Bases: object

Inspect the cookies in the web request.

You can specify the parts of the cookies to inspect and you can narrow the set of cookies to inspect by including or excluding specific keys.

This is used to indicate the web request component to inspect, in the FieldToMatch specification.

Example JSON: "Cookies": { "MatchPattern": { "All": {} }, "MatchScope": "KEY", "OversizeHandling": "MATCH" }

Parameters:
  • match_pattern (Union[IResolvable, CookieMatchPatternProperty, Dict[str, Any]]) – The filter to use to identify the subset of cookies to inspect in a web request. You must specify exactly one setting: either All , IncludedCookies , or ExcludedCookies . Example JSON: "MatchPattern": { "IncludedCookies": [ "session-id-time", "session-id" ] }

  • match_scope (str) – The parts of the cookies to inspect with the rule inspection criteria. If you specify ALL , AWS WAF inspects both keys and values. All does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logical AND statement to combine two match rules, one that inspects the keys and another that inspects the values.

  • oversize_handling (str) – What AWS WAF should do if the cookies of the request are more numerous or larger than AWS WAF can inspect. AWS WAF does not support inspecting the entire contents of request cookies when they exceed 8 KB (8192 bytes) or 200 total cookies. The underlying host service forwards a maximum of 200 cookies and at most 8 KB of cookie contents to AWS WAF . The options for oversize handling are the following: - CONTINUE - Inspect the available cookies normally, according to the rule inspection criteria. - MATCH - Treat the web request as matching the rule statement. AWS WAF applies the rule action to the request. - NO_MATCH - Treat the web request as not matching the rule statement.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-cookies.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any

cookies_property = wafv2.CfnRuleGroup.CookiesProperty(
    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
        all=all,
        excluded_cookies=["excludedCookies"],
        included_cookies=["includedCookies"]
    ),
    match_scope="matchScope",
    oversize_handling="oversizeHandling"
)

Attributes

match_pattern

The filter to use to identify the subset of cookies to inspect in a web request.

You must specify exactly one setting: either All , IncludedCookies , or ExcludedCookies .

Example JSON: "MatchPattern": { "IncludedCookies": [ "session-id-time", "session-id" ] }

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-cookies.html#cfn-wafv2-rulegroup-cookies-matchpattern

match_scope

The parts of the cookies to inspect with the rule inspection criteria.

If you specify ALL , AWS WAF inspects both keys and values.

All does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logical AND statement to combine two match rules, one that inspects the keys and another that inspects the values.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-cookies.html#cfn-wafv2-rulegroup-cookies-matchscope

oversize_handling

What AWS WAF should do if the cookies of the request are more numerous or larger than AWS WAF can inspect.

AWS WAF does not support inspecting the entire contents of request cookies when they exceed 8 KB (8192 bytes) or 200 total cookies. The underlying host service forwards a maximum of 200 cookies and at most 8 KB of cookie contents to AWS WAF .

The options for oversize handling are the following:

  • CONTINUE - Inspect the available cookies normally, according to the rule inspection criteria.

  • MATCH - Treat the web request as matching the rule statement. AWS WAF applies the rule action to the request.

  • NO_MATCH - Treat the web request as not matching the rule statement.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-cookies.html#cfn-wafv2-rulegroup-cookies-oversizehandling

CountProperty

class CfnRuleGroup.CountProperty(*, custom_request_handling=None)

Bases: object

Count traffic towards application.

Parameters:

custom_request_handling (Union[IResolvable, CustomRequestHandlingProperty, Dict[str, Any], None]) – Custom request handling.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-count.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

count_property = wafv2.CfnRuleGroup.CountProperty(
    custom_request_handling=wafv2.CfnRuleGroup.CustomRequestHandlingProperty(
        insert_headers=[wafv2.CfnRuleGroup.CustomHTTPHeaderProperty(
            name="name",
            value="value"
        )]
    )
)

Attributes

custom_request_handling

Custom request handling.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-count.html#cfn-wafv2-rulegroup-count-customrequesthandling

CustomHTTPHeaderProperty

class CfnRuleGroup.CustomHTTPHeaderProperty(*, name, value)

Bases: object

A custom header for custom request and response handling.

This is used in CustomResponse and CustomRequestHandling

Parameters:
  • name (str) – The name of the custom header. For custom request header insertion, when AWS WAF inserts the header into the request, it prefixes this name x-amzn-waf- , to avoid confusion with the headers that are already in the request. For example, for the header name sample , AWS WAF inserts the header x-amzn-waf-sample .

  • value (str) – The value of the custom header.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-customhttpheader.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

custom_hTTPHeader_property = wafv2.CfnRuleGroup.CustomHTTPHeaderProperty(
    name="name",
    value="value"
)

Attributes

name

The name of the custom header.

For custom request header insertion, when AWS WAF inserts the header into the request, it prefixes this name x-amzn-waf- , to avoid confusion with the headers that are already in the request. For example, for the header name sample , AWS WAF inserts the header x-amzn-waf-sample .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-customhttpheader.html#cfn-wafv2-rulegroup-customhttpheader-name

value

The value of the custom header.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-customhttpheader.html#cfn-wafv2-rulegroup-customhttpheader-value

CustomRequestHandlingProperty

class CfnRuleGroup.CustomRequestHandlingProperty(*, insert_headers)

Bases: object

Custom request handling behavior that inserts custom headers into a web request.

You can add custom request handling for AWS WAF to use when the rule action doesn’t block the request. For example, CaptchaAction for requests with valid t okens, and AllowAction .

For information about customizing web requests and responses, see Customizing web requests and responses in AWS WAF in the AWS WAF Developer Guide .

Parameters:

insert_headers (Union[IResolvable, Sequence[Union[IResolvable, CustomHTTPHeaderProperty, Dict[str, Any]]]]) –

The HTTP headers to insert into the request. Duplicate header names are not allowed. 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 .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-customrequesthandling.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

custom_request_handling_property = wafv2.CfnRuleGroup.CustomRequestHandlingProperty(
    insert_headers=[wafv2.CfnRuleGroup.CustomHTTPHeaderProperty(
        name="name",
        value="value"
    )]
)

Attributes

insert_headers

The HTTP headers to insert into the request. Duplicate header names are not allowed.

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 .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-customrequesthandling.html#cfn-wafv2-rulegroup-customrequesthandling-insertheaders

CustomResponseBodyProperty

class CfnRuleGroup.CustomResponseBodyProperty(*, content, content_type)

Bases: object

The response body to use in a custom response to a web request.

This is referenced by key from CustomResponse CustomResponseBodyKey .

Parameters:
  • content (str) –

    The payload of the custom response. You can use JSON escape strings in JSON content. To do this, you must specify JSON content in the ContentType setting. 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 .

  • content_type (str) – The type of content in the payload that you are defining in the Content string.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-customresponsebody.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

custom_response_body_property = wafv2.CfnRuleGroup.CustomResponseBodyProperty(
    content="content",
    content_type="contentType"
)

Attributes

content

The payload of the custom response.

You can use JSON escape strings in JSON content. To do this, you must specify JSON content in the ContentType setting.

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 .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-customresponsebody.html#cfn-wafv2-rulegroup-customresponsebody-content

content_type

The type of content in the payload that you are defining in the Content string.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-customresponsebody.html#cfn-wafv2-rulegroup-customresponsebody-contenttype

CustomResponseProperty

class CfnRuleGroup.CustomResponseProperty(*, response_code, custom_response_body_key=None, response_headers=None)

Bases: object

A custom response to send to the client.

You can define a custom response for rule actions and default web ACL actions that are set to Block .

For information about customizing web requests and responses, see Customizing web requests and responses in AWS WAF in the AWS WAF developer guide .

Parameters:
  • response_code (Union[int, float]) – The HTTP status code to return to the client. For a list of status codes that you can use in your custom responses, see Supported status codes for custom response in the AWS WAF Developer Guide .

  • custom_response_body_key (Optional[str]) – References the response body that you want AWS WAF to return to the web request client. You can define a custom response for a rule action or a default web ACL action that is set to block. To do this, you first define the response body key and value in the CustomResponseBodies setting for the WebACL or RuleGroup where you want to use it. Then, in the rule action or web ACL default action BlockAction setting, you reference the response body using this key.

  • response_headers (Union[IResolvable, Sequence[Union[IResolvable, CustomHTTPHeaderProperty, Dict[str, Any]]], None]) –

    The HTTP headers to use in the response. You can specify any header name except for content-type . Duplicate header names are not allowed. 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 .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-customresponse.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

custom_response_property = wafv2.CfnRuleGroup.CustomResponseProperty(
    response_code=123,

    # the properties below are optional
    custom_response_body_key="customResponseBodyKey",
    response_headers=[wafv2.CfnRuleGroup.CustomHTTPHeaderProperty(
        name="name",
        value="value"
    )]
)

Attributes

custom_response_body_key

References the response body that you want AWS WAF to return to the web request client.

You can define a custom response for a rule action or a default web ACL action that is set to block. To do this, you first define the response body key and value in the CustomResponseBodies setting for the WebACL or RuleGroup where you want to use it. Then, in the rule action or web ACL default action BlockAction setting, you reference the response body using this key.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-customresponse.html#cfn-wafv2-rulegroup-customresponse-customresponsebodykey

response_code

The HTTP status code to return to the client.

For a list of status codes that you can use in your custom responses, see Supported status codes for custom response in the AWS WAF Developer Guide .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-customresponse.html#cfn-wafv2-rulegroup-customresponse-responsecode

response_headers

The HTTP headers to use in the response.

You can specify any header name except for content-type . Duplicate header names are not allowed.

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 .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-customresponse.html#cfn-wafv2-rulegroup-customresponse-responseheaders

FieldToMatchProperty

class CfnRuleGroup.FieldToMatchProperty(*, all_query_arguments=None, body=None, cookies=None, headers=None, ja3_fingerprint=None, json_body=None, method=None, query_string=None, single_header=None, single_query_argument=None, uri_path=None)

Bases: object

Specifies a web request component to be used in a rule match statement or in a logging configuration.

  • In a rule statement, this is the part of the web request that you want AWS WAF to inspect. Include the single FieldToMatch type that you want to inspect, with additional specifications as needed, according to the type. You specify a single request component in FieldToMatch for each rule statement that requires it. To inspect more than one component of the web request, create a separate rule statement for each component.

Example JSON for a QueryString field to match:

"FieldToMatch": { "QueryString": {} }

Example JSON for a Method field to match specification:

"FieldToMatch": { "Method": { "Name": "DELETE" } }

  • In a logging configuration, this is used in the RedactedFields property to specify a field to redact from the logging records. For this use case, note the following:

  • Even though all FieldToMatch settings are available, the only valid settings for field redaction are UriPath , QueryString , SingleHeader , and Method .

  • In this documentation, the descriptions of the individual fields talk about specifying the web request component to inspect, but for field redaction, you are specifying the component type to redact from the logs.

  • If you have request sampling enabled, the redacted fields configuration for logging has no impact on sampling. The only way to exclude fields from request sampling is by disabling sampling in the web ACL visibility configuration.

Parameters:
  • all_query_arguments (Optional[Any]) – Inspect all query arguments.

  • body (Union[IResolvable, BodyProperty, Dict[str, Any], None]) – Inspect the request body as plain text. The request body immediately follows the request headers. This is the part of a request that contains any additional data that you want to send to your web server as the HTTP request body, such as data from a form. AWS WAF does not support inspecting the entire contents of the web request body if the body exceeds the limit for the resource type. When a web request body is larger than the limit, the underlying host service only forwards the contents that are within the limit to AWS WAF for inspection. - For Application Load Balancer and AWS AppSync , the limit is fixed at 8 KB (8,192 bytes). - For CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access, the default limit is 16 KB (16,384 bytes), and you can increase the limit for each resource type in the web ACL AssociationConfig , for additional processing fees. For information about how to handle oversized request bodies, see the Body object configuration.

  • cookies (Union[IResolvable, CookiesProperty, Dict[str, Any], None]) – Inspect the request cookies. You must configure scope and pattern matching filters in the Cookies object, to define the set of cookies and the parts of the cookies that AWS WAF inspects. Only the first 8 KB (8192 bytes) of a request’s cookies and only the first 200 cookies are forwarded to AWS WAF for inspection by the underlying host service. You must configure how to handle any oversize cookie content in the Cookies object. AWS WAF applies the pattern matching filters to the cookies that it receives from the underlying host service.

  • headers (Union[IResolvable, HeadersProperty, Dict[str, Any], None]) – Inspect the request headers. You must configure scope and pattern matching filters in the Headers object, to define the set of headers to and the parts of the headers that AWS WAF inspects. Only the first 8 KB (8192 bytes) of a request’s headers and only the first 200 headers are forwarded to AWS WAF for inspection by the underlying host service. You must configure how to handle any oversize header content in the Headers object. AWS WAF applies the pattern matching filters to the headers that it receives from the underlying host service.

  • ja3_fingerprint (Union[IResolvable, JA3FingerprintProperty, Dict[str, Any], None]) – Match against the request’s JA3 fingerprint. The JA3 fingerprint is a 32-character hash derived from the TLS Client Hello of an incoming request. This fingerprint serves as a unique identifier for the client’s TLS configuration. AWS WAF calculates and logs this fingerprint for each request that has enough TLS Client Hello information for the calculation. Almost all web requests include this information. .. epigraph:: You can use this choice only with a string match ByteMatchStatement with the PositionalConstraint set to EXACTLY . You can obtain the JA3 fingerprint for client requests from the web ACL logs. If AWS WAF is able to calculate the fingerprint, it includes it in the logs. For information about the logging fields, see Log fields in the AWS WAF Developer Guide . Provide the JA3 fingerprint string from the logs in your string match statement specification, to match with any future requests that have the same TLS configuration.

  • json_body (Union[IResolvable, JsonBodyProperty, Dict[str, Any], None]) – Inspect the request body as JSON. The request body immediately follows the request headers. This is the part of a request that contains any additional data that you want to send to your web server as the HTTP request body, such as data from a form. AWS WAF does not support inspecting the entire contents of the web request body if the body exceeds the limit for the resource type. When a web request body is larger than the limit, the underlying host service only forwards the contents that are within the limit to AWS WAF for inspection. - For Application Load Balancer and AWS AppSync , the limit is fixed at 8 KB (8,192 bytes). - For CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access, the default limit is 16 KB (16,384 bytes), and you can increase the limit for each resource type in the web ACL AssociationConfig , for additional processing fees. For information about how to handle oversized request bodies, see the JsonBody object configuration.

  • method (Optional[Any]) – Inspect the HTTP method. The method indicates the type of operation that the request is asking the origin to perform.

  • query_string (Optional[Any]) – Inspect the query string. This is the part of a URL that appears after a ? character, if any.

  • single_header (Optional[Any]) – Inspect a single header. Provide the name of the header to inspect, for example, User-Agent or Referer . This setting isn’t case sensitive. Example JSON: "SingleHeader": { "Name": "haystack" } Alternately, you can filter and inspect all headers with the Headers FieldToMatch setting.

  • single_query_argument (Optional[Any]) – Inspect a single query argument. Provide the name of the query argument to inspect, such as UserName or SalesRegion . The name can be up to 30 characters long and isn’t case sensitive. Example JSON: "SingleQueryArgument": { "Name": "myArgument" }

  • uri_path (Optional[Any]) – Inspect the request URI path. This is the part of the web request that identifies a resource, for example, /images/daily-ad.jpg .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-fieldtomatch.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any
# all_query_arguments: Any
# method: Any
# query_string: Any
# single_header: Any
# single_query_argument: Any
# uri_path: Any

field_to_match_property = wafv2.CfnRuleGroup.FieldToMatchProperty(
    all_query_arguments=all_query_arguments,
    body=wafv2.CfnRuleGroup.BodyProperty(
        oversize_handling="oversizeHandling"
    ),
    cookies=wafv2.CfnRuleGroup.CookiesProperty(
        match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
            all=all,
            excluded_cookies=["excludedCookies"],
            included_cookies=["includedCookies"]
        ),
        match_scope="matchScope",
        oversize_handling="oversizeHandling"
    ),
    headers=wafv2.CfnRuleGroup.HeadersProperty(
        match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
            all=all,
            excluded_headers=["excludedHeaders"],
            included_headers=["includedHeaders"]
        ),
        match_scope="matchScope",
        oversize_handling="oversizeHandling"
    ),
    ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
        fallback_behavior="fallbackBehavior"
    ),
    json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
        match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
            all=all,
            included_paths=["includedPaths"]
        ),
        match_scope="matchScope",

        # the properties below are optional
        invalid_fallback_behavior="invalidFallbackBehavior",
        oversize_handling="oversizeHandling"
    ),
    method=method,
    query_string=query_string,
    single_header=single_header,
    single_query_argument=single_query_argument,
    uri_path=uri_path
)

Attributes

all_query_arguments

Inspect all query arguments.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-fieldtomatch.html#cfn-wafv2-rulegroup-fieldtomatch-allqueryarguments

body

Inspect the request body as plain text.

The request body immediately follows the request headers. This is the part of a request that contains any additional data that you want to send to your web server as the HTTP request body, such as data from a form.

AWS WAF does not support inspecting the entire contents of the web request body if the body exceeds the limit for the resource type. When a web request body is larger than the limit, the underlying host service only forwards the contents that are within the limit to AWS WAF for inspection.

  • For Application Load Balancer and AWS AppSync , the limit is fixed at 8 KB (8,192 bytes).

  • For CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access, the default limit is 16 KB (16,384 bytes), and you can increase the limit for each resource type in the web ACL AssociationConfig , for additional processing fees.

For information about how to handle oversized request bodies, see the Body object configuration.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-fieldtomatch.html#cfn-wafv2-rulegroup-fieldtomatch-body

cookies

Inspect the request cookies.

You must configure scope and pattern matching filters in the Cookies object, to define the set of cookies and the parts of the cookies that AWS WAF inspects.

Only the first 8 KB (8192 bytes) of a request’s cookies and only the first 200 cookies are forwarded to AWS WAF for inspection by the underlying host service. You must configure how to handle any oversize cookie content in the Cookies object. AWS WAF applies the pattern matching filters to the cookies that it receives from the underlying host service.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-fieldtomatch.html#cfn-wafv2-rulegroup-fieldtomatch-cookies

headers

Inspect the request headers.

You must configure scope and pattern matching filters in the Headers object, to define the set of headers to and the parts of the headers that AWS WAF inspects.

Only the first 8 KB (8192 bytes) of a request’s headers and only the first 200 headers are forwarded to AWS WAF for inspection by the underlying host service. You must configure how to handle any oversize header content in the Headers object. AWS WAF applies the pattern matching filters to the headers that it receives from the underlying host service.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-fieldtomatch.html#cfn-wafv2-rulegroup-fieldtomatch-headers

ja3_fingerprint

Match against the request’s JA3 fingerprint.

The JA3 fingerprint is a 32-character hash derived from the TLS Client Hello of an incoming request. This fingerprint serves as a unique identifier for the client’s TLS configuration. AWS WAF calculates and logs this fingerprint for each request that has enough TLS Client Hello information for the calculation. Almost all web requests include this information. .. epigraph:

You can use this choice only with a string match ``ByteMatchStatement`` with the ``PositionalConstraint`` set to ``EXACTLY`` .

You can obtain the JA3 fingerprint for client requests from the web ACL logs. If AWS WAF is able to calculate the fingerprint, it includes it in the logs. For information about the logging fields, see Log fields in the AWS WAF Developer Guide .

Provide the JA3 fingerprint string from the logs in your string match statement specification, to match with any future requests that have the same TLS configuration.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-fieldtomatch.html#cfn-wafv2-rulegroup-fieldtomatch-ja3fingerprint

json_body

Inspect the request body as JSON.

The request body immediately follows the request headers. This is the part of a request that contains any additional data that you want to send to your web server as the HTTP request body, such as data from a form.

AWS WAF does not support inspecting the entire contents of the web request body if the body exceeds the limit for the resource type. When a web request body is larger than the limit, the underlying host service only forwards the contents that are within the limit to AWS WAF for inspection.

  • For Application Load Balancer and AWS AppSync , the limit is fixed at 8 KB (8,192 bytes).

  • For CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access, the default limit is 16 KB (16,384 bytes), and you can increase the limit for each resource type in the web ACL AssociationConfig , for additional processing fees.

For information about how to handle oversized request bodies, see the JsonBody object configuration.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-fieldtomatch.html#cfn-wafv2-rulegroup-fieldtomatch-jsonbody

method

Inspect the HTTP method.

The method indicates the type of operation that the request is asking the origin to perform.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-fieldtomatch.html#cfn-wafv2-rulegroup-fieldtomatch-method

query_string

Inspect the query string.

This is the part of a URL that appears after a ? character, if any.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-fieldtomatch.html#cfn-wafv2-rulegroup-fieldtomatch-querystring

single_header

Inspect a single header.

Provide the name of the header to inspect, for example, User-Agent or Referer . This setting isn’t case sensitive.

Example JSON: "SingleHeader": { "Name": "haystack" }

Alternately, you can filter and inspect all headers with the Headers FieldToMatch setting.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-fieldtomatch.html#cfn-wafv2-rulegroup-fieldtomatch-singleheader

single_query_argument

Inspect a single query argument.

Provide the name of the query argument to inspect, such as UserName or SalesRegion . The name can be up to 30 characters long and isn’t case sensitive.

Example JSON: "SingleQueryArgument": { "Name": "myArgument" }

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-fieldtomatch.html#cfn-wafv2-rulegroup-fieldtomatch-singlequeryargument

uri_path

Inspect the request URI path.

This is the part of the web request that identifies a resource, for example, /images/daily-ad.jpg .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-fieldtomatch.html#cfn-wafv2-rulegroup-fieldtomatch-uripath

ForwardedIPConfigurationProperty

class CfnRuleGroup.ForwardedIPConfigurationProperty(*, fallback_behavior, header_name)

Bases: object

The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that’s reported by the web request origin.

Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name. .. epigraph:

If the specified header isn't present in the request, AWS WAF doesn't apply the rule to the web request at all.

This configuration is used for GeoMatchStatement and RateBasedStatement . For IPSetReferenceStatement , use IPSetForwardedIPConfig instead.

AWS WAF only evaluates the first IP address found in the specified HTTP header.

Parameters:
  • fallback_behavior (str) – The match status to assign to the web request if the request doesn’t have a valid IP address in the specified position. .. epigraph:: If the specified header isn’t present in the request, AWS WAF doesn’t apply the rule to the web request at all. You can specify the following fallback behaviors: - MATCH - Treat the web request as matching the rule statement. AWS WAF applies the rule action to the request. - NO_MATCH - Treat the web request as not matching the rule statement.

  • header_name (str) – The name of the HTTP header to use for the IP address. For example, to use the X-Forwarded-For (XFF) header, set this to X-Forwarded-For . .. epigraph:: If the specified header isn’t present in the request, AWS WAF doesn’t apply the rule to the web request at all.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-forwardedipconfiguration.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

forwarded_iPConfiguration_property = wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty(
    fallback_behavior="fallbackBehavior",
    header_name="headerName"
)

Attributes

fallback_behavior

The match status to assign to the web request if the request doesn’t have a valid IP address in the specified position.

If the specified header isn’t present in the request, AWS WAF doesn’t apply the rule to the web request at all.

You can specify the following fallback behaviors:

  • MATCH - Treat the web request as matching the rule statement. AWS WAF applies the rule action to the request.

  • NO_MATCH - Treat the web request as not matching the rule statement.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-forwardedipconfiguration.html#cfn-wafv2-rulegroup-forwardedipconfiguration-fallbackbehavior

header_name

The name of the HTTP header to use for the IP address.

For example, to use the X-Forwarded-For (XFF) header, set this to X-Forwarded-For . .. epigraph:

If the specified header isn't present in the request, AWS WAF doesn't apply the rule to the web request at all.
See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-forwardedipconfiguration.html#cfn-wafv2-rulegroup-forwardedipconfiguration-headername

GeoMatchStatementProperty

class CfnRuleGroup.GeoMatchStatementProperty(*, country_codes=None, forwarded_ip_config=None)

Bases: object

A rule statement that labels web requests by country and region and that matches against web requests based on country code.

A geo match rule labels every request that it inspects regardless of whether it finds a match.

  • To manage requests only by country, you can use this statement by itself and specify the countries that you want to match against in the CountryCodes array.

  • Otherwise, configure your geo match rule with Count action so that it only labels requests. Then, add one or more label match rules to run after the geo match rule and configure them to match against the geographic labels and handle the requests as needed.

AWS WAF labels requests using the alpha-2 country and region codes from the International Organization for Standardization (ISO) 3166 standard. AWS WAF determines the codes using either the IP address in the web request origin or, if you specify it, the address in the geo match ForwardedIPConfig .

If you use the web request origin, the label formats are awswaf:clientip:geo:region:<ISO country code>-<ISO region code> and awswaf:clientip:geo:country:<ISO country code> .

If you use a forwarded IP address, the label formats are awswaf:forwardedip:geo:region:<ISO country code>-<ISO region code> and awswaf:forwardedip:geo:country:<ISO country code> .

For additional details, see Geographic match rule statement in the AWS WAF Developer Guide .

Parameters:
  • country_codes (Optional[Sequence[str]]) – An array of two-character country codes that you want to match against, for example, [ "US", "CN" ] , from the alpha-2 country ISO codes of the ISO 3166 international standard. When you use a geo match statement just for the region and country labels that it adds to requests, you still have to supply a country code for the rule to evaluate. In this case, you configure the rule to only count matching requests, but it will still generate logging and count metrics for any matches. You can reduce the logging and metrics that the rule produces by specifying a country that’s unlikely to be a source of traffic to your site.

  • forwarded_ip_config (Union[IResolvable, ForwardedIPConfigurationProperty, Dict[str, Any], None]) – The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that’s reported by the web request origin. Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name. .. epigraph:: If the specified header isn’t present in the request, AWS WAF doesn’t apply the rule to the web request at all.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-geomatchstatement.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

geo_match_statement_property = wafv2.CfnRuleGroup.GeoMatchStatementProperty(
    country_codes=["countryCodes"],
    forwarded_ip_config=wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty(
        fallback_behavior="fallbackBehavior",
        header_name="headerName"
    )
)

Attributes

country_codes

An array of two-character country codes that you want to match against, for example, [ "US", "CN" ] , from the alpha-2 country ISO codes of the ISO 3166 international standard.

When you use a geo match statement just for the region and country labels that it adds to requests, you still have to supply a country code for the rule to evaluate. In this case, you configure the rule to only count matching requests, but it will still generate logging and count metrics for any matches. You can reduce the logging and metrics that the rule produces by specifying a country that’s unlikely to be a source of traffic to your site.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-geomatchstatement.html#cfn-wafv2-rulegroup-geomatchstatement-countrycodes

forwarded_ip_config

The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that’s reported by the web request origin.

Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name. .. epigraph:

If the specified header isn't present in the request, AWS WAF doesn't apply the rule to the web request at all.
See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-geomatchstatement.html#cfn-wafv2-rulegroup-geomatchstatement-forwardedipconfig

HeaderMatchPatternProperty

class CfnRuleGroup.HeaderMatchPatternProperty(*, all=None, excluded_headers=None, included_headers=None)

Bases: object

The filter to use to identify the subset of headers to inspect in a web request.

You must specify exactly one setting: either All , IncludedHeaders , or ExcludedHeaders .

Example JSON: "MatchPattern": { "ExcludedHeaders": [ "KeyToExclude1", "KeyToExclude2" ] }

Parameters:
  • all (Optional[Any]) – Inspect all headers.

  • excluded_headers (Optional[Sequence[str]]) – Inspect only the headers whose keys don’t match any of the strings specified here.

  • included_headers (Optional[Sequence[str]]) – Inspect only the headers that have a key that matches one of the strings specified here.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-headermatchpattern.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any

header_match_pattern_property = wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
    all=all,
    excluded_headers=["excludedHeaders"],
    included_headers=["includedHeaders"]
)

Attributes

all

Inspect all headers.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-headermatchpattern.html#cfn-wafv2-rulegroup-headermatchpattern-all

excluded_headers

Inspect only the headers whose keys don’t match any of the strings specified here.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-headermatchpattern.html#cfn-wafv2-rulegroup-headermatchpattern-excludedheaders

included_headers

Inspect only the headers that have a key that matches one of the strings specified here.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-headermatchpattern.html#cfn-wafv2-rulegroup-headermatchpattern-includedheaders

HeadersProperty

class CfnRuleGroup.HeadersProperty(*, match_pattern, match_scope, oversize_handling)

Bases: object

Inspect all headers in the web request.

You can specify the parts of the headers to inspect and you can narrow the set of headers to inspect by including or excluding specific keys.

This is used to indicate the web request component to inspect, in the FieldToMatch specification.

If you want to inspect just the value of a single header, use the SingleHeader FieldToMatch setting instead.

Example JSON: "Headers": { "MatchPattern": { "All": {} }, "MatchScope": "KEY", "OversizeHandling": "MATCH" }

Parameters:
  • match_pattern (Union[IResolvable, HeaderMatchPatternProperty, Dict[str, Any]]) – The filter to use to identify the subset of headers to inspect in a web request. You must specify exactly one setting: either All , IncludedHeaders , or ExcludedHeaders . Example JSON: "MatchPattern": { "ExcludedHeaders": [ "KeyToExclude1", "KeyToExclude2" ] }

  • match_scope (str) – The parts of the headers to match with the rule inspection criteria. If you specify ALL , AWS WAF inspects both keys and values. All does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logical AND statement to combine two match rules, one that inspects the keys and another that inspects the values.

  • oversize_handling (str) – What AWS WAF should do if the headers of the request are more numerous or larger than AWS WAF can inspect. AWS WAF does not support inspecting the entire contents of request headers when they exceed 8 KB (8192 bytes) or 200 total headers. The underlying host service forwards a maximum of 200 headers and at most 8 KB of header contents to AWS WAF . The options for oversize handling are the following: - CONTINUE - Inspect the available headers normally, according to the rule inspection criteria. - MATCH - Treat the web request as matching the rule statement. AWS WAF applies the rule action to the request. - NO_MATCH - Treat the web request as not matching the rule statement.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-headers.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any

headers_property = wafv2.CfnRuleGroup.HeadersProperty(
    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
        all=all,
        excluded_headers=["excludedHeaders"],
        included_headers=["includedHeaders"]
    ),
    match_scope="matchScope",
    oversize_handling="oversizeHandling"
)

Attributes

match_pattern

The filter to use to identify the subset of headers to inspect in a web request.

You must specify exactly one setting: either All , IncludedHeaders , or ExcludedHeaders .

Example JSON: "MatchPattern": { "ExcludedHeaders": [ "KeyToExclude1", "KeyToExclude2" ] }

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-headers.html#cfn-wafv2-rulegroup-headers-matchpattern

match_scope

The parts of the headers to match with the rule inspection criteria.

If you specify ALL , AWS WAF inspects both keys and values.

All does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logical AND statement to combine two match rules, one that inspects the keys and another that inspects the values.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-headers.html#cfn-wafv2-rulegroup-headers-matchscope

oversize_handling

What AWS WAF should do if the headers of the request are more numerous or larger than AWS WAF can inspect.

AWS WAF does not support inspecting the entire contents of request headers when they exceed 8 KB (8192 bytes) or 200 total headers. The underlying host service forwards a maximum of 200 headers and at most 8 KB of header contents to AWS WAF .

The options for oversize handling are the following:

  • CONTINUE - Inspect the available headers normally, according to the rule inspection criteria.

  • MATCH - Treat the web request as matching the rule statement. AWS WAF applies the rule action to the request.

  • NO_MATCH - Treat the web request as not matching the rule statement.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-headers.html#cfn-wafv2-rulegroup-headers-oversizehandling

IPSetForwardedIPConfigurationProperty

class CfnRuleGroup.IPSetForwardedIPConfigurationProperty(*, fallback_behavior, header_name, position)

Bases: object

The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that’s reported by the web request origin.

Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name. .. epigraph:

If the specified header isn't present in the request, AWS WAF doesn't apply the rule to the web request at all.

This configuration is used only for IPSetReferenceStatement . For GeoMatchStatement and RateBasedStatement , use ForwardedIPConfig instead.

Parameters:
  • fallback_behavior (str) – The match status to assign to the web request if the request doesn’t have a valid IP address in the specified position. .. epigraph:: If the specified header isn’t present in the request, AWS WAF doesn’t apply the rule to the web request at all. You can specify the following fallback behaviors: - MATCH - Treat the web request as matching the rule statement. AWS WAF applies the rule action to the request. - NO_MATCH - Treat the web request as not matching the rule statement.

  • header_name (str) – The name of the HTTP header to use for the IP address. For example, to use the X-Forwarded-For (XFF) header, set this to X-Forwarded-For . .. epigraph:: If the specified header isn’t present in the request, AWS WAF doesn’t apply the rule to the web request at all.

  • position (str) – The position in the header to search for the IP address. The header can contain IP addresses of the original client and also of proxies. For example, the header value could be 10.1.1.1, 127.0.0.0, 10.10.10.10 where the first IP address identifies the original client and the rest identify proxies that the request went through. The options for this setting are the following: - FIRST - Inspect the first IP address in the list of IP addresses in the header. This is usually the client’s original IP. - LAST - Inspect the last IP address in the list of IP addresses in the header. - ANY - Inspect all IP addresses in the header for a match. If the header contains more than 10 IP addresses, AWS WAF inspects the last 10.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ipsetforwardedipconfiguration.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

i_pSet_forwarded_iPConfiguration_property = {
    "fallback_behavior": "fallbackBehavior",
    "header_name": "headerName",
    "position": "position"
}

Attributes

fallback_behavior

The match status to assign to the web request if the request doesn’t have a valid IP address in the specified position.

If the specified header isn’t present in the request, AWS WAF doesn’t apply the rule to the web request at all.

You can specify the following fallback behaviors:

  • MATCH - Treat the web request as matching the rule statement. AWS WAF applies the rule action to the request.

  • NO_MATCH - Treat the web request as not matching the rule statement.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ipsetforwardedipconfiguration.html#cfn-wafv2-rulegroup-ipsetforwardedipconfiguration-fallbackbehavior

header_name

The name of the HTTP header to use for the IP address.

For example, to use the X-Forwarded-For (XFF) header, set this to X-Forwarded-For . .. epigraph:

If the specified header isn't present in the request, AWS WAF doesn't apply the rule to the web request at all.
See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ipsetforwardedipconfiguration.html#cfn-wafv2-rulegroup-ipsetforwardedipconfiguration-headername

position

The position in the header to search for the IP address.

The header can contain IP addresses of the original client and also of proxies. For example, the header value could be 10.1.1.1, 127.0.0.0, 10.10.10.10 where the first IP address identifies the original client and the rest identify proxies that the request went through.

The options for this setting are the following:

  • FIRST - Inspect the first IP address in the list of IP addresses in the header. This is usually the client’s original IP.

  • LAST - Inspect the last IP address in the list of IP addresses in the header.

  • ANY - Inspect all IP addresses in the header for a match. If the header contains more than 10 IP addresses, AWS WAF inspects the last 10.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ipsetforwardedipconfiguration.html#cfn-wafv2-rulegroup-ipsetforwardedipconfiguration-position

IPSetReferenceStatementProperty

class CfnRuleGroup.IPSetReferenceStatementProperty(*, arn, ip_set_forwarded_ip_config=None)

Bases: object

A rule statement used to detect web requests coming from particular IP addresses or address ranges.

To use this, create an IPSet that specifies the addresses you want to detect, then use the ARN of that set in this statement.

Each IP set rule statement references an IP set. You create and maintain the set independent of your rules. This allows you to use the single set in multiple rules. When you update the referenced set, AWS WAF automatically updates all rules that reference it.

Parameters:
  • arn (str) – The Amazon Resource Name (ARN) of the IPSet that this statement references.

  • ip_set_forwarded_ip_config (Union[IResolvable, IPSetForwardedIPConfigurationProperty, Dict[str, Any], None]) – The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that’s reported by the web request origin. Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name. .. epigraph:: If the specified header isn’t present in the request, AWS WAF doesn’t apply the rule to the web request at all.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ipsetreferencestatement.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

i_pSet_reference_statement_property = {
    "arn": "arn",

    # the properties below are optional
    "ip_set_forwarded_ip_config": {
        "fallback_behavior": "fallbackBehavior",
        "header_name": "headerName",
        "position": "position"
    }
}

Attributes

arn

The Amazon Resource Name (ARN) of the IPSet that this statement references.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ipsetreferencestatement.html#cfn-wafv2-rulegroup-ipsetreferencestatement-arn

ip_set_forwarded_ip_config

The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that’s reported by the web request origin.

Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name. .. epigraph:

If the specified header isn't present in the request, AWS WAF doesn't apply the rule to the web request at all.
See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ipsetreferencestatement.html#cfn-wafv2-rulegroup-ipsetreferencestatement-ipsetforwardedipconfig

ImmunityTimePropertyProperty

class CfnRuleGroup.ImmunityTimePropertyProperty(*, immunity_time)

Bases: object

Used for CAPTCHA and challenge token settings.

Determines how long a CAPTCHA or challenge timestamp remains valid after AWS WAF updates it for a successful CAPTCHA or challenge response.

Parameters:

immunity_time (Union[int, float]) – The amount of time, in seconds, that a CAPTCHA or challenge timestamp is considered valid by AWS WAF . The default setting is 300. For the Challenge action, the minimum setting is 300.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-immunitytimeproperty.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

immunity_time_property_property = wafv2.CfnRuleGroup.ImmunityTimePropertyProperty(
    immunity_time=123
)

Attributes

immunity_time

The amount of time, in seconds, that a CAPTCHA or challenge timestamp is considered valid by AWS WAF .

The default setting is 300.

For the Challenge action, the minimum setting is 300.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-immunitytimeproperty.html#cfn-wafv2-rulegroup-immunitytimeproperty-immunitytime

JA3FingerprintProperty

class CfnRuleGroup.JA3FingerprintProperty(*, fallback_behavior)

Bases: object

Match against the request’s JA3 fingerprint.

The JA3 fingerprint is a 32-character hash derived from the TLS Client Hello of an incoming request. This fingerprint serves as a unique identifier for the client’s TLS configuration. AWS WAF calculates and logs this fingerprint for each request that has enough TLS Client Hello information for the calculation. Almost all web requests include this information. .. epigraph:

You can use this choice only with a string match ``ByteMatchStatement`` with the ``PositionalConstraint`` set to ``EXACTLY`` .

You can obtain the JA3 fingerprint for client requests from the web ACL logs. If AWS WAF is able to calculate the fingerprint, it includes it in the logs. For information about the logging fields, see Log fields in the AWS WAF Developer Guide .

Provide the JA3 fingerprint string from the logs in your string match statement specification, to match with any future requests that have the same TLS configuration.

Parameters:

fallback_behavior (str) – The match status to assign to the web request if the request doesn’t have a JA3 fingerprint. You can specify the following fallback behaviors: - MATCH - Treat the web request as matching the rule statement. AWS WAF applies the rule action to the request. - NO_MATCH - Treat the web request as not matching the rule statement.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ja3fingerprint.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

j_a3_fingerprint_property = wafv2.CfnRuleGroup.JA3FingerprintProperty(
    fallback_behavior="fallbackBehavior"
)

Attributes

fallback_behavior

The match status to assign to the web request if the request doesn’t have a JA3 fingerprint.

You can specify the following fallback behaviors:

  • MATCH - Treat the web request as matching the rule statement. AWS WAF applies the rule action to the request.

  • NO_MATCH - Treat the web request as not matching the rule statement.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ja3fingerprint.html#cfn-wafv2-rulegroup-ja3fingerprint-fallbackbehavior

JsonBodyProperty

class CfnRuleGroup.JsonBodyProperty(*, match_pattern, match_scope, invalid_fallback_behavior=None, oversize_handling=None)

Bases: object

Inspect the body of the web request as JSON. The body immediately follows the request headers.

This is used to indicate the web request component to inspect, in the FieldToMatch specification.

Use the specifications in this object to indicate which parts of the JSON body to inspect using the rule’s inspection criteria. AWS WAF inspects only the parts of the JSON that result from the matches that you indicate.

Example JSON: "JsonBody": { "MatchPattern": { "All": {} }, "MatchScope": "ALL" }

Parameters:
  • match_pattern (Union[IResolvable, JsonMatchPatternProperty, Dict[str, Any]]) – The patterns to look for in the JSON body. AWS WAF inspects the results of these pattern matches against the rule inspection criteria.

  • match_scope (str) – The parts of the JSON to match against using the MatchPattern . If you specify ALL , AWS WAF matches against keys and values. All does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logical AND statement to combine two match rules, one that inspects the keys and another that inspects the values.

  • invalid_fallback_behavior (Optional[str]) – What AWS WAF should do if it fails to completely parse the JSON body. The options are the following:. - EVALUATE_AS_STRING - Inspect the body as plain text. AWS WAF applies the text transformations and inspection criteria that you defined for the JSON inspection to the body text string. - MATCH - Treat the web request as matching the rule statement. AWS WAF applies the rule action to the request. - NO_MATCH - Treat the web request as not matching the rule statement. If you don’t provide this setting, AWS WAF parses and evaluates the content only up to the first parsing failure that it encounters. AWS WAF does its best to parse the entire JSON body, but might be forced to stop for reasons such as invalid characters, duplicate keys, truncation, and any content whose root node isn’t an object or an array. AWS WAF parses the JSON in the following examples as two valid key, value pairs: - Missing comma: {"key1":"value1""key2":"value2"} - Missing colon: {"key1":"value1","key2""value2"} - Extra colons: {"key1"::"value1","key2""value2"}

  • oversize_handling (Optional[str]) – What AWS WAF should do if the body is larger than AWS WAF can inspect. AWS WAF does not support inspecting the entire contents of the web request body if the body exceeds the limit for the resource type. When a web request body is larger than the limit, the underlying host service only forwards the contents that are within the limit to AWS WAF for inspection. - For Application Load Balancer and AWS AppSync , the limit is fixed at 8 KB (8,192 bytes). - For CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access, the default limit is 16 KB (16,384 bytes), and you can increase the limit for each resource type in the web ACL AssociationConfig , for additional processing fees. The options for oversize handling are the following: - CONTINUE - Inspect the available body contents normally, according to the rule inspection criteria. - MATCH - Treat the web request as matching the rule statement. AWS WAF applies the rule action to the request. - NO_MATCH - Treat the web request as not matching the rule statement. You can combine the MATCH or NO_MATCH settings for oversize handling with your rule and web ACL action settings, so that you block any request whose body is over the limit. Default: CONTINUE

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-jsonbody.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any

json_body_property = wafv2.CfnRuleGroup.JsonBodyProperty(
    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
        all=all,
        included_paths=["includedPaths"]
    ),
    match_scope="matchScope",

    # the properties below are optional
    invalid_fallback_behavior="invalidFallbackBehavior",
    oversize_handling="oversizeHandling"
)

Attributes

invalid_fallback_behavior

.

  • EVALUATE_AS_STRING - Inspect the body as plain text. AWS WAF applies the text transformations and inspection criteria that you defined for the JSON inspection to the body text string.

  • MATCH - Treat the web request as matching the rule statement. AWS WAF applies the rule action to the request.

  • NO_MATCH - Treat the web request as not matching the rule statement.

If you don’t provide this setting, AWS WAF parses and evaluates the content only up to the first parsing failure that it encounters.

AWS WAF does its best to parse the entire JSON body, but might be forced to stop for reasons such as invalid characters, duplicate keys, truncation, and any content whose root node isn’t an object or an array.

AWS WAF parses the JSON in the following examples as two valid key, value pairs:

  • Missing comma: {"key1":"value1""key2":"value2"}

  • Missing colon: {"key1":"value1","key2""value2"}

  • Extra colons: {"key1"::"value1","key2""value2"}

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-jsonbody.html#cfn-wafv2-rulegroup-jsonbody-invalidfallbackbehavior

Type:

What AWS WAF should do if it fails to completely parse the JSON body. The options are the following

match_pattern

The patterns to look for in the JSON body.

AWS WAF inspects the results of these pattern matches against the rule inspection criteria.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-jsonbody.html#cfn-wafv2-rulegroup-jsonbody-matchpattern

match_scope

The parts of the JSON to match against using the MatchPattern .

If you specify ALL , AWS WAF matches against keys and values.

All does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logical AND statement to combine two match rules, one that inspects the keys and another that inspects the values.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-jsonbody.html#cfn-wafv2-rulegroup-jsonbody-matchscope

oversize_handling

What AWS WAF should do if the body is larger than AWS WAF can inspect.

AWS WAF does not support inspecting the entire contents of the web request body if the body exceeds the limit for the resource type. When a web request body is larger than the limit, the underlying host service only forwards the contents that are within the limit to AWS WAF for inspection.

  • For Application Load Balancer and AWS AppSync , the limit is fixed at 8 KB (8,192 bytes).

  • For CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access, the default limit is 16 KB (16,384 bytes), and you can increase the limit for each resource type in the web ACL AssociationConfig , for additional processing fees.

The options for oversize handling are the following:

  • CONTINUE - Inspect the available body contents normally, according to the rule inspection criteria.

  • MATCH - Treat the web request as matching the rule statement. AWS WAF applies the rule action to the request.

  • NO_MATCH - Treat the web request as not matching the rule statement.

You can combine the MATCH or NO_MATCH settings for oversize handling with your rule and web ACL action settings, so that you block any request whose body is over the limit.

Default: CONTINUE

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-jsonbody.html#cfn-wafv2-rulegroup-jsonbody-oversizehandling

JsonMatchPatternProperty

class CfnRuleGroup.JsonMatchPatternProperty(*, all=None, included_paths=None)

Bases: object

The patterns to look for in the JSON body.

AWS WAF inspects the results of these pattern matches against the rule inspection criteria. This is used with the FieldToMatch option JsonBody .

Parameters:
  • all (Optional[Any]) – Match all of the elements. See also MatchScope in the JsonBody FieldToMatch specification. You must specify either this setting or the IncludedPaths setting, but not both.

  • included_paths (Optional[Sequence[str]]) – Match only the specified include paths. See also MatchScope in the JsonBody FieldToMatch specification. Provide the include paths using JSON Pointer syntax. For example, "IncludedPaths": ["/dogs/0/name", "/dogs/1/name"] . For information about this syntax, see the Internet Engineering Task Force (IETF) documentation JavaScript Object Notation (JSON) Pointer . You must specify either this setting or the All setting, but not both. .. epigraph:: Don’t use this option to include all paths. Instead, use the All setting.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-jsonmatchpattern.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any

json_match_pattern_property = wafv2.CfnRuleGroup.JsonMatchPatternProperty(
    all=all,
    included_paths=["includedPaths"]
)

Attributes

all

Match all of the elements. See also MatchScope in the JsonBody FieldToMatch specification.

You must specify either this setting or the IncludedPaths setting, but not both.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-jsonmatchpattern.html#cfn-wafv2-rulegroup-jsonmatchpattern-all

included_paths

Match only the specified include paths. See also MatchScope in the JsonBody FieldToMatch specification.

Provide the include paths using JSON Pointer syntax. For example, "IncludedPaths": ["/dogs/0/name", "/dogs/1/name"] . For information about this syntax, see the Internet Engineering Task Force (IETF) documentation JavaScript Object Notation (JSON) Pointer .

You must specify either this setting or the All setting, but not both. .. epigraph:

Don't use this option to include all paths. Instead, use the ``All`` setting.
See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-jsonmatchpattern.html#cfn-wafv2-rulegroup-jsonmatchpattern-includedpaths

LabelMatchStatementProperty

class CfnRuleGroup.LabelMatchStatementProperty(*, key, scope)

Bases: object

A rule statement to match against labels that have been added to the web request by rules that have already run in the web ACL.

The label match statement provides the label or namespace string to search for. The label string can represent a part or all of the fully qualified label name that had been added to the web request. Fully qualified labels have a prefix, optional namespaces, and label name. The prefix identifies the rule group or web ACL context of the rule that added the label. If you do not provide the fully qualified name in your label match string, AWS WAF performs the search for labels that were added in the same context as the label match statement.

Parameters:
  • key (str) – The string to match against. The setting you provide for this depends on the match statement’s Scope setting:. - If the Scope indicates LABEL , then this specification must include the name and can include any number of preceding namespace specifications and prefix up to providing the fully qualified label name. - If the Scope indicates NAMESPACE , then this specification can include any number of contiguous namespace strings, and can include the entire label namespace prefix from the rule group or web ACL where the label originates. Labels are case sensitive and components of a label must be separated by colon, for example NS1:NS2:name .

  • scope (str) – Specify whether you want to match using the label name or just the namespace.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-labelmatchstatement.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

label_match_statement_property = wafv2.CfnRuleGroup.LabelMatchStatementProperty(
    key="key",
    scope="scope"
)

Attributes

key

.

  • If the Scope indicates LABEL , then this specification must include the name and can include any number of preceding namespace specifications and prefix up to providing the fully qualified label name.

  • If the Scope indicates NAMESPACE , then this specification can include any number of contiguous namespace strings, and can include the entire label namespace prefix from the rule group or web ACL where the label originates.

Labels are case sensitive and components of a label must be separated by colon, for example NS1:NS2:name .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-labelmatchstatement.html#cfn-wafv2-rulegroup-labelmatchstatement-key

Type:

The string to match against. The setting you provide for this depends on the match statement’s Scope setting

scope

Specify whether you want to match using the label name or just the namespace.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-labelmatchstatement.html#cfn-wafv2-rulegroup-labelmatchstatement-scope

LabelProperty

class CfnRuleGroup.LabelProperty(*, name)

Bases: object

A single label container.

This is used as an element of a label array in RuleLabels inside a rule.

Parameters:

name (str) – The label string.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-label.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

label_property = wafv2.CfnRuleGroup.LabelProperty(
    name="name"
)

Attributes

name

The label string.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-label.html#cfn-wafv2-rulegroup-label-name

LabelSummaryProperty

class CfnRuleGroup.LabelSummaryProperty(*, name=None)

Bases: object

List of labels used by one or more of the rules of a RuleGroup .

This summary object is used for the following rule group lists:

  • AvailableLabels - Labels that rules add to matching requests. These labels are defined in the RuleLabels for a rule.

  • ConsumedLabels - Labels that rules match against. These labels are defined in a LabelMatchStatement specification, in the Statement definition of a rule.

Parameters:

name (Optional[str]) – An individual label specification.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-labelsummary.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

label_summary_property = wafv2.CfnRuleGroup.LabelSummaryProperty(
    name="name"
)

Attributes

name

An individual label specification.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-labelsummary.html#cfn-wafv2-rulegroup-labelsummary-name

NotStatementProperty

class CfnRuleGroup.NotStatementProperty(*, statement)

Bases: object

A logical rule statement used to negate the results of another rule statement.

You provide one Statement within the NotStatement .

Parameters:

statement (Union[IResolvable, StatementProperty, Dict[str, Any]]) – The statement to negate. You can use any statement that can be nested.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-notstatement.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any
# all_query_arguments: Any
# forwarded_ip: Any
# http_method: Any
# ip: Any
# method: Any
# not_statement_property_: wafv2.CfnRuleGroup.NotStatementProperty
# query_string: Any
# single_header: Any
# single_query_argument: Any
# statement_property_: wafv2.CfnRuleGroup.StatementProperty
# uri_path: Any

not_statement_property = wafv2.CfnRuleGroup.NotStatementProperty(
    statement=wafv2.CfnRuleGroup.StatementProperty(
        and_statement=wafv2.CfnRuleGroup.AndStatementProperty(
            statements=[statement_property_]
        ),
        byte_match_statement=wafv2.CfnRuleGroup.ByteMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            positional_constraint="positionalConstraint",
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )],

            # the properties below are optional
            search_string="searchString",
            search_string_base64="searchStringBase64"
        ),
        geo_match_statement=wafv2.CfnRuleGroup.GeoMatchStatementProperty(
            country_codes=["countryCodes"],
            forwarded_ip_config=wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty(
                fallback_behavior="fallbackBehavior",
                header_name="headerName"
            )
        ),
        ip_set_reference_statement={
            "arn": "arn",

            # the properties below are optional
            "ip_set_forwarded_ip_config": {
                "fallback_behavior": "fallbackBehavior",
                "header_name": "headerName",
                "position": "position"
            }
        },
        label_match_statement=wafv2.CfnRuleGroup.LabelMatchStatementProperty(
            key="key",
            scope="scope"
        ),
        not_statement=not_statement_property_,
        or_statement=wafv2.CfnRuleGroup.OrStatementProperty(
            statements=[statement_property_]
        ),
        rate_based_statement=wafv2.CfnRuleGroup.RateBasedStatementProperty(
            aggregate_key_type="aggregateKeyType",
            limit=123,

            # the properties below are optional
            custom_keys=[wafv2.CfnRuleGroup.RateBasedStatementCustomKeyProperty(
                cookie=wafv2.CfnRuleGroup.RateLimitCookieProperty(
                    name="name",
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                ),
                forwarded_ip=forwarded_ip,
                header=wafv2.CfnRuleGroup.RateLimitHeaderProperty(
                    name="name",
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                ),
                http_method=http_method,
                ip=ip,
                label_namespace=wafv2.CfnRuleGroup.RateLimitLabelNamespaceProperty(
                    namespace="namespace"
                ),
                query_argument=wafv2.CfnRuleGroup.RateLimitQueryArgumentProperty(
                    name="name",
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                ),
                query_string=wafv2.CfnRuleGroup.RateLimitQueryStringProperty(
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                ),
                uri_path=wafv2.CfnRuleGroup.RateLimitUriPathProperty(
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                )
            )],
            evaluation_window_sec=123,
            forwarded_ip_config=wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty(
                fallback_behavior="fallbackBehavior",
                header_name="headerName"
            ),
            scope_down_statement=statement_property_
        ),
        regex_match_statement=wafv2.CfnRuleGroup.RegexMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            regex_string="regexString",
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        regex_pattern_set_reference_statement=wafv2.CfnRuleGroup.RegexPatternSetReferenceStatementProperty(
            arn="arn",
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        size_constraint_statement=wafv2.CfnRuleGroup.SizeConstraintStatementProperty(
            comparison_operator="comparisonOperator",
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            size=123,
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        sqli_match_statement=wafv2.CfnRuleGroup.SqliMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )],

            # the properties below are optional
            sensitivity_level="sensitivityLevel"
        ),
        xss_match_statement=wafv2.CfnRuleGroup.XssMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        )
    )
)

Attributes

statement

The statement to negate.

You can use any statement that can be nested.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-notstatement.html#cfn-wafv2-rulegroup-notstatement-statement

OrStatementProperty

class CfnRuleGroup.OrStatementProperty(*, statements)

Bases: object

A logical rule statement used to combine other rule statements with OR logic.

You provide more than one Statement within the OrStatement .

Parameters:

statements (Union[IResolvable, Sequence[Union[IResolvable, StatementProperty, Dict[str, Any]]]]) – The statements to combine with OR logic. You can use any statements that can be nested.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-orstatement.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any
# all_query_arguments: Any
# forwarded_ip: Any
# http_method: Any
# ip: Any
# method: Any
# or_statement_property_: wafv2.CfnRuleGroup.OrStatementProperty
# query_string: Any
# single_header: Any
# single_query_argument: Any
# statement_property_: wafv2.CfnRuleGroup.StatementProperty
# uri_path: Any

or_statement_property = wafv2.CfnRuleGroup.OrStatementProperty(
    statements=[wafv2.CfnRuleGroup.StatementProperty(
        and_statement=wafv2.CfnRuleGroup.AndStatementProperty(
            statements=[statement_property_]
        ),
        byte_match_statement=wafv2.CfnRuleGroup.ByteMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            positional_constraint="positionalConstraint",
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )],

            # the properties below are optional
            search_string="searchString",
            search_string_base64="searchStringBase64"
        ),
        geo_match_statement=wafv2.CfnRuleGroup.GeoMatchStatementProperty(
            country_codes=["countryCodes"],
            forwarded_ip_config=wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty(
                fallback_behavior="fallbackBehavior",
                header_name="headerName"
            )
        ),
        ip_set_reference_statement={
            "arn": "arn",

            # the properties below are optional
            "ip_set_forwarded_ip_config": {
                "fallback_behavior": "fallbackBehavior",
                "header_name": "headerName",
                "position": "position"
            }
        },
        label_match_statement=wafv2.CfnRuleGroup.LabelMatchStatementProperty(
            key="key",
            scope="scope"
        ),
        not_statement=wafv2.CfnRuleGroup.NotStatementProperty(
            statement=statement_property_
        ),
        or_statement=or_statement_property_,
        rate_based_statement=wafv2.CfnRuleGroup.RateBasedStatementProperty(
            aggregate_key_type="aggregateKeyType",
            limit=123,

            # the properties below are optional
            custom_keys=[wafv2.CfnRuleGroup.RateBasedStatementCustomKeyProperty(
                cookie=wafv2.CfnRuleGroup.RateLimitCookieProperty(
                    name="name",
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                ),
                forwarded_ip=forwarded_ip,
                header=wafv2.CfnRuleGroup.RateLimitHeaderProperty(
                    name="name",
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                ),
                http_method=http_method,
                ip=ip,
                label_namespace=wafv2.CfnRuleGroup.RateLimitLabelNamespaceProperty(
                    namespace="namespace"
                ),
                query_argument=wafv2.CfnRuleGroup.RateLimitQueryArgumentProperty(
                    name="name",
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                ),
                query_string=wafv2.CfnRuleGroup.RateLimitQueryStringProperty(
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                ),
                uri_path=wafv2.CfnRuleGroup.RateLimitUriPathProperty(
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                )
            )],
            evaluation_window_sec=123,
            forwarded_ip_config=wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty(
                fallback_behavior="fallbackBehavior",
                header_name="headerName"
            ),
            scope_down_statement=statement_property_
        ),
        regex_match_statement=wafv2.CfnRuleGroup.RegexMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            regex_string="regexString",
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        regex_pattern_set_reference_statement=wafv2.CfnRuleGroup.RegexPatternSetReferenceStatementProperty(
            arn="arn",
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        size_constraint_statement=wafv2.CfnRuleGroup.SizeConstraintStatementProperty(
            comparison_operator="comparisonOperator",
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            size=123,
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        sqli_match_statement=wafv2.CfnRuleGroup.SqliMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )],

            # the properties below are optional
            sensitivity_level="sensitivityLevel"
        ),
        xss_match_statement=wafv2.CfnRuleGroup.XssMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        )
    )]
)

Attributes

statements

The statements to combine with OR logic.

You can use any statements that can be nested.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-orstatement.html#cfn-wafv2-rulegroup-orstatement-statements

RateBasedStatementCustomKeyProperty

class CfnRuleGroup.RateBasedStatementCustomKeyProperty(*, cookie=None, forwarded_ip=None, header=None, http_method=None, ip=None, label_namespace=None, query_argument=None, query_string=None, uri_path=None)

Bases: object

Specifies a single custom aggregate key for a rate-base rule.

Web requests that are missing any of the components specified in the aggregation keys are omitted from the rate-based rule evaluation and handling.

Parameters:
  • cookie (Union[IResolvable, RateLimitCookieProperty, Dict[str, Any], None]) – Use the value of a cookie in the request as an aggregate key. Each distinct value in the cookie contributes to the aggregation instance. If you use a single cookie as your custom key, then each value fully defines an aggregation instance.

  • forwarded_ip (Optional[Any]) – Use the first IP address in an HTTP header as an aggregate key. Each distinct forwarded IP address contributes to the aggregation instance. When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one other key to use. You can aggregate on only the forwarded IP address by specifying FORWARDED_IP in your rate-based statement’s AggregateKeyType . With this option, you must specify the header to use in the rate-based rule’s ForwardedIPConfig property.

  • header (Union[IResolvable, RateLimitHeaderProperty, Dict[str, Any], None]) – Use the value of a header in the request as an aggregate key. Each distinct value in the header contributes to the aggregation instance. If you use a single header as your custom key, then each value fully defines an aggregation instance.

  • http_method (Optional[Any]) – Use the request’s HTTP method as an aggregate key. Each distinct HTTP method contributes to the aggregation instance. If you use just the HTTP method as your custom key, then each method fully defines an aggregation instance.

  • ip (Optional[Any]) – Use the request’s originating IP address as an aggregate key. Each distinct IP address contributes to the aggregation instance. When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one other key to use. You can aggregate on only the IP address by specifying IP in your rate-based statement’s AggregateKeyType .

  • label_namespace (Union[IResolvable, RateLimitLabelNamespaceProperty, Dict[str, Any], None]) – Use the specified label namespace as an aggregate key. Each distinct fully qualified label name that has the specified label namespace contributes to the aggregation instance. If you use just one label namespace as your custom key, then each label name fully defines an aggregation instance. This uses only labels that have been added to the request by rules that are evaluated before this rate-based rule in the web ACL. For information about label namespaces and names, see Label syntax and naming requirements in the AWS WAF Developer Guide .

  • query_argument (Union[IResolvable, RateLimitQueryArgumentProperty, Dict[str, Any], None]) – Use the specified query argument as an aggregate key. Each distinct value for the named query argument contributes to the aggregation instance. If you use a single query argument as your custom key, then each value fully defines an aggregation instance.

  • query_string (Union[IResolvable, RateLimitQueryStringProperty, Dict[str, Any], None]) – Use the request’s query string as an aggregate key. Each distinct string contributes to the aggregation instance. If you use just the query string as your custom key, then each string fully defines an aggregation instance.

  • uri_path (Union[IResolvable, RateLimitUriPathProperty, Dict[str, Any], None]) – Use the request’s URI path as an aggregate key. Each distinct URI path contributes to the aggregation instance. If you use just the URI path as your custom key, then each URI path fully defines an aggregation instance.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratebasedstatementcustomkey.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# forwarded_ip: Any
# http_method: Any
# ip: Any

rate_based_statement_custom_key_property = wafv2.CfnRuleGroup.RateBasedStatementCustomKeyProperty(
    cookie=wafv2.CfnRuleGroup.RateLimitCookieProperty(
        name="name",
        text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
            priority=123,
            type="type"
        )]
    ),
    forwarded_ip=forwarded_ip,
    header=wafv2.CfnRuleGroup.RateLimitHeaderProperty(
        name="name",
        text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
            priority=123,
            type="type"
        )]
    ),
    http_method=http_method,
    ip=ip,
    label_namespace=wafv2.CfnRuleGroup.RateLimitLabelNamespaceProperty(
        namespace="namespace"
    ),
    query_argument=wafv2.CfnRuleGroup.RateLimitQueryArgumentProperty(
        name="name",
        text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
            priority=123,
            type="type"
        )]
    ),
    query_string=wafv2.CfnRuleGroup.RateLimitQueryStringProperty(
        text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
            priority=123,
            type="type"
        )]
    ),
    uri_path=wafv2.CfnRuleGroup.RateLimitUriPathProperty(
        text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
            priority=123,
            type="type"
        )]
    )
)

Attributes

cookie

Use the value of a cookie in the request as an aggregate key.

Each distinct value in the cookie contributes to the aggregation instance. If you use a single cookie as your custom key, then each value fully defines an aggregation instance.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratebasedstatementcustomkey.html#cfn-wafv2-rulegroup-ratebasedstatementcustomkey-cookie

forwarded_ip

Use the first IP address in an HTTP header as an aggregate key.

Each distinct forwarded IP address contributes to the aggregation instance.

When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one other key to use. You can aggregate on only the forwarded IP address by specifying FORWARDED_IP in your rate-based statement’s AggregateKeyType .

With this option, you must specify the header to use in the rate-based rule’s ForwardedIPConfig property.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratebasedstatementcustomkey.html#cfn-wafv2-rulegroup-ratebasedstatementcustomkey-forwardedip

header

Use the value of a header in the request as an aggregate key.

Each distinct value in the header contributes to the aggregation instance. If you use a single header as your custom key, then each value fully defines an aggregation instance.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratebasedstatementcustomkey.html#cfn-wafv2-rulegroup-ratebasedstatementcustomkey-header

http_method

Use the request’s HTTP method as an aggregate key.

Each distinct HTTP method contributes to the aggregation instance. If you use just the HTTP method as your custom key, then each method fully defines an aggregation instance.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratebasedstatementcustomkey.html#cfn-wafv2-rulegroup-ratebasedstatementcustomkey-httpmethod

ip

Use the request’s originating IP address as an aggregate key. Each distinct IP address contributes to the aggregation instance.

When you specify an IP or forwarded IP in the custom key settings, you must also specify at least one other key to use. You can aggregate on only the IP address by specifying IP in your rate-based statement’s AggregateKeyType .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratebasedstatementcustomkey.html#cfn-wafv2-rulegroup-ratebasedstatementcustomkey-ip

label_namespace

Use the specified label namespace as an aggregate key.

Each distinct fully qualified label name that has the specified label namespace contributes to the aggregation instance. If you use just one label namespace as your custom key, then each label name fully defines an aggregation instance.

This uses only labels that have been added to the request by rules that are evaluated before this rate-based rule in the web ACL.

For information about label namespaces and names, see Label syntax and naming requirements in the AWS WAF Developer Guide .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratebasedstatementcustomkey.html#cfn-wafv2-rulegroup-ratebasedstatementcustomkey-labelnamespace

query_argument

Use the specified query argument as an aggregate key.

Each distinct value for the named query argument contributes to the aggregation instance. If you use a single query argument as your custom key, then each value fully defines an aggregation instance.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratebasedstatementcustomkey.html#cfn-wafv2-rulegroup-ratebasedstatementcustomkey-queryargument

query_string

Use the request’s query string as an aggregate key.

Each distinct string contributes to the aggregation instance. If you use just the query string as your custom key, then each string fully defines an aggregation instance.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratebasedstatementcustomkey.html#cfn-wafv2-rulegroup-ratebasedstatementcustomkey-querystring

uri_path

Use the request’s URI path as an aggregate key.

Each distinct URI path contributes to the aggregation instance. If you use just the URI path as your custom key, then each URI path fully defines an aggregation instance.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratebasedstatementcustomkey.html#cfn-wafv2-rulegroup-ratebasedstatementcustomkey-uripath

RateBasedStatementProperty

class CfnRuleGroup.RateBasedStatementProperty(*, aggregate_key_type, limit, custom_keys=None, evaluation_window_sec=None, forwarded_ip_config=None, scope_down_statement=None)

Bases: object

A rate-based rule counts incoming requests and rate limits requests when they are coming at too fast a rate.

The rule categorizes requests according to your aggregation criteria, collects them into aggregation instances, and counts and rate limits the requests for each instance. .. epigraph:

If you change any of these settings in a rule that's currently in use, the change resets the rule's rate limiting counts. This can pause the rule's rate limiting activities for up to a minute.

You can specify individual aggregation keys, like IP address or HTTP method. You can also specify aggregation key combinations, like IP address and HTTP method, or HTTP method, query argument, and cookie.

Each unique set of values for the aggregation keys that you specify is a separate aggregation instance, with the value from each key contributing to the aggregation instance definition.

For example, assume the rule evaluates web requests with the following IP address and HTTP method values:

  • IP address 10.1.1.1, HTTP method POST

  • IP address 10.1.1.1, HTTP method GET

  • IP address 127.0.0.0, HTTP method POST

  • IP address 10.1.1.1, HTTP method GET

The rule would create different aggregation instances according to your aggregation criteria, for example:

  • If the aggregation criteria is just the IP address, then each individual address is an aggregation instance, and AWS WAF counts requests separately for each. The aggregation instances and request counts for our example would be the following:

  • IP address 10.1.1.1: count 3

  • IP address 127.0.0.0: count 1

  • If the aggregation criteria is HTTP method, then each individual HTTP method is an aggregation instance. The aggregation instances and request counts for our example would be the following:

  • HTTP method POST: count 2

  • HTTP method GET: count 2

  • If the aggregation criteria is IP address and HTTP method, then each IP address and each HTTP method would contribute to the combined aggregation instance. The aggregation instances and request counts for our example would be the following:

  • IP address 10.1.1.1, HTTP method POST: count 1

  • IP address 10.1.1.1, HTTP method GET: count 2

  • IP address 127.0.0.0, HTTP method POST: count 1

For any n-tuple of aggregation keys, each unique combination of values for the keys defines a separate aggregation instance, which AWS WAF counts and rate-limits individually.

You can optionally nest another statement inside the rate-based statement, to narrow the scope of the rule so that it only counts and rate limits requests that match the nested statement. You can use this nested scope-down statement in conjunction with your aggregation key specifications or you can just count and rate limit all requests that match the scope-down statement, without additional aggregation. When you choose to just manage all requests that match a scope-down statement, the aggregation instance is singular for the rule.

You cannot nest a RateBasedStatement inside another statement, for example inside a NotStatement or OrStatement . You can define a RateBasedStatement inside a web ACL and inside a rule group.

For additional information about the options, see Rate limiting web requests using rate-based rules in the AWS WAF Developer Guide .

If you only aggregate on the individual IP address or forwarded IP address, you can retrieve the list of IP addresses that AWS WAF is currently rate limiting for a rule through the API call GetRateBasedStatementManagedKeys . This option is not available for other aggregation configurations.

AWS WAF tracks and manages web requests separately for each instance of a rate-based rule that you use. For example, if you provide the same rate-based rule settings in two web ACLs, each of the two rule statements represents a separate instance of the rate-based rule and gets its own tracking and management by AWS WAF . If you define a rate-based rule inside a rule group, and then use that rule group in multiple places, each use creates a separate instance of the rate-based rule that gets its own tracking and management by AWS WAF .

Parameters:
  • aggregate_key_type (str) – Setting that indicates how to aggregate the request counts. .. epigraph:: Web requests that are missing any of the components specified in the aggregation keys are omitted from the rate-based rule evaluation and handling. - CONSTANT - Count and limit the requests that match the rate-based rule’s scope-down statement. With this option, the counted requests aren’t further aggregated. The scope-down statement is the only specification used. When the count of all requests that satisfy the scope-down statement goes over the limit, AWS WAF applies the rule action to all requests that satisfy the scope-down statement. With this option, you must configure the ScopeDownStatement property. - CUSTOM_KEYS - Aggregate the request counts using one or more web request components as the aggregate keys. With this option, you must specify the aggregate keys in the CustomKeys property. To aggregate on only the IP address or only the forwarded IP address, don’t use custom keys. Instead, set the aggregate key type to IP or FORWARDED_IP . - FORWARDED_IP - Aggregate the request counts on the first IP address in an HTTP header. With this option, you must specify the header to use in the ForwardedIPConfig property. To aggregate on a combination of the forwarded IP address with other aggregate keys, use CUSTOM_KEYS . - IP - Aggregate the request counts on the IP address from the web request origin. To aggregate on a combination of the IP address with other aggregate keys, use CUSTOM_KEYS .

  • limit (Union[int, float]) – The limit on requests per 5-minute period for a single aggregation instance for the rate-based rule. If the rate-based statement includes a ScopeDownStatement , this limit is applied only to the requests that match the statement. Examples: - If you aggregate on just the IP address, this is the limit on requests from any single IP address. - If you aggregate on the HTTP method and the query argument name “city”, then this is the limit on requests for any single method, city pair.

  • custom_keys (Union[IResolvable, Sequence[Union[IResolvable, RateBasedStatementCustomKeyProperty, Dict[str, Any]]], None]) – Specifies the aggregate keys to use in a rate-base rule.

  • evaluation_window_sec (Union[int, float, None]) – The amount of time, in seconds, that AWS WAF should include in its request counts, looking back from the current time. For example, for a setting of 120, when AWS WAF checks the rate, it counts the requests for the 2 minutes immediately preceding the current time. Valid settings are 60, 120, 300, and 600. This setting doesn’t determine how often AWS WAF checks the rate, but how far back it looks each time it checks. AWS WAF checks the rate about every 10 seconds. Default: 300 (5 minutes)

  • forwarded_ip_config (Union[IResolvable, ForwardedIPConfigurationProperty, Dict[str, Any], None]) – The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that’s reported by the web request origin. Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name. .. epigraph:: If the specified header isn’t present in the request, AWS WAF doesn’t apply the rule to the web request at all. This is required if you specify a forwarded IP in the rule’s aggregate key settings.

  • scope_down_statement (Union[IResolvable, StatementProperty, Dict[str, Any], None]) – An optional nested statement that narrows the scope of the web requests that are evaluated and managed by the rate-based statement. When you use a scope-down statement, the rate-based rule only tracks and rate limits requests that match the scope-down statement. You can use any nestable Statement in the scope-down statement, and you can nest statements at any level, the same as you can for a rule statement.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratebasedstatement.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any
# all_query_arguments: Any
# forwarded_ip: Any
# http_method: Any
# ip: Any
# method: Any
# query_string: Any
# rate_based_statement_property_: wafv2.CfnRuleGroup.RateBasedStatementProperty
# single_header: Any
# single_query_argument: Any
# statement_property_: wafv2.CfnRuleGroup.StatementProperty
# uri_path: Any

rate_based_statement_property = wafv2.CfnRuleGroup.RateBasedStatementProperty(
    aggregate_key_type="aggregateKeyType",
    limit=123,

    # the properties below are optional
    custom_keys=[wafv2.CfnRuleGroup.RateBasedStatementCustomKeyProperty(
        cookie=wafv2.CfnRuleGroup.RateLimitCookieProperty(
            name="name",
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        forwarded_ip=forwarded_ip,
        header=wafv2.CfnRuleGroup.RateLimitHeaderProperty(
            name="name",
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        http_method=http_method,
        ip=ip,
        label_namespace=wafv2.CfnRuleGroup.RateLimitLabelNamespaceProperty(
            namespace="namespace"
        ),
        query_argument=wafv2.CfnRuleGroup.RateLimitQueryArgumentProperty(
            name="name",
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        query_string=wafv2.CfnRuleGroup.RateLimitQueryStringProperty(
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        uri_path=wafv2.CfnRuleGroup.RateLimitUriPathProperty(
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        )
    )],
    evaluation_window_sec=123,
    forwarded_ip_config=wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty(
        fallback_behavior="fallbackBehavior",
        header_name="headerName"
    ),
    scope_down_statement=wafv2.CfnRuleGroup.StatementProperty(
        and_statement=wafv2.CfnRuleGroup.AndStatementProperty(
            statements=[statement_property_]
        ),
        byte_match_statement=wafv2.CfnRuleGroup.ByteMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            positional_constraint="positionalConstraint",
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )],

            # the properties below are optional
            search_string="searchString",
            search_string_base64="searchStringBase64"
        ),
        geo_match_statement=wafv2.CfnRuleGroup.GeoMatchStatementProperty(
            country_codes=["countryCodes"],
            forwarded_ip_config=wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty(
                fallback_behavior="fallbackBehavior",
                header_name="headerName"
            )
        ),
        ip_set_reference_statement={
            "arn": "arn",

            # the properties below are optional
            "ip_set_forwarded_ip_config": {
                "fallback_behavior": "fallbackBehavior",
                "header_name": "headerName",
                "position": "position"
            }
        },
        label_match_statement=wafv2.CfnRuleGroup.LabelMatchStatementProperty(
            key="key",
            scope="scope"
        ),
        not_statement=wafv2.CfnRuleGroup.NotStatementProperty(
            statement=statement_property_
        ),
        or_statement=wafv2.CfnRuleGroup.OrStatementProperty(
            statements=[statement_property_]
        ),
        rate_based_statement=rate_based_statement_property_,
        regex_match_statement=wafv2.CfnRuleGroup.RegexMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            regex_string="regexString",
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        regex_pattern_set_reference_statement=wafv2.CfnRuleGroup.RegexPatternSetReferenceStatementProperty(
            arn="arn",
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        size_constraint_statement=wafv2.CfnRuleGroup.SizeConstraintStatementProperty(
            comparison_operator="comparisonOperator",
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            size=123,
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        sqli_match_statement=wafv2.CfnRuleGroup.SqliMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )],

            # the properties below are optional
            sensitivity_level="sensitivityLevel"
        ),
        xss_match_statement=wafv2.CfnRuleGroup.XssMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        )
    )
)

Attributes

aggregate_key_type

Setting that indicates how to aggregate the request counts.

Web requests that are missing any of the components specified in the aggregation keys are omitted from the rate-based rule evaluation and handling.

  • CONSTANT - Count and limit the requests that match the rate-based rule’s scope-down statement. With this option, the counted requests aren’t further aggregated. The scope-down statement is the only specification used. When the count of all requests that satisfy the scope-down statement goes over the limit, AWS WAF applies the rule action to all requests that satisfy the scope-down statement.

With this option, you must configure the ScopeDownStatement property.

  • CUSTOM_KEYS - Aggregate the request counts using one or more web request components as the aggregate keys.

With this option, you must specify the aggregate keys in the CustomKeys property.

To aggregate on only the IP address or only the forwarded IP address, don’t use custom keys. Instead, set the aggregate key type to IP or FORWARDED_IP .

  • FORWARDED_IP - Aggregate the request counts on the first IP address in an HTTP header.

With this option, you must specify the header to use in the ForwardedIPConfig property.

To aggregate on a combination of the forwarded IP address with other aggregate keys, use CUSTOM_KEYS .

  • IP - Aggregate the request counts on the IP address from the web request origin.

To aggregate on a combination of the IP address with other aggregate keys, use CUSTOM_KEYS .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratebasedstatement.html#cfn-wafv2-rulegroup-ratebasedstatement-aggregatekeytype

custom_keys

Specifies the aggregate keys to use in a rate-base rule.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratebasedstatement.html#cfn-wafv2-rulegroup-ratebasedstatement-customkeys

evaluation_window_sec

The amount of time, in seconds, that AWS WAF should include in its request counts, looking back from the current time.

For example, for a setting of 120, when AWS WAF checks the rate, it counts the requests for the 2 minutes immediately preceding the current time. Valid settings are 60, 120, 300, and 600.

This setting doesn’t determine how often AWS WAF checks the rate, but how far back it looks each time it checks. AWS WAF checks the rate about every 10 seconds.

Default: 300 (5 minutes)

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratebasedstatement.html#cfn-wafv2-rulegroup-ratebasedstatement-evaluationwindowsec

forwarded_ip_config

The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that’s reported by the web request origin.

Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name. .. epigraph:

If the specified header isn't present in the request, AWS WAF doesn't apply the rule to the web request at all.

This is required if you specify a forwarded IP in the rule’s aggregate key settings.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratebasedstatement.html#cfn-wafv2-rulegroup-ratebasedstatement-forwardedipconfig

limit

The limit on requests per 5-minute period for a single aggregation instance for the rate-based rule.

If the rate-based statement includes a ScopeDownStatement , this limit is applied only to the requests that match the statement.

Examples:

  • If you aggregate on just the IP address, this is the limit on requests from any single IP address.

  • If you aggregate on the HTTP method and the query argument name “city”, then this is the limit on requests for any single method, city pair.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratebasedstatement.html#cfn-wafv2-rulegroup-ratebasedstatement-limit

scope_down_statement

An optional nested statement that narrows the scope of the web requests that are evaluated and managed by the rate-based statement.

When you use a scope-down statement, the rate-based rule only tracks and rate limits requests that match the scope-down statement. You can use any nestable Statement in the scope-down statement, and you can nest statements at any level, the same as you can for a rule statement.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratebasedstatement.html#cfn-wafv2-rulegroup-ratebasedstatement-scopedownstatement

RateLimitCookieProperty

class CfnRuleGroup.RateLimitCookieProperty(*, name, text_transformations)

Bases: object

Specifies a cookie as an aggregate key for a rate-based rule.

Each distinct value in the cookie contributes to the aggregation instance. If you use a single cookie as your custom key, then each value fully defines an aggregation instance.

Parameters:
  • name (str) – The name of the cookie to use.

  • text_transformations (Union[IResolvable, Sequence[Union[IResolvable, TextTransformationProperty, Dict[str, Any]]]]) – Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection. Text transformations are used in rule match statements, to transform the FieldToMatch request component before inspecting it, and they’re used in rate-based rule statements, to transform request components before using them as custom aggregation keys. If you specify one or more transformations to apply, AWS WAF performs all transformations on the specified content, starting from the lowest priority setting, and then uses the transformed component contents.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratelimitcookie.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

rate_limit_cookie_property = wafv2.CfnRuleGroup.RateLimitCookieProperty(
    name="name",
    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
        priority=123,
        type="type"
    )]
)

Attributes

name

The name of the cookie to use.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratelimitcookie.html#cfn-wafv2-rulegroup-ratelimitcookie-name

text_transformations

Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection.

Text transformations are used in rule match statements, to transform the FieldToMatch request component before inspecting it, and they’re used in rate-based rule statements, to transform request components before using them as custom aggregation keys. If you specify one or more transformations to apply, AWS WAF performs all transformations on the specified content, starting from the lowest priority setting, and then uses the transformed component contents.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratelimitcookie.html#cfn-wafv2-rulegroup-ratelimitcookie-texttransformations

RateLimitHeaderProperty

class CfnRuleGroup.RateLimitHeaderProperty(*, name, text_transformations)

Bases: object

Specifies a header as an aggregate key for a rate-based rule.

Each distinct value in the header contributes to the aggregation instance. If you use a single header as your custom key, then each value fully defines an aggregation instance.

Parameters:
  • name (str) – The name of the header to use.

  • text_transformations (Union[IResolvable, Sequence[Union[IResolvable, TextTransformationProperty, Dict[str, Any]]]]) – Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection. Text transformations are used in rule match statements, to transform the FieldToMatch request component before inspecting it, and they’re used in rate-based rule statements, to transform request components before using them as custom aggregation keys. If you specify one or more transformations to apply, AWS WAF performs all transformations on the specified content, starting from the lowest priority setting, and then uses the transformed component contents.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratelimitheader.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

rate_limit_header_property = wafv2.CfnRuleGroup.RateLimitHeaderProperty(
    name="name",
    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
        priority=123,
        type="type"
    )]
)

Attributes

name

The name of the header to use.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratelimitheader.html#cfn-wafv2-rulegroup-ratelimitheader-name

text_transformations

Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection.

Text transformations are used in rule match statements, to transform the FieldToMatch request component before inspecting it, and they’re used in rate-based rule statements, to transform request components before using them as custom aggregation keys. If you specify one or more transformations to apply, AWS WAF performs all transformations on the specified content, starting from the lowest priority setting, and then uses the transformed component contents.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratelimitheader.html#cfn-wafv2-rulegroup-ratelimitheader-texttransformations

RateLimitLabelNamespaceProperty

class CfnRuleGroup.RateLimitLabelNamespaceProperty(*, namespace)

Bases: object

Specifies a label namespace to use as an aggregate key for a rate-based rule.

Each distinct fully qualified label name that has the specified label namespace contributes to the aggregation instance. If you use just one label namespace as your custom key, then each label name fully defines an aggregation instance.

This uses only labels that have been added to the request by rules that are evaluated before this rate-based rule in the web ACL.

For information about label namespaces and names, see Label syntax and naming requirements in the AWS WAF Developer Guide .

Parameters:

namespace (str) – The namespace to use for aggregation.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratelimitlabelnamespace.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

rate_limit_label_namespace_property = wafv2.CfnRuleGroup.RateLimitLabelNamespaceProperty(
    namespace="namespace"
)

Attributes

namespace

The namespace to use for aggregation.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratelimitlabelnamespace.html#cfn-wafv2-rulegroup-ratelimitlabelnamespace-namespace

RateLimitQueryArgumentProperty

class CfnRuleGroup.RateLimitQueryArgumentProperty(*, name, text_transformations)

Bases: object

Specifies a query argument in the request as an aggregate key for a rate-based rule.

Each distinct value for the named query argument contributes to the aggregation instance. If you use a single query argument as your custom key, then each value fully defines an aggregation instance.

Parameters:
  • name (str) – The name of the query argument to use.

  • text_transformations (Union[IResolvable, Sequence[Union[IResolvable, TextTransformationProperty, Dict[str, Any]]]]) – Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection. Text transformations are used in rule match statements, to transform the FieldToMatch request component before inspecting it, and they’re used in rate-based rule statements, to transform request components before using them as custom aggregation keys. If you specify one or more transformations to apply, AWS WAF performs all transformations on the specified content, starting from the lowest priority setting, and then uses the transformed component contents.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratelimitqueryargument.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

rate_limit_query_argument_property = wafv2.CfnRuleGroup.RateLimitQueryArgumentProperty(
    name="name",
    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
        priority=123,
        type="type"
    )]
)

Attributes

name

The name of the query argument to use.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratelimitqueryargument.html#cfn-wafv2-rulegroup-ratelimitqueryargument-name

text_transformations

Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection.

Text transformations are used in rule match statements, to transform the FieldToMatch request component before inspecting it, and they’re used in rate-based rule statements, to transform request components before using them as custom aggregation keys. If you specify one or more transformations to apply, AWS WAF performs all transformations on the specified content, starting from the lowest priority setting, and then uses the transformed component contents.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratelimitqueryargument.html#cfn-wafv2-rulegroup-ratelimitqueryargument-texttransformations

RateLimitQueryStringProperty

class CfnRuleGroup.RateLimitQueryStringProperty(*, text_transformations)

Bases: object

Specifies the request’s query string as an aggregate key for a rate-based rule.

Each distinct string contributes to the aggregation instance. If you use just the query string as your custom key, then each string fully defines an aggregation instance.

Parameters:

text_transformations (Union[IResolvable, Sequence[Union[IResolvable, TextTransformationProperty, Dict[str, Any]]]]) – Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection. Text transformations are used in rule match statements, to transform the FieldToMatch request component before inspecting it, and they’re used in rate-based rule statements, to transform request components before using them as custom aggregation keys. If you specify one or more transformations to apply, AWS WAF performs all transformations on the specified content, starting from the lowest priority setting, and then uses the transformed component contents.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratelimitquerystring.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

rate_limit_query_string_property = wafv2.CfnRuleGroup.RateLimitQueryStringProperty(
    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
        priority=123,
        type="type"
    )]
)

Attributes

text_transformations

Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection.

Text transformations are used in rule match statements, to transform the FieldToMatch request component before inspecting it, and they’re used in rate-based rule statements, to transform request components before using them as custom aggregation keys. If you specify one or more transformations to apply, AWS WAF performs all transformations on the specified content, starting from the lowest priority setting, and then uses the transformed component contents.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratelimitquerystring.html#cfn-wafv2-rulegroup-ratelimitquerystring-texttransformations

RateLimitUriPathProperty

class CfnRuleGroup.RateLimitUriPathProperty(*, text_transformations)

Bases: object

Specifies the request’s URI path as an aggregate key for a rate-based rule.

Each distinct URI path contributes to the aggregation instance. If you use just the URI path as your custom key, then each URI path fully defines an aggregation instance.

Parameters:

text_transformations (Union[IResolvable, Sequence[Union[IResolvable, TextTransformationProperty, Dict[str, Any]]]]) – Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection. Text transformations are used in rule match statements, to transform the FieldToMatch request component before inspecting it, and they’re used in rate-based rule statements, to transform request components before using them as custom aggregation keys. If you specify one or more transformations to apply, AWS WAF performs all transformations on the specified content, starting from the lowest priority setting, and then uses the transformed component contents.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratelimituripath.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

rate_limit_uri_path_property = wafv2.CfnRuleGroup.RateLimitUriPathProperty(
    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
        priority=123,
        type="type"
    )]
)

Attributes

text_transformations

Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection.

Text transformations are used in rule match statements, to transform the FieldToMatch request component before inspecting it, and they’re used in rate-based rule statements, to transform request components before using them as custom aggregation keys. If you specify one or more transformations to apply, AWS WAF performs all transformations on the specified content, starting from the lowest priority setting, and then uses the transformed component contents.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ratelimituripath.html#cfn-wafv2-rulegroup-ratelimituripath-texttransformations

RegexMatchStatementProperty

class CfnRuleGroup.RegexMatchStatementProperty(*, field_to_match, regex_string, text_transformations)

Bases: object

A rule statement used to search web request components for a match against a single regular expression.

Parameters:
  • field_to_match (Union[IResolvable, FieldToMatchProperty, Dict[str, Any]]) – The part of the web request that you want AWS WAF to inspect.

  • regex_string (str) – The string representing the regular expression.

  • text_transformations (Union[IResolvable, Sequence[Union[IResolvable, TextTransformationProperty, Dict[str, Any]]]]) – Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection. If you specify one or more transformations in a rule statement, AWS WAF performs all transformations on the content of the request component identified by FieldToMatch , starting from the lowest priority setting, before inspecting the content for a match.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-regexmatchstatement.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any
# all_query_arguments: Any
# method: Any
# query_string: Any
# single_header: Any
# single_query_argument: Any
# uri_path: Any

regex_match_statement_property = wafv2.CfnRuleGroup.RegexMatchStatementProperty(
    field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
        all_query_arguments=all_query_arguments,
        body=wafv2.CfnRuleGroup.BodyProperty(
            oversize_handling="oversizeHandling"
        ),
        cookies=wafv2.CfnRuleGroup.CookiesProperty(
            match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                all=all,
                excluded_cookies=["excludedCookies"],
                included_cookies=["includedCookies"]
            ),
            match_scope="matchScope",
            oversize_handling="oversizeHandling"
        ),
        headers=wafv2.CfnRuleGroup.HeadersProperty(
            match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                all=all,
                excluded_headers=["excludedHeaders"],
                included_headers=["includedHeaders"]
            ),
            match_scope="matchScope",
            oversize_handling="oversizeHandling"
        ),
        ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
            fallback_behavior="fallbackBehavior"
        ),
        json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
            match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                all=all,
                included_paths=["includedPaths"]
            ),
            match_scope="matchScope",

            # the properties below are optional
            invalid_fallback_behavior="invalidFallbackBehavior",
            oversize_handling="oversizeHandling"
        ),
        method=method,
        query_string=query_string,
        single_header=single_header,
        single_query_argument=single_query_argument,
        uri_path=uri_path
    ),
    regex_string="regexString",
    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
        priority=123,
        type="type"
    )]
)

Attributes

field_to_match

The part of the web request that you want AWS WAF to inspect.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-regexmatchstatement.html#cfn-wafv2-rulegroup-regexmatchstatement-fieldtomatch

regex_string

The string representing the regular expression.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-regexmatchstatement.html#cfn-wafv2-rulegroup-regexmatchstatement-regexstring

text_transformations

Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection.

If you specify one or more transformations in a rule statement, AWS WAF performs all transformations on the content of the request component identified by FieldToMatch , starting from the lowest priority setting, before inspecting the content for a match.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-regexmatchstatement.html#cfn-wafv2-rulegroup-regexmatchstatement-texttransformations

RegexPatternSetReferenceStatementProperty

class CfnRuleGroup.RegexPatternSetReferenceStatementProperty(*, arn, field_to_match, text_transformations)

Bases: object

A rule statement used to search web request components for matches with regular expressions.

To use this, create a RegexPatternSet that specifies the expressions that you want to detect, then use the ARN of that set in this statement. A web request matches the pattern set rule statement if the request component matches any of the patterns in the set.

Each regex pattern set rule statement references a regex pattern set. You create and maintain the set independent of your rules. This allows you to use the single set in multiple rules. When you update the referenced set, AWS WAF automatically updates all rules that reference it.

Parameters:
  • arn (str) – The Amazon Resource Name (ARN) of the RegexPatternSet that this statement references.

  • field_to_match (Union[IResolvable, FieldToMatchProperty, Dict[str, Any]]) – The part of the web request that you want AWS WAF to inspect.

  • text_transformations (Union[IResolvable, Sequence[Union[IResolvable, TextTransformationProperty, Dict[str, Any]]]]) – Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection. If you specify one or more transformations in a rule statement, AWS WAF performs all transformations on the content of the request component identified by FieldToMatch , starting from the lowest priority setting, before inspecting the content for a match.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-regexpatternsetreferencestatement.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any
# all_query_arguments: Any
# method: Any
# query_string: Any
# single_header: Any
# single_query_argument: Any
# uri_path: Any

regex_pattern_set_reference_statement_property = wafv2.CfnRuleGroup.RegexPatternSetReferenceStatementProperty(
    arn="arn",
    field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
        all_query_arguments=all_query_arguments,
        body=wafv2.CfnRuleGroup.BodyProperty(
            oversize_handling="oversizeHandling"
        ),
        cookies=wafv2.CfnRuleGroup.CookiesProperty(
            match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                all=all,
                excluded_cookies=["excludedCookies"],
                included_cookies=["includedCookies"]
            ),
            match_scope="matchScope",
            oversize_handling="oversizeHandling"
        ),
        headers=wafv2.CfnRuleGroup.HeadersProperty(
            match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                all=all,
                excluded_headers=["excludedHeaders"],
                included_headers=["includedHeaders"]
            ),
            match_scope="matchScope",
            oversize_handling="oversizeHandling"
        ),
        ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
            fallback_behavior="fallbackBehavior"
        ),
        json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
            match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                all=all,
                included_paths=["includedPaths"]
            ),
            match_scope="matchScope",

            # the properties below are optional
            invalid_fallback_behavior="invalidFallbackBehavior",
            oversize_handling="oversizeHandling"
        ),
        method=method,
        query_string=query_string,
        single_header=single_header,
        single_query_argument=single_query_argument,
        uri_path=uri_path
    ),
    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
        priority=123,
        type="type"
    )]
)

Attributes

arn

The Amazon Resource Name (ARN) of the RegexPatternSet that this statement references.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-regexpatternsetreferencestatement.html#cfn-wafv2-rulegroup-regexpatternsetreferencestatement-arn

field_to_match

The part of the web request that you want AWS WAF to inspect.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-regexpatternsetreferencestatement.html#cfn-wafv2-rulegroup-regexpatternsetreferencestatement-fieldtomatch

text_transformations

Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection.

If you specify one or more transformations in a rule statement, AWS WAF performs all transformations on the content of the request component identified by FieldToMatch , starting from the lowest priority setting, before inspecting the content for a match.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-regexpatternsetreferencestatement.html#cfn-wafv2-rulegroup-regexpatternsetreferencestatement-texttransformations

RuleActionProperty

class CfnRuleGroup.RuleActionProperty(*, allow=None, block=None, captcha=None, challenge=None, count=None)

Bases: object

The action that AWS WAF should take on a web request when it matches a rule’s statement.

Settings at the web ACL level can override the rule action setting.

Parameters:
  • allow (Optional[Any]) – Instructs AWS WAF to allow the web request.

  • block (Optional[Any]) – Instructs AWS WAF to block the web request.

  • captcha (Optional[Any]) – Specifies that AWS WAF should run a CAPTCHA check against the request:. - If the request includes a valid, unexpired CAPTCHA token, AWS WAF allows the web request inspection to proceed to the next rule, similar to a CountAction . - If the request doesn’t include a valid, unexpired CAPTCHA token, AWS WAF discontinues the web ACL evaluation of the request and blocks it from going to its intended destination. AWS WAF generates a response that it sends back to the client, which includes the following: - The header x-amzn-waf-action with a value of captcha . - The HTTP status code 405 Method Not Allowed . - If the request contains an Accept header with a value of text/html , the response includes a CAPTCHA challenge. You can configure the expiration time in the CaptchaConfig ImmunityTimeProperty setting at the rule and web ACL level. The rule setting overrides the web ACL setting. This action option is available for rules. It isn’t available for web ACL default actions.

  • challenge (Optional[Any]) – Instructs AWS WAF to run a Challenge check against the web request.

  • count (Optional[Any]) – Instructs AWS WAF to count the web request and then continue evaluating the request using the remaining rules in the web ACL.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ruleaction.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# allow: Any
# block: Any
# captcha: Any
# challenge: Any
# count: Any

rule_action_property = wafv2.CfnRuleGroup.RuleActionProperty(
    allow=allow,
    block=block,
    captcha=captcha,
    challenge=challenge,
    count=count
)

Attributes

allow

Instructs AWS WAF to allow the web request.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ruleaction.html#cfn-wafv2-rulegroup-ruleaction-allow

block

Instructs AWS WAF to block the web request.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ruleaction.html#cfn-wafv2-rulegroup-ruleaction-block

captcha

.

  • If the request includes a valid, unexpired CAPTCHA token, AWS WAF allows the web request inspection to proceed to the next rule, similar to a CountAction .

  • If the request doesn’t include a valid, unexpired CAPTCHA token, AWS WAF discontinues the web ACL evaluation of the request and blocks it from going to its intended destination.

AWS WAF generates a response that it sends back to the client, which includes the following:

  • The header x-amzn-waf-action with a value of captcha .

  • The HTTP status code 405 Method Not Allowed .

  • If the request contains an Accept header with a value of text/html , the response includes a CAPTCHA challenge.

You can configure the expiration time in the CaptchaConfig ImmunityTimeProperty setting at the rule and web ACL level. The rule setting overrides the web ACL setting.

This action option is available for rules. It isn’t available for web ACL default actions.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ruleaction.html#cfn-wafv2-rulegroup-ruleaction-captcha

Type:

Specifies that AWS WAF should run a CAPTCHA check against the request

challenge

Instructs AWS WAF to run a Challenge check against the web request.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ruleaction.html#cfn-wafv2-rulegroup-ruleaction-challenge

count

Instructs AWS WAF to count the web request and then continue evaluating the request using the remaining rules in the web ACL.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-ruleaction.html#cfn-wafv2-rulegroup-ruleaction-count

RuleProperty

class CfnRuleGroup.RuleProperty(*, name, priority, statement, visibility_config, action=None, captcha_config=None, challenge_config=None, rule_labels=None)

Bases: object

A single rule, which you can use in a WebACL or RuleGroup to identify web requests that you want to manage in some way.

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.

Parameters:
  • name (str) – The name of the rule. If you change the name of a Rule after you create it and you want the rule’s metric name to reflect the change, update the metric name in the rule’s VisibilityConfig settings. AWS WAF doesn’t automatically update the metric name when you update the rule name.

  • priority (Union[int, float]) – If you define more than one Rule in a WebACL , AWS WAF evaluates each request against the Rules in order based on the value of Priority . AWS WAF processes rules with lower priority first. The priorities don’t need to be consecutive, but they must all be different.

  • statement (Union[IResolvable, StatementProperty, Dict[str, Any]]) – The AWS WAF processing statement for the rule, for example ByteMatchStatement or SizeConstraintStatement .

  • visibility_config (Union[IResolvable, VisibilityConfigProperty, Dict[str, Any]]) – Defines and enables Amazon CloudWatch metrics and web request sample collection. If you change the name of a Rule after you create it and you want the rule’s metric name to reflect the change, update the metric name as well. AWS WAF doesn’t automatically update the metric name.

  • action (Union[IResolvable, RuleActionProperty, Dict[str, Any], None]) – The action that AWS WAF should take on a web request when it matches the rule statement. Settings at the web ACL level can override the rule action setting.

  • captcha_config (Union[IResolvable, CaptchaConfigProperty, Dict[str, Any], None]) – Specifies how AWS WAF should handle CAPTCHA evaluations. If you don’t specify this, AWS WAF uses the CAPTCHA configuration that’s defined for the web ACL.

  • challenge_config (Union[IResolvable, ChallengeConfigProperty, Dict[str, Any], None]) – Specifies how AWS WAF should handle Challenge evaluations. If you don’t specify this, AWS WAF uses the challenge configuration that’s defined for the web ACL.

  • rule_labels (Union[IResolvable, Sequence[Union[IResolvable, LabelProperty, Dict[str, Any]]], None]) – Labels to apply to web requests that match the rule match statement. AWS WAF applies fully qualified labels to matching web requests. A fully qualified label is the concatenation of a label namespace and a rule label. The rule’s rule group or web ACL defines the label namespace. Rules that run after this rule in the web ACL can match against these labels using a LabelMatchStatement . For each label, provide a case-sensitive string containing optional namespaces and a label name, according to the following guidelines: - Separate each component of the label with a colon. - Each namespace or name can have up to 128 characters. - You can specify up to 5 namespaces in a label. - Don’t use the following reserved words in your label specification: aws , waf , managed , rulegroup , webacl , regexpatternset , or ipset . For example, myLabelName or nameSpace1:nameSpace2:myLabelName .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-rule.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any
# allow: Any
# all_query_arguments: Any
# block: Any
# captcha: Any
# challenge: Any
# count: Any
# forwarded_ip: Any
# http_method: Any
# ip: Any
# method: Any
# query_string: Any
# single_header: Any
# single_query_argument: Any
# statement_property_: wafv2.CfnRuleGroup.StatementProperty
# uri_path: Any

rule_property = wafv2.CfnRuleGroup.RuleProperty(
    name="name",
    priority=123,
    statement=wafv2.CfnRuleGroup.StatementProperty(
        and_statement=wafv2.CfnRuleGroup.AndStatementProperty(
            statements=[statement_property_]
        ),
        byte_match_statement=wafv2.CfnRuleGroup.ByteMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            positional_constraint="positionalConstraint",
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )],

            # the properties below are optional
            search_string="searchString",
            search_string_base64="searchStringBase64"
        ),
        geo_match_statement=wafv2.CfnRuleGroup.GeoMatchStatementProperty(
            country_codes=["countryCodes"],
            forwarded_ip_config=wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty(
                fallback_behavior="fallbackBehavior",
                header_name="headerName"
            )
        ),
        ip_set_reference_statement={
            "arn": "arn",

            # the properties below are optional
            "ip_set_forwarded_ip_config": {
                "fallback_behavior": "fallbackBehavior",
                "header_name": "headerName",
                "position": "position"
            }
        },
        label_match_statement=wafv2.CfnRuleGroup.LabelMatchStatementProperty(
            key="key",
            scope="scope"
        ),
        not_statement=wafv2.CfnRuleGroup.NotStatementProperty(
            statement=statement_property_
        ),
        or_statement=wafv2.CfnRuleGroup.OrStatementProperty(
            statements=[statement_property_]
        ),
        rate_based_statement=wafv2.CfnRuleGroup.RateBasedStatementProperty(
            aggregate_key_type="aggregateKeyType",
            limit=123,

            # the properties below are optional
            custom_keys=[wafv2.CfnRuleGroup.RateBasedStatementCustomKeyProperty(
                cookie=wafv2.CfnRuleGroup.RateLimitCookieProperty(
                    name="name",
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                ),
                forwarded_ip=forwarded_ip,
                header=wafv2.CfnRuleGroup.RateLimitHeaderProperty(
                    name="name",
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                ),
                http_method=http_method,
                ip=ip,
                label_namespace=wafv2.CfnRuleGroup.RateLimitLabelNamespaceProperty(
                    namespace="namespace"
                ),
                query_argument=wafv2.CfnRuleGroup.RateLimitQueryArgumentProperty(
                    name="name",
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                ),
                query_string=wafv2.CfnRuleGroup.RateLimitQueryStringProperty(
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                ),
                uri_path=wafv2.CfnRuleGroup.RateLimitUriPathProperty(
                    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                        priority=123,
                        type="type"
                    )]
                )
            )],
            evaluation_window_sec=123,
            forwarded_ip_config=wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty(
                fallback_behavior="fallbackBehavior",
                header_name="headerName"
            ),
            scope_down_statement=statement_property_
        ),
        regex_match_statement=wafv2.CfnRuleGroup.RegexMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            regex_string="regexString",
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        regex_pattern_set_reference_statement=wafv2.CfnRuleGroup.RegexPatternSetReferenceStatementProperty(
            arn="arn",
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        size_constraint_statement=wafv2.CfnRuleGroup.SizeConstraintStatementProperty(
            comparison_operator="comparisonOperator",
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            size=123,
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        ),
        sqli_match_statement=wafv2.CfnRuleGroup.SqliMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )],

            # the properties below are optional
            sensitivity_level="sensitivityLevel"
        ),
        xss_match_statement=wafv2.CfnRuleGroup.XssMatchStatementProperty(
            field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
                all_query_arguments=all_query_arguments,
                body=wafv2.CfnRuleGroup.BodyProperty(
                    oversize_handling="oversizeHandling"
                ),
                cookies=wafv2.CfnRuleGroup.CookiesProperty(
                    match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                        all=all,
                        excluded_cookies=["excludedCookies"],
                        included_cookies=["includedCookies"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                headers=wafv2.CfnRuleGroup.HeadersProperty(
                    match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                        all=all,
                        excluded_headers=["excludedHeaders"],
                        included_headers=["includedHeaders"]
                    ),
                    match_scope="matchScope",
                    oversize_handling="oversizeHandling"
                ),
                ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                    fallback_behavior="fallbackBehavior"
                ),
                json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                    match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                        all=all,
                        included_paths=["includedPaths"]
                    ),
                    match_scope="matchScope",

                    # the properties below are optional
                    invalid_fallback_behavior="invalidFallbackBehavior",
                    oversize_handling="oversizeHandling"
                ),
                method=method,
                query_string=query_string,
                single_header=single_header,
                single_query_argument=single_query_argument,
                uri_path=uri_path
            ),
            text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                priority=123,
                type="type"
            )]
        )
    ),
    visibility_config=wafv2.CfnRuleGroup.VisibilityConfigProperty(
        cloud_watch_metrics_enabled=False,
        metric_name="metricName",
        sampled_requests_enabled=False
    ),

    # the properties below are optional
    action=wafv2.CfnRuleGroup.RuleActionProperty(
        allow=allow,
        block=block,
        captcha=captcha,
        challenge=challenge,
        count=count
    ),
    captcha_config=wafv2.CfnRuleGroup.CaptchaConfigProperty(
        immunity_time_property=wafv2.CfnRuleGroup.ImmunityTimePropertyProperty(
            immunity_time=123
        )
    ),
    challenge_config=wafv2.CfnRuleGroup.ChallengeConfigProperty(
        immunity_time_property=wafv2.CfnRuleGroup.ImmunityTimePropertyProperty(
            immunity_time=123
        )
    ),
    rule_labels=[wafv2.CfnRuleGroup.LabelProperty(
        name="name"
    )]
)

Attributes

action

The action that AWS WAF should take on a web request when it matches the rule statement.

Settings at the web ACL level can override the rule action setting.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-rule.html#cfn-wafv2-rulegroup-rule-action

captcha_config

Specifies how AWS WAF should handle CAPTCHA evaluations.

If you don’t specify this, AWS WAF uses the CAPTCHA configuration that’s defined for the web ACL.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-rule.html#cfn-wafv2-rulegroup-rule-captchaconfig

challenge_config

Specifies how AWS WAF should handle Challenge evaluations.

If you don’t specify this, AWS WAF uses the challenge configuration that’s defined for the web ACL.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-rule.html#cfn-wafv2-rulegroup-rule-challengeconfig

name

The name of the rule.

If you change the name of a Rule after you create it and you want the rule’s metric name to reflect the change, update the metric name in the rule’s VisibilityConfig settings. AWS WAF doesn’t automatically update the metric name when you update the rule name.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-rule.html#cfn-wafv2-rulegroup-rule-name

priority

If you define more than one Rule in a WebACL , AWS WAF evaluates each request against the Rules in order based on the value of Priority .

AWS WAF processes rules with lower priority first. The priorities don’t need to be consecutive, but they must all be different.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-rule.html#cfn-wafv2-rulegroup-rule-priority

rule_labels

Labels to apply to web requests that match the rule match statement.

AWS WAF applies fully qualified labels to matching web requests. A fully qualified label is the concatenation of a label namespace and a rule label. The rule’s rule group or web ACL defines the label namespace.

Rules that run after this rule in the web ACL can match against these labels using a LabelMatchStatement .

For each label, provide a case-sensitive string containing optional namespaces and a label name, according to the following guidelines:

  • Separate each component of the label with a colon.

  • Each namespace or name can have up to 128 characters.

  • You can specify up to 5 namespaces in a label.

  • Don’t use the following reserved words in your label specification: aws , waf , managed , rulegroup , webacl , regexpatternset , or ipset .

For example, myLabelName or nameSpace1:nameSpace2:myLabelName .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-rule.html#cfn-wafv2-rulegroup-rule-rulelabels

statement

The AWS WAF processing statement for the rule, for example ByteMatchStatement or SizeConstraintStatement .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-rule.html#cfn-wafv2-rulegroup-rule-statement

visibility_config

Defines and enables Amazon CloudWatch metrics and web request sample collection.

If you change the name of a Rule after you create it and you want the rule’s metric name to reflect the change, update the metric name as well. AWS WAF doesn’t automatically update the metric name.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-rule.html#cfn-wafv2-rulegroup-rule-visibilityconfig

SingleHeaderProperty

class CfnRuleGroup.SingleHeaderProperty(*, name)

Bases: object

Inspect one of the headers in the web request, identified by name, for example, User-Agent or Referer .

The name isn’t case sensitive.

You can filter and inspect all headers with the FieldToMatch setting Headers .

This is used to indicate the web request component to inspect, in the FieldToMatch specification.

Example JSON: "SingleHeader": { "Name": "haystack" }

Parameters:

name (str) – The name of the query header to inspect.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-singleheader.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

single_header_property = wafv2.CfnRuleGroup.SingleHeaderProperty(
    name="name"
)

Attributes

name

The name of the query header to inspect.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-singleheader.html#cfn-wafv2-rulegroup-singleheader-name

SingleQueryArgumentProperty

class CfnRuleGroup.SingleQueryArgumentProperty(*, name)

Bases: object

Inspect one query argument in the web request, identified by name, for example UserName or SalesRegion .

The name isn’t case sensitive.

This is used to indicate the web request component to inspect, in the FieldToMatch specification.

Example JSON: "SingleQueryArgument": { "Name": "myArgument" }

Parameters:

name (str) – The name of the query argument to inspect.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-singlequeryargument.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

single_query_argument_property = wafv2.CfnRuleGroup.SingleQueryArgumentProperty(
    name="name"
)

Attributes

name

The name of the query argument to inspect.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-singlequeryargument.html#cfn-wafv2-rulegroup-singlequeryargument-name

SizeConstraintStatementProperty

class CfnRuleGroup.SizeConstraintStatementProperty(*, comparison_operator, field_to_match, size, text_transformations)

Bases: object

A rule statement that compares a number of bytes against the size of a request component, using a comparison operator, such as greater than (>) or less than (<).

For example, you can use a size constraint statement to look for query strings that are longer than 100 bytes.

If you configure AWS WAF to inspect the request body, AWS WAF inspects only the number of bytes in the body up to the limit for the web ACL and protected resource type. If you know that the request body for your web requests should never exceed the inspection limit, you can use a size constraint statement to block requests that have a larger request body size. For more information about the inspection limits, see Body and JsonBody settings for the FieldToMatch data type.

If you choose URI for the value of Part of the request to filter on, the slash (/) in the URI counts as one character. For example, the URI /logo.jpg is nine characters long.

Parameters:
  • comparison_operator (str) – The operator to use to compare the request part to the size setting.

  • field_to_match (Union[IResolvable, FieldToMatchProperty, Dict[str, Any]]) – The part of the web request that you want AWS WAF to inspect.

  • size (Union[int, float]) – The size, in byte, to compare to the request part, after any transformations.

  • text_transformations (Union[IResolvable, Sequence[Union[IResolvable, TextTransformationProperty, Dict[str, Any]]]]) – Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection. If you specify one or more transformations in a rule statement, AWS WAF performs all transformations on the content of the request component identified by FieldToMatch , starting from the lowest priority setting, before inspecting the content for a match.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-sizeconstraintstatement.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any
# all_query_arguments: Any
# method: Any
# query_string: Any
# single_header: Any
# single_query_argument: Any
# uri_path: Any

size_constraint_statement_property = wafv2.CfnRuleGroup.SizeConstraintStatementProperty(
    comparison_operator="comparisonOperator",
    field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
        all_query_arguments=all_query_arguments,
        body=wafv2.CfnRuleGroup.BodyProperty(
            oversize_handling="oversizeHandling"
        ),
        cookies=wafv2.CfnRuleGroup.CookiesProperty(
            match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                all=all,
                excluded_cookies=["excludedCookies"],
                included_cookies=["includedCookies"]
            ),
            match_scope="matchScope",
            oversize_handling="oversizeHandling"
        ),
        headers=wafv2.CfnRuleGroup.HeadersProperty(
            match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                all=all,
                excluded_headers=["excludedHeaders"],
                included_headers=["includedHeaders"]
            ),
            match_scope="matchScope",
            oversize_handling="oversizeHandling"
        ),
        ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
            fallback_behavior="fallbackBehavior"
        ),
        json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
            match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                all=all,
                included_paths=["includedPaths"]
            ),
            match_scope="matchScope",

            # the properties below are optional
            invalid_fallback_behavior="invalidFallbackBehavior",
            oversize_handling="oversizeHandling"
        ),
        method=method,
        query_string=query_string,
        single_header=single_header,
        single_query_argument=single_query_argument,
        uri_path=uri_path
    ),
    size=123,
    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
        priority=123,
        type="type"
    )]
)

Attributes

comparison_operator

The operator to use to compare the request part to the size setting.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-sizeconstraintstatement.html#cfn-wafv2-rulegroup-sizeconstraintstatement-comparisonoperator

field_to_match

The part of the web request that you want AWS WAF to inspect.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-sizeconstraintstatement.html#cfn-wafv2-rulegroup-sizeconstraintstatement-fieldtomatch

size

The size, in byte, to compare to the request part, after any transformations.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-sizeconstraintstatement.html#cfn-wafv2-rulegroup-sizeconstraintstatement-size

text_transformations

Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection.

If you specify one or more transformations in a rule statement, AWS WAF performs all transformations on the content of the request component identified by FieldToMatch , starting from the lowest priority setting, before inspecting the content for a match.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-sizeconstraintstatement.html#cfn-wafv2-rulegroup-sizeconstraintstatement-texttransformations

SqliMatchStatementProperty

class CfnRuleGroup.SqliMatchStatementProperty(*, field_to_match, text_transformations, sensitivity_level=None)

Bases: object

A rule statement that inspects for malicious SQL code.

Attackers insert malicious SQL code into web requests to do things like modify your database or extract data from it.

Parameters:
  • field_to_match (Union[IResolvable, FieldToMatchProperty, Dict[str, Any]]) – The part of the web request that you want AWS WAF to inspect.

  • text_transformations (Union[IResolvable, Sequence[Union[IResolvable, TextTransformationProperty, Dict[str, Any]]]]) – Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection. If you specify one or more transformations in a rule statement, AWS WAF performs all transformations on the content of the request component identified by FieldToMatch , starting from the lowest priority setting, before inspecting the content for a match.

  • sensitivity_level (Optional[str]) – The sensitivity that you want AWS WAF to use to inspect for SQL injection attacks. HIGH detects more attacks, but might generate more false positives, especially if your web requests frequently contain unusual strings. For information about identifying and mitigating false positives, see Testing and tuning in the AWS WAF Developer Guide . LOW is generally a better choice for resources that already have other protections against SQL injection attacks or that have a low tolerance for false positives. Default: LOW

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-sqlimatchstatement.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any
# all_query_arguments: Any
# method: Any
# query_string: Any
# single_header: Any
# single_query_argument: Any
# uri_path: Any

sqli_match_statement_property = wafv2.CfnRuleGroup.SqliMatchStatementProperty(
    field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
        all_query_arguments=all_query_arguments,
        body=wafv2.CfnRuleGroup.BodyProperty(
            oversize_handling="oversizeHandling"
        ),
        cookies=wafv2.CfnRuleGroup.CookiesProperty(
            match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                all=all,
                excluded_cookies=["excludedCookies"],
                included_cookies=["includedCookies"]
            ),
            match_scope="matchScope",
            oversize_handling="oversizeHandling"
        ),
        headers=wafv2.CfnRuleGroup.HeadersProperty(
            match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                all=all,
                excluded_headers=["excludedHeaders"],
                included_headers=["includedHeaders"]
            ),
            match_scope="matchScope",
            oversize_handling="oversizeHandling"
        ),
        ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
            fallback_behavior="fallbackBehavior"
        ),
        json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
            match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                all=all,
                included_paths=["includedPaths"]
            ),
            match_scope="matchScope",

            # the properties below are optional
            invalid_fallback_behavior="invalidFallbackBehavior",
            oversize_handling="oversizeHandling"
        ),
        method=method,
        query_string=query_string,
        single_header=single_header,
        single_query_argument=single_query_argument,
        uri_path=uri_path
    ),
    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
        priority=123,
        type="type"
    )],

    # the properties below are optional
    sensitivity_level="sensitivityLevel"
)

Attributes

field_to_match

The part of the web request that you want AWS WAF to inspect.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-sqlimatchstatement.html#cfn-wafv2-rulegroup-sqlimatchstatement-fieldtomatch

sensitivity_level

The sensitivity that you want AWS WAF to use to inspect for SQL injection attacks.

HIGH detects more attacks, but might generate more false positives, especially if your web requests frequently contain unusual strings. For information about identifying and mitigating false positives, see Testing and tuning in the AWS WAF Developer Guide .

LOW is generally a better choice for resources that already have other protections against SQL injection attacks or that have a low tolerance for false positives.

Default: LOW

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-sqlimatchstatement.html#cfn-wafv2-rulegroup-sqlimatchstatement-sensitivitylevel

text_transformations

Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection.

If you specify one or more transformations in a rule statement, AWS WAF performs all transformations on the content of the request component identified by FieldToMatch , starting from the lowest priority setting, before inspecting the content for a match.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-sqlimatchstatement.html#cfn-wafv2-rulegroup-sqlimatchstatement-texttransformations

StatementProperty

class CfnRuleGroup.StatementProperty(*, and_statement=None, byte_match_statement=None, geo_match_statement=None, ip_set_reference_statement=None, label_match_statement=None, not_statement=None, or_statement=None, rate_based_statement=None, regex_match_statement=None, regex_pattern_set_reference_statement=None, size_constraint_statement=None, sqli_match_statement=None, xss_match_statement=None)

Bases: object

The processing guidance for a rule, used by AWS WAF to determine whether a web request matches the rule.

Parameters:
  • and_statement (Union[IResolvable, AndStatementProperty, Dict[str, Any], None]) – A logical rule statement used to combine other rule statements with AND logic. You provide more than one Statement within the AndStatement .

  • byte_match_statement (Union[IResolvable, ByteMatchStatementProperty, Dict[str, Any], None]) – A rule statement that defines a string match search for AWS WAF to apply to web requests. The byte match statement provides the bytes to search for, the location in requests that you want AWS WAF to search, and other settings. The bytes to search for are typically a string that corresponds with ASCII characters. In the AWS WAF console and the developer guide, this is called a string match statement.

  • geo_match_statement (Union[IResolvable, GeoMatchStatementProperty, Dict[str, Any], None]) –

    A rule statement that labels web requests by country and region and that matches against web requests based on country code. A geo match rule labels every request that it inspects regardless of whether it finds a match. - To manage requests only by country, you can use this statement by itself and specify the countries that you want to match against in the CountryCodes array. - Otherwise, configure your geo match rule with Count action so that it only labels requests. Then, add one or more label match rules to run after the geo match rule and configure them to match against the geographic labels and handle the requests as needed. AWS WAF labels requests using the alpha-2 country and region codes from the International Organization for Standardization (ISO) 3166 standard. AWS WAF determines the codes using either the IP address in the web request origin or, if you specify it, the address in the geo match ForwardedIPConfig . If you use the web request origin, the label formats are awswaf:clientip:geo:region:<ISO country code>-<ISO region code> and awswaf:clientip:geo:country:<ISO country code> . If you use a forwarded IP address, the label formats are awswaf:forwardedip:geo:region:<ISO country code>-<ISO region code> and awswaf:forwardedip:geo:country:<ISO country code> . For additional details, see Geographic match rule statement in the AWS WAF Developer Guide .

  • ip_set_reference_statement (Union[IResolvable, IPSetReferenceStatementProperty, Dict[str, Any], None]) – A rule statement used to detect web requests coming from particular IP addresses or address ranges. To use this, create an IPSet that specifies the addresses you want to detect, then use the ARN of that set in this statement. Each IP set rule statement references an IP set. You create and maintain the set independent of your rules. This allows you to use the single set in multiple rules. When you update the referenced set, AWS WAF automatically updates all rules that reference it.

  • label_match_statement (Union[IResolvable, LabelMatchStatementProperty, Dict[str, Any], None]) – A rule statement to match against labels that have been added to the web request by rules that have already run in the web ACL. The label match statement provides the label or namespace string to search for. The label string can represent a part or all of the fully qualified label name that had been added to the web request. Fully qualified labels have a prefix, optional namespaces, and label name. The prefix identifies the rule group or web ACL context of the rule that added the label. If you do not provide the fully qualified name in your label match string, AWS WAF performs the search for labels that were added in the same context as the label match statement.

  • not_statement (Union[IResolvable, NotStatementProperty, Dict[str, Any], None]) – A logical rule statement used to negate the results of another rule statement. You provide one Statement within the NotStatement .

  • or_statement (Union[IResolvable, OrStatementProperty, Dict[str, Any], None]) – A logical rule statement used to combine other rule statements with OR logic. You provide more than one Statement within the OrStatement .

  • rate_based_statement (Union[IResolvable, RateBasedStatementProperty, Dict[str, Any], None]) –

    A rate-based rule counts incoming requests and rate limits requests when they are coming at too fast a rate. The rule categorizes requests according to your aggregation criteria, collects them into aggregation instances, and counts and rate limits the requests for each instance. .. epigraph:: If you change any of these settings in a rule that’s currently in use, the change resets the rule’s rate limiting counts. This can pause the rule’s rate limiting activities for up to a minute. You can specify individual aggregation keys, like IP address or HTTP method. You can also specify aggregation key combinations, like IP address and HTTP method, or HTTP method, query argument, and cookie. Each unique set of values for the aggregation keys that you specify is a separate aggregation instance, with the value from each key contributing to the aggregation instance definition. For example, assume the rule evaluates web requests with the following IP address and HTTP method values: - IP address 10.1.1.1, HTTP method POST - IP address 10.1.1.1, HTTP method GET - IP address 127.0.0.0, HTTP method POST - IP address 10.1.1.1, HTTP method GET The rule would create different aggregation instances according to your aggregation criteria, for example: - If the aggregation criteria is just the IP address, then each individual address is an aggregation instance, and AWS WAF counts requests separately for each. The aggregation instances and request counts for our example would be the following: - IP address 10.1.1.1: count 3 - IP address 127.0.0.0: count 1 - If the aggregation criteria is HTTP method, then each individual HTTP method is an aggregation instance. The aggregation instances and request counts for our example would be the following: - HTTP method POST: count 2 - HTTP method GET: count 2 - If the aggregation criteria is IP address and HTTP method, then each IP address and each HTTP method would contribute to the combined aggregation instance. The aggregation instances and request counts for our example would be the following: - IP address 10.1.1.1, HTTP method POST: count 1 - IP address 10.1.1.1, HTTP method GET: count 2 - IP address 127.0.0.0, HTTP method POST: count 1 For any n-tuple of aggregation keys, each unique combination of values for the keys defines a separate aggregation instance, which AWS WAF counts and rate-limits individually. You can optionally nest another statement inside the rate-based statement, to narrow the scope of the rule so that it only counts and rate limits requests that match the nested statement. You can use this nested scope-down statement in conjunction with your aggregation key specifications or you can just count and rate limit all requests that match the scope-down statement, without additional aggregation. When you choose to just manage all requests that match a scope-down statement, the aggregation instance is singular for the rule. You cannot nest a RateBasedStatement inside another statement, for example inside a NotStatement or OrStatement . You can define a RateBasedStatement inside a web ACL and inside a rule group. For additional information about the options, see Rate limiting web requests using rate-based rules in the AWS WAF Developer Guide . If you only aggregate on the individual IP address or forwarded IP address, you can retrieve the list of IP addresses that AWS WAF is currently rate limiting for a rule through the API call GetRateBasedStatementManagedKeys . This option is not available for other aggregation configurations. AWS WAF tracks and manages web requests separately for each instance of a rate-based rule that you use. For example, if you provide the same rate-based rule settings in two web ACLs, each of the two rule statements represents a separate instance of the rate-based rule and gets its own tracking and management by AWS WAF . If you define a rate-based rule inside a rule group, and then use that rule group in multiple places, each use creates a separate instance of the rate-based rule that gets its own tracking and management by AWS WAF .

  • regex_match_statement (Union[IResolvable, RegexMatchStatementProperty, Dict[str, Any], None]) – A rule statement used to search web request components for a match against a single regular expression.

  • regex_pattern_set_reference_statement (Union[IResolvable, RegexPatternSetReferenceStatementProperty, Dict[str, Any], None]) – A rule statement used to search web request components for matches with regular expressions. To use this, create a RegexPatternSet that specifies the expressions that you want to detect, then use the ARN of that set in this statement. A web request matches the pattern set rule statement if the request component matches any of the patterns in the set. Each regex pattern set rule statement references a regex pattern set. You create and maintain the set independent of your rules. This allows you to use the single set in multiple rules. When you update the referenced set, AWS WAF automatically updates all rules that reference it.

  • size_constraint_statement (Union[IResolvable, SizeConstraintStatementProperty, Dict[str, Any], None]) – A rule statement that compares a number of bytes against the size of a request component, using a comparison operator, such as greater than (>) or less than (<). For example, you can use a size constraint statement to look for query strings that are longer than 100 bytes. If you configure AWS WAF to inspect the request body, AWS WAF inspects only the number of bytes in the body up to the limit for the web ACL and protected resource type. If you know that the request body for your web requests should never exceed the inspection limit, you can use a size constraint statement to block requests that have a larger request body size. For more information about the inspection limits, see Body and JsonBody settings for the FieldToMatch data type. If you choose URI for the value of Part of the request to filter on, the slash (/) in the URI counts as one character. For example, the URI /logo.jpg is nine characters long.

  • sqli_match_statement (Union[IResolvable, SqliMatchStatementProperty, Dict[str, Any], None]) – A rule statement that inspects for malicious SQL code. Attackers insert malicious SQL code into web requests to do things like modify your database or extract data from it.

  • xss_match_statement (Union[IResolvable, XssMatchStatementProperty, Dict[str, Any], None]) – A rule statement that inspects for cross-site scripting (XSS) attacks. In XSS attacks, the attacker uses vulnerabilities in a benign website as a vehicle to inject malicious client-site scripts into other legitimate web browsers.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-statement.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any
# all_query_arguments: Any
# forwarded_ip: Any
# http_method: Any
# ip: Any
# method: Any
# query_string: Any
# single_header: Any
# single_query_argument: Any
# statement_property_: wafv2.CfnRuleGroup.StatementProperty
# uri_path: Any

statement_property = wafv2.CfnRuleGroup.StatementProperty(
    and_statement=wafv2.CfnRuleGroup.AndStatementProperty(
        statements=[statement_property_]
    ),
    byte_match_statement=wafv2.CfnRuleGroup.ByteMatchStatementProperty(
        field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
            all_query_arguments=all_query_arguments,
            body=wafv2.CfnRuleGroup.BodyProperty(
                oversize_handling="oversizeHandling"
            ),
            cookies=wafv2.CfnRuleGroup.CookiesProperty(
                match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                    all=all,
                    excluded_cookies=["excludedCookies"],
                    included_cookies=["includedCookies"]
                ),
                match_scope="matchScope",
                oversize_handling="oversizeHandling"
            ),
            headers=wafv2.CfnRuleGroup.HeadersProperty(
                match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                    all=all,
                    excluded_headers=["excludedHeaders"],
                    included_headers=["includedHeaders"]
                ),
                match_scope="matchScope",
                oversize_handling="oversizeHandling"
            ),
            ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                fallback_behavior="fallbackBehavior"
            ),
            json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                    all=all,
                    included_paths=["includedPaths"]
                ),
                match_scope="matchScope",

                # the properties below are optional
                invalid_fallback_behavior="invalidFallbackBehavior",
                oversize_handling="oversizeHandling"
            ),
            method=method,
            query_string=query_string,
            single_header=single_header,
            single_query_argument=single_query_argument,
            uri_path=uri_path
        ),
        positional_constraint="positionalConstraint",
        text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
            priority=123,
            type="type"
        )],

        # the properties below are optional
        search_string="searchString",
        search_string_base64="searchStringBase64"
    ),
    geo_match_statement=wafv2.CfnRuleGroup.GeoMatchStatementProperty(
        country_codes=["countryCodes"],
        forwarded_ip_config=wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty(
            fallback_behavior="fallbackBehavior",
            header_name="headerName"
        )
    ),
    ip_set_reference_statement={
        "arn": "arn",

        # the properties below are optional
        "ip_set_forwarded_ip_config": {
            "fallback_behavior": "fallbackBehavior",
            "header_name": "headerName",
            "position": "position"
        }
    },
    label_match_statement=wafv2.CfnRuleGroup.LabelMatchStatementProperty(
        key="key",
        scope="scope"
    ),
    not_statement=wafv2.CfnRuleGroup.NotStatementProperty(
        statement=statement_property_
    ),
    or_statement=wafv2.CfnRuleGroup.OrStatementProperty(
        statements=[statement_property_]
    ),
    rate_based_statement=wafv2.CfnRuleGroup.RateBasedStatementProperty(
        aggregate_key_type="aggregateKeyType",
        limit=123,

        # the properties below are optional
        custom_keys=[wafv2.CfnRuleGroup.RateBasedStatementCustomKeyProperty(
            cookie=wafv2.CfnRuleGroup.RateLimitCookieProperty(
                name="name",
                text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                    priority=123,
                    type="type"
                )]
            ),
            forwarded_ip=forwarded_ip,
            header=wafv2.CfnRuleGroup.RateLimitHeaderProperty(
                name="name",
                text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                    priority=123,
                    type="type"
                )]
            ),
            http_method=http_method,
            ip=ip,
            label_namespace=wafv2.CfnRuleGroup.RateLimitLabelNamespaceProperty(
                namespace="namespace"
            ),
            query_argument=wafv2.CfnRuleGroup.RateLimitQueryArgumentProperty(
                name="name",
                text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                    priority=123,
                    type="type"
                )]
            ),
            query_string=wafv2.CfnRuleGroup.RateLimitQueryStringProperty(
                text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                    priority=123,
                    type="type"
                )]
            ),
            uri_path=wafv2.CfnRuleGroup.RateLimitUriPathProperty(
                text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
                    priority=123,
                    type="type"
                )]
            )
        )],
        evaluation_window_sec=123,
        forwarded_ip_config=wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty(
            fallback_behavior="fallbackBehavior",
            header_name="headerName"
        ),
        scope_down_statement=statement_property_
    ),
    regex_match_statement=wafv2.CfnRuleGroup.RegexMatchStatementProperty(
        field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
            all_query_arguments=all_query_arguments,
            body=wafv2.CfnRuleGroup.BodyProperty(
                oversize_handling="oversizeHandling"
            ),
            cookies=wafv2.CfnRuleGroup.CookiesProperty(
                match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                    all=all,
                    excluded_cookies=["excludedCookies"],
                    included_cookies=["includedCookies"]
                ),
                match_scope="matchScope",
                oversize_handling="oversizeHandling"
            ),
            headers=wafv2.CfnRuleGroup.HeadersProperty(
                match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                    all=all,
                    excluded_headers=["excludedHeaders"],
                    included_headers=["includedHeaders"]
                ),
                match_scope="matchScope",
                oversize_handling="oversizeHandling"
            ),
            ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                fallback_behavior="fallbackBehavior"
            ),
            json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                    all=all,
                    included_paths=["includedPaths"]
                ),
                match_scope="matchScope",

                # the properties below are optional
                invalid_fallback_behavior="invalidFallbackBehavior",
                oversize_handling="oversizeHandling"
            ),
            method=method,
            query_string=query_string,
            single_header=single_header,
            single_query_argument=single_query_argument,
            uri_path=uri_path
        ),
        regex_string="regexString",
        text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
            priority=123,
            type="type"
        )]
    ),
    regex_pattern_set_reference_statement=wafv2.CfnRuleGroup.RegexPatternSetReferenceStatementProperty(
        arn="arn",
        field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
            all_query_arguments=all_query_arguments,
            body=wafv2.CfnRuleGroup.BodyProperty(
                oversize_handling="oversizeHandling"
            ),
            cookies=wafv2.CfnRuleGroup.CookiesProperty(
                match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                    all=all,
                    excluded_cookies=["excludedCookies"],
                    included_cookies=["includedCookies"]
                ),
                match_scope="matchScope",
                oversize_handling="oversizeHandling"
            ),
            headers=wafv2.CfnRuleGroup.HeadersProperty(
                match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                    all=all,
                    excluded_headers=["excludedHeaders"],
                    included_headers=["includedHeaders"]
                ),
                match_scope="matchScope",
                oversize_handling="oversizeHandling"
            ),
            ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                fallback_behavior="fallbackBehavior"
            ),
            json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                    all=all,
                    included_paths=["includedPaths"]
                ),
                match_scope="matchScope",

                # the properties below are optional
                invalid_fallback_behavior="invalidFallbackBehavior",
                oversize_handling="oversizeHandling"
            ),
            method=method,
            query_string=query_string,
            single_header=single_header,
            single_query_argument=single_query_argument,
            uri_path=uri_path
        ),
        text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
            priority=123,
            type="type"
        )]
    ),
    size_constraint_statement=wafv2.CfnRuleGroup.SizeConstraintStatementProperty(
        comparison_operator="comparisonOperator",
        field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
            all_query_arguments=all_query_arguments,
            body=wafv2.CfnRuleGroup.BodyProperty(
                oversize_handling="oversizeHandling"
            ),
            cookies=wafv2.CfnRuleGroup.CookiesProperty(
                match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                    all=all,
                    excluded_cookies=["excludedCookies"],
                    included_cookies=["includedCookies"]
                ),
                match_scope="matchScope",
                oversize_handling="oversizeHandling"
            ),
            headers=wafv2.CfnRuleGroup.HeadersProperty(
                match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                    all=all,
                    excluded_headers=["excludedHeaders"],
                    included_headers=["includedHeaders"]
                ),
                match_scope="matchScope",
                oversize_handling="oversizeHandling"
            ),
            ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                fallback_behavior="fallbackBehavior"
            ),
            json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                    all=all,
                    included_paths=["includedPaths"]
                ),
                match_scope="matchScope",

                # the properties below are optional
                invalid_fallback_behavior="invalidFallbackBehavior",
                oversize_handling="oversizeHandling"
            ),
            method=method,
            query_string=query_string,
            single_header=single_header,
            single_query_argument=single_query_argument,
            uri_path=uri_path
        ),
        size=123,
        text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
            priority=123,
            type="type"
        )]
    ),
    sqli_match_statement=wafv2.CfnRuleGroup.SqliMatchStatementProperty(
        field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
            all_query_arguments=all_query_arguments,
            body=wafv2.CfnRuleGroup.BodyProperty(
                oversize_handling="oversizeHandling"
            ),
            cookies=wafv2.CfnRuleGroup.CookiesProperty(
                match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                    all=all,
                    excluded_cookies=["excludedCookies"],
                    included_cookies=["includedCookies"]
                ),
                match_scope="matchScope",
                oversize_handling="oversizeHandling"
            ),
            headers=wafv2.CfnRuleGroup.HeadersProperty(
                match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                    all=all,
                    excluded_headers=["excludedHeaders"],
                    included_headers=["includedHeaders"]
                ),
                match_scope="matchScope",
                oversize_handling="oversizeHandling"
            ),
            ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                fallback_behavior="fallbackBehavior"
            ),
            json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                    all=all,
                    included_paths=["includedPaths"]
                ),
                match_scope="matchScope",

                # the properties below are optional
                invalid_fallback_behavior="invalidFallbackBehavior",
                oversize_handling="oversizeHandling"
            ),
            method=method,
            query_string=query_string,
            single_header=single_header,
            single_query_argument=single_query_argument,
            uri_path=uri_path
        ),
        text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
            priority=123,
            type="type"
        )],

        # the properties below are optional
        sensitivity_level="sensitivityLevel"
    ),
    xss_match_statement=wafv2.CfnRuleGroup.XssMatchStatementProperty(
        field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
            all_query_arguments=all_query_arguments,
            body=wafv2.CfnRuleGroup.BodyProperty(
                oversize_handling="oversizeHandling"
            ),
            cookies=wafv2.CfnRuleGroup.CookiesProperty(
                match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                    all=all,
                    excluded_cookies=["excludedCookies"],
                    included_cookies=["includedCookies"]
                ),
                match_scope="matchScope",
                oversize_handling="oversizeHandling"
            ),
            headers=wafv2.CfnRuleGroup.HeadersProperty(
                match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                    all=all,
                    excluded_headers=["excludedHeaders"],
                    included_headers=["includedHeaders"]
                ),
                match_scope="matchScope",
                oversize_handling="oversizeHandling"
            ),
            ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
                fallback_behavior="fallbackBehavior"
            ),
            json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
                match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                    all=all,
                    included_paths=["includedPaths"]
                ),
                match_scope="matchScope",

                # the properties below are optional
                invalid_fallback_behavior="invalidFallbackBehavior",
                oversize_handling="oversizeHandling"
            ),
            method=method,
            query_string=query_string,
            single_header=single_header,
            single_query_argument=single_query_argument,
            uri_path=uri_path
        ),
        text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
            priority=123,
            type="type"
        )]
    )
)

Attributes

and_statement

A logical rule statement used to combine other rule statements with AND logic.

You provide more than one Statement within the AndStatement .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-statement.html#cfn-wafv2-rulegroup-statement-andstatement

byte_match_statement

A rule statement that defines a string match search for AWS WAF to apply to web requests.

The byte match statement provides the bytes to search for, the location in requests that you want AWS WAF to search, and other settings. The bytes to search for are typically a string that corresponds with ASCII characters. In the AWS WAF console and the developer guide, this is called a string match statement.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-statement.html#cfn-wafv2-rulegroup-statement-bytematchstatement

geo_match_statement

A rule statement that labels web requests by country and region and that matches against web requests based on country code.

A geo match rule labels every request that it inspects regardless of whether it finds a match.

  • To manage requests only by country, you can use this statement by itself and specify the countries that you want to match against in the CountryCodes array.

  • Otherwise, configure your geo match rule with Count action so that it only labels requests. Then, add one or more label match rules to run after the geo match rule and configure them to match against the geographic labels and handle the requests as needed.

AWS WAF labels requests using the alpha-2 country and region codes from the International Organization for Standardization (ISO) 3166 standard. AWS WAF determines the codes using either the IP address in the web request origin or, if you specify it, the address in the geo match ForwardedIPConfig .

If you use the web request origin, the label formats are awswaf:clientip:geo:region:<ISO country code>-<ISO region code> and awswaf:clientip:geo:country:<ISO country code> .

If you use a forwarded IP address, the label formats are awswaf:forwardedip:geo:region:<ISO country code>-<ISO region code> and awswaf:forwardedip:geo:country:<ISO country code> .

For additional details, see Geographic match rule statement in the AWS WAF Developer Guide .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-statement.html#cfn-wafv2-rulegroup-statement-geomatchstatement

ip_set_reference_statement

A rule statement used to detect web requests coming from particular IP addresses or address ranges.

To use this, create an IPSet that specifies the addresses you want to detect, then use the ARN of that set in this statement.

Each IP set rule statement references an IP set. You create and maintain the set independent of your rules. This allows you to use the single set in multiple rules. When you update the referenced set, AWS WAF automatically updates all rules that reference it.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-statement.html#cfn-wafv2-rulegroup-statement-ipsetreferencestatement

label_match_statement

A rule statement to match against labels that have been added to the web request by rules that have already run in the web ACL.

The label match statement provides the label or namespace string to search for. The label string can represent a part or all of the fully qualified label name that had been added to the web request. Fully qualified labels have a prefix, optional namespaces, and label name. The prefix identifies the rule group or web ACL context of the rule that added the label. If you do not provide the fully qualified name in your label match string, AWS WAF performs the search for labels that were added in the same context as the label match statement.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-statement.html#cfn-wafv2-rulegroup-statement-labelmatchstatement

not_statement

A logical rule statement used to negate the results of another rule statement.

You provide one Statement within the NotStatement .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-statement.html#cfn-wafv2-rulegroup-statement-notstatement

or_statement

A logical rule statement used to combine other rule statements with OR logic.

You provide more than one Statement within the OrStatement .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-statement.html#cfn-wafv2-rulegroup-statement-orstatement

rate_based_statement

A rate-based rule counts incoming requests and rate limits requests when they are coming at too fast a rate.

The rule categorizes requests according to your aggregation criteria, collects them into aggregation instances, and counts and rate limits the requests for each instance. .. epigraph:

If you change any of these settings in a rule that's currently in use, the change resets the rule's rate limiting counts. This can pause the rule's rate limiting activities for up to a minute.

You can specify individual aggregation keys, like IP address or HTTP method. You can also specify aggregation key combinations, like IP address and HTTP method, or HTTP method, query argument, and cookie.

Each unique set of values for the aggregation keys that you specify is a separate aggregation instance, with the value from each key contributing to the aggregation instance definition.

For example, assume the rule evaluates web requests with the following IP address and HTTP method values:

  • IP address 10.1.1.1, HTTP method POST

  • IP address 10.1.1.1, HTTP method GET

  • IP address 127.0.0.0, HTTP method POST

  • IP address 10.1.1.1, HTTP method GET

The rule would create different aggregation instances according to your aggregation criteria, for example:

  • If the aggregation criteria is just the IP address, then each individual address is an aggregation instance, and AWS WAF counts requests separately for each. The aggregation instances and request counts for our example would be the following:

  • IP address 10.1.1.1: count 3

  • IP address 127.0.0.0: count 1

  • If the aggregation criteria is HTTP method, then each individual HTTP method is an aggregation instance. The aggregation instances and request counts for our example would be the following:

  • HTTP method POST: count 2

  • HTTP method GET: count 2

  • If the aggregation criteria is IP address and HTTP method, then each IP address and each HTTP method would contribute to the combined aggregation instance. The aggregation instances and request counts for our example would be the following:

  • IP address 10.1.1.1, HTTP method POST: count 1

  • IP address 10.1.1.1, HTTP method GET: count 2

  • IP address 127.0.0.0, HTTP method POST: count 1

For any n-tuple of aggregation keys, each unique combination of values for the keys defines a separate aggregation instance, which AWS WAF counts and rate-limits individually.

You can optionally nest another statement inside the rate-based statement, to narrow the scope of the rule so that it only counts and rate limits requests that match the nested statement. You can use this nested scope-down statement in conjunction with your aggregation key specifications or you can just count and rate limit all requests that match the scope-down statement, without additional aggregation. When you choose to just manage all requests that match a scope-down statement, the aggregation instance is singular for the rule.

You cannot nest a RateBasedStatement inside another statement, for example inside a NotStatement or OrStatement . You can define a RateBasedStatement inside a web ACL and inside a rule group.

For additional information about the options, see Rate limiting web requests using rate-based rules in the AWS WAF Developer Guide .

If you only aggregate on the individual IP address or forwarded IP address, you can retrieve the list of IP addresses that AWS WAF is currently rate limiting for a rule through the API call GetRateBasedStatementManagedKeys . This option is not available for other aggregation configurations.

AWS WAF tracks and manages web requests separately for each instance of a rate-based rule that you use. For example, if you provide the same rate-based rule settings in two web ACLs, each of the two rule statements represents a separate instance of the rate-based rule and gets its own tracking and management by AWS WAF . If you define a rate-based rule inside a rule group, and then use that rule group in multiple places, each use creates a separate instance of the rate-based rule that gets its own tracking and management by AWS WAF .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-statement.html#cfn-wafv2-rulegroup-statement-ratebasedstatement

regex_match_statement

A rule statement used to search web request components for a match against a single regular expression.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-statement.html#cfn-wafv2-rulegroup-statement-regexmatchstatement

regex_pattern_set_reference_statement

A rule statement used to search web request components for matches with regular expressions.

To use this, create a RegexPatternSet that specifies the expressions that you want to detect, then use the ARN of that set in this statement. A web request matches the pattern set rule statement if the request component matches any of the patterns in the set.

Each regex pattern set rule statement references a regex pattern set. You create and maintain the set independent of your rules. This allows you to use the single set in multiple rules. When you update the referenced set, AWS WAF automatically updates all rules that reference it.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-statement.html#cfn-wafv2-rulegroup-statement-regexpatternsetreferencestatement

size_constraint_statement

A rule statement that compares a number of bytes against the size of a request component, using a comparison operator, such as greater than (>) or less than (<).

For example, you can use a size constraint statement to look for query strings that are longer than 100 bytes.

If you configure AWS WAF to inspect the request body, AWS WAF inspects only the number of bytes in the body up to the limit for the web ACL and protected resource type. If you know that the request body for your web requests should never exceed the inspection limit, you can use a size constraint statement to block requests that have a larger request body size. For more information about the inspection limits, see Body and JsonBody settings for the FieldToMatch data type.

If you choose URI for the value of Part of the request to filter on, the slash (/) in the URI counts as one character. For example, the URI /logo.jpg is nine characters long.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-statement.html#cfn-wafv2-rulegroup-statement-sizeconstraintstatement

sqli_match_statement

A rule statement that inspects for malicious SQL code.

Attackers insert malicious SQL code into web requests to do things like modify your database or extract data from it.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-statement.html#cfn-wafv2-rulegroup-statement-sqlimatchstatement

xss_match_statement

A rule statement that inspects for cross-site scripting (XSS) attacks.

In XSS attacks, the attacker uses vulnerabilities in a benign website as a vehicle to inject malicious client-site scripts into other legitimate web browsers.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-statement.html#cfn-wafv2-rulegroup-statement-xssmatchstatement

TextTransformationProperty

class CfnRuleGroup.TextTransformationProperty(*, priority, type)

Bases: object

Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection.

Parameters:
  • priority (Union[int, float]) – Sets the relative processing order for multiple transformations. AWS WAF processes all transformations, from lowest priority to highest, before inspecting the transformed content. The priorities don’t need to be consecutive, but they must all be different.

  • type (str) – For detailed descriptions of each of the transformation types, see Text transformations in the AWS WAF Developer Guide .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-texttransformation.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

text_transformation_property = wafv2.CfnRuleGroup.TextTransformationProperty(
    priority=123,
    type="type"
)

Attributes

priority

Sets the relative processing order for multiple transformations.

AWS WAF processes all transformations, from lowest priority to highest, before inspecting the transformed content. The priorities don’t need to be consecutive, but they must all be different.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-texttransformation.html#cfn-wafv2-rulegroup-texttransformation-priority

type

//docs.aws.amazon.com/waf/latest/developerguide/waf-rule-statement-transformation.html>`_ in the AWS WAF Developer Guide .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-texttransformation.html#cfn-wafv2-rulegroup-texttransformation-type

Type:

For detailed descriptions of each of the transformation types, see `Text transformations <https

VisibilityConfigProperty

class CfnRuleGroup.VisibilityConfigProperty(*, cloud_watch_metrics_enabled, metric_name, sampled_requests_enabled)

Bases: object

Defines and enables Amazon CloudWatch metrics and web request sample collection.

Parameters:
  • cloud_watch_metrics_enabled (Union[bool, IResolvable]) – Indicates whether the associated resource sends metrics to Amazon CloudWatch. For the list of available metrics, see AWS WAF Metrics in the AWS WAF Developer Guide . For web ACLs, the metrics are for web requests that have the web ACL default action applied. AWS WAF applies the default action to web requests that pass the inspection of all rules in the web ACL without being either allowed or blocked. For more information, see The web ACL default action in the AWS WAF Developer Guide .

  • metric_name (str) – A name of the Amazon CloudWatch metric dimension. The name can contain only the characters: A-Z, a-z, 0-9, - (hyphen), and _ (underscore). The name can be from one to 128 characters long. It can’t contain whitespace or metric names that are reserved for AWS WAF , for example All and Default_Action .

  • sampled_requests_enabled (Union[bool, IResolvable]) – Indicates whether AWS WAF should store a sampling of the web requests that match the rules. You can view the sampled requests through the AWS WAF console. .. epigraph:: Request sampling doesn’t provide a field redaction option, and any field redaction that you specify in your logging configuration doesn’t affect sampling. The only way to exclude fields from request sampling is by disabling sampling in the web ACL visibility configuration.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-visibilityconfig.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

visibility_config_property = wafv2.CfnRuleGroup.VisibilityConfigProperty(
    cloud_watch_metrics_enabled=False,
    metric_name="metricName",
    sampled_requests_enabled=False
)

Attributes

cloud_watch_metrics_enabled

Indicates whether the associated resource sends metrics to Amazon CloudWatch.

For the list of available metrics, see AWS WAF Metrics in the AWS WAF Developer Guide .

For web ACLs, the metrics are for web requests that have the web ACL default action applied. AWS WAF applies the default action to web requests that pass the inspection of all rules in the web ACL without being either allowed or blocked. For more information, see The web ACL default action in the AWS WAF Developer Guide .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-visibilityconfig.html#cfn-wafv2-rulegroup-visibilityconfig-cloudwatchmetricsenabled

metric_name

A name of the Amazon CloudWatch metric dimension.

The name can contain only the characters: A-Z, a-z, 0-9, - (hyphen), and _ (underscore). The name can be from one to 128 characters long. It can’t contain whitespace or metric names that are reserved for AWS WAF , for example All and Default_Action .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-visibilityconfig.html#cfn-wafv2-rulegroup-visibilityconfig-metricname

sampled_requests_enabled

Indicates whether AWS WAF should store a sampling of the web requests that match the rules.

You can view the sampled requests through the AWS WAF console. .. epigraph:

Request sampling doesn't provide a field redaction option, and any field redaction that you specify in your logging configuration doesn't affect sampling. The only way to exclude fields from request sampling is by disabling sampling in the web ACL visibility configuration.
See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-visibilityconfig.html#cfn-wafv2-rulegroup-visibilityconfig-sampledrequestsenabled

XssMatchStatementProperty

class CfnRuleGroup.XssMatchStatementProperty(*, field_to_match, text_transformations)

Bases: object

A rule statement that inspects for cross-site scripting (XSS) attacks.

In XSS attacks, the attacker uses vulnerabilities in a benign website as a vehicle to inject malicious client-site scripts into other legitimate web browsers.

Parameters:
  • field_to_match (Union[IResolvable, FieldToMatchProperty, Dict[str, Any]]) – The part of the web request that you want AWS WAF to inspect.

  • text_transformations (Union[IResolvable, Sequence[Union[IResolvable, TextTransformationProperty, Dict[str, Any]]]]) – Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection. If you specify one or more transformations in a rule statement, AWS WAF performs all transformations on the content of the request component identified by FieldToMatch , starting from the lowest priority setting, before inspecting the content for a match.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-xssmatchstatement.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_wafv2 as wafv2

# all: Any
# all_query_arguments: Any
# method: Any
# query_string: Any
# single_header: Any
# single_query_argument: Any
# uri_path: Any

xss_match_statement_property = wafv2.CfnRuleGroup.XssMatchStatementProperty(
    field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty(
        all_query_arguments=all_query_arguments,
        body=wafv2.CfnRuleGroup.BodyProperty(
            oversize_handling="oversizeHandling"
        ),
        cookies=wafv2.CfnRuleGroup.CookiesProperty(
            match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty(
                all=all,
                excluded_cookies=["excludedCookies"],
                included_cookies=["includedCookies"]
            ),
            match_scope="matchScope",
            oversize_handling="oversizeHandling"
        ),
        headers=wafv2.CfnRuleGroup.HeadersProperty(
            match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty(
                all=all,
                excluded_headers=["excludedHeaders"],
                included_headers=["includedHeaders"]
            ),
            match_scope="matchScope",
            oversize_handling="oversizeHandling"
        ),
        ja3_fingerprint=wafv2.CfnRuleGroup.JA3FingerprintProperty(
            fallback_behavior="fallbackBehavior"
        ),
        json_body=wafv2.CfnRuleGroup.JsonBodyProperty(
            match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty(
                all=all,
                included_paths=["includedPaths"]
            ),
            match_scope="matchScope",

            # the properties below are optional
            invalid_fallback_behavior="invalidFallbackBehavior",
            oversize_handling="oversizeHandling"
        ),
        method=method,
        query_string=query_string,
        single_header=single_header,
        single_query_argument=single_query_argument,
        uri_path=uri_path
    ),
    text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty(
        priority=123,
        type="type"
    )]
)

Attributes

field_to_match

The part of the web request that you want AWS WAF to inspect.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-xssmatchstatement.html#cfn-wafv2-rulegroup-xssmatchstatement-fieldtomatch

text_transformations

Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection.

If you specify one or more transformations in a rule statement, AWS WAF performs all transformations on the content of the request component identified by FieldToMatch , starting from the lowest priority setting, before inspecting the content for a match.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-rulegroup-xssmatchstatement.html#cfn-wafv2-rulegroup-xssmatchstatement-texttransformations