Interface CfnRuleGroup.SizeConstraintStatementProperty

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
CfnRuleGroup.SizeConstraintStatementProperty.Jsii$Proxy
Enclosing class:
CfnRuleGroup

@Stability(Stable) public static interface CfnRuleGroup.SizeConstraintStatementProperty extends software.amazon.jsii.JsiiSerializable
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 of the body up to the limit for the web ACL. By default, for regional web ACLs, this limit is 8 KB (8,192 kilobytes) and for CloudFront web ACLs, this limit is 16 KB (16,384 kilobytes). For CloudFront web ACLs, you can increase the limit in the web ACL AssociationConfig , for additional fees. If you know that the request body for your web requests should never exceed the inspection limit, you could use a size constraint statement to block requests that have a larger request body size.

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.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.wafv2.*;
 Object all;
 Object allQueryArguments;
 Object method;
 Object queryString;
 Object singleHeader;
 Object singleQueryArgument;
 Object uriPath;
 SizeConstraintStatementProperty sizeConstraintStatementProperty = SizeConstraintStatementProperty.builder()
         .comparisonOperator("comparisonOperator")
         .fieldToMatch(FieldToMatchProperty.builder()
                 .allQueryArguments(allQueryArguments)
                 .body(BodyProperty.builder()
                         .oversizeHandling("oversizeHandling")
                         .build())
                 .cookies(CookiesProperty.builder()
                         .matchPattern(CookieMatchPatternProperty.builder()
                                 .all(all)
                                 .excludedCookies(List.of("excludedCookies"))
                                 .includedCookies(List.of("includedCookies"))
                                 .build())
                         .matchScope("matchScope")
                         .oversizeHandling("oversizeHandling")
                         .build())
                 .headers(HeadersProperty.builder()
                         .matchPattern(HeaderMatchPatternProperty.builder()
                                 .all(all)
                                 .excludedHeaders(List.of("excludedHeaders"))
                                 .includedHeaders(List.of("includedHeaders"))
                                 .build())
                         .matchScope("matchScope")
                         .oversizeHandling("oversizeHandling")
                         .build())
                 .jsonBody(JsonBodyProperty.builder()
                         .matchPattern(JsonMatchPatternProperty.builder()
                                 .all(all)
                                 .includedPaths(List.of("includedPaths"))
                                 .build())
                         .matchScope("matchScope")
                         // the properties below are optional
                         .invalidFallbackBehavior("invalidFallbackBehavior")
                         .oversizeHandling("oversizeHandling")
                         .build())
                 .method(method)
                 .queryString(queryString)
                 .singleHeader(singleHeader)
                 .singleQueryArgument(singleQueryArgument)
                 .uriPath(uriPath)
                 .build())
         .size(123)
         .textTransformations(List.of(TextTransformationProperty.builder()
                 .priority(123)
                 .type("type")
                 .build()))
         .build();
 
  • Method Details

    • getComparisonOperator

      @Stability(Stable) @NotNull String getComparisonOperator()
      The operator to use to compare the request part to the size setting.
    • getFieldToMatch

      @Stability(Stable) @NotNull Object getFieldToMatch()
      The part of the web request that you want AWS WAF to inspect.
    • getSize

      @Stability(Stable) @NotNull Number getSize()
      The size, in byte, to compare to the request part, after any transformations.
    • getTextTransformations

      @Stability(Stable) @NotNull Object getTextTransformations()
      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.

    • builder

      @Stability(Stable) static CfnRuleGroup.SizeConstraintStatementProperty.Builder builder()
      Returns:
      a CfnRuleGroup.SizeConstraintStatementProperty.Builder of CfnRuleGroup.SizeConstraintStatementProperty