Class: AWSCDK::WAFv2::CfnWebACL::SizeConstraintStatementProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
wa_fv2/cfn_web_acl.rb

Overview

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.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(comparison_operator:, field_to_match:, size:, text_transformations:) ⇒ SizeConstraintStatementProperty

Returns a new instance of SizeConstraintStatementProperty.

Parameters:



5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
# File 'wa_fv2/cfn_web_acl.rb', line 5943

def initialize(comparison_operator:, field_to_match:, size:, text_transformations:)
  @comparison_operator = comparison_operator
  Jsii::Type.check_type(@comparison_operator, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "comparisonOperator")
  @field_to_match = field_to_match.is_a?(Hash) ? ::AWSCDK::WAFv2::CfnWebACL::FieldToMatchProperty.new(**field_to_match.transform_keys(&:to_sym)) : field_to_match
  Jsii::Type.check_type(@field_to_match, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c193YWZ2Mi5DZm5XZWJBQ0wuRmllbGRUb01hdGNoUHJvcGVydHkifV19fQ==")), "fieldToMatch")
  @size = size
  Jsii::Type.check_type(@size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "size")
  @text_transformations = text_transformations
  Jsii::Type.check_type(@text_transformations, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfd2FmdjIuQ2ZuV2ViQUNMLlRleHRUcmFuc2Zvcm1hdGlvblByb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "textTransformations")
end

Instance Attribute Details

#comparison_operatorString (readonly)

The operator to use to compare the request part to the size setting.



5958
5959
5960
# File 'wa_fv2/cfn_web_acl.rb', line 5958

def comparison_operator
  @comparison_operator
end

#field_to_matchAWSCDK::IResolvable, AWSCDK::WAFv2::CfnWebACL::FieldToMatchProperty (readonly)

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



5963
5964
5965
# File 'wa_fv2/cfn_web_acl.rb', line 5963

def field_to_match
  @field_to_match
end

#sizeNumeric (readonly)

The size, in byte, to compare to the request part, after any transformations.



5968
5969
5970
# File 'wa_fv2/cfn_web_acl.rb', line 5968

def size
  @size
end

#text_transformationsAWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::WAFv2::CfnWebACL::TextTransformationProperty> (readonly)

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.



5975
5976
5977
# File 'wa_fv2/cfn_web_acl.rb', line 5975

def text_transformations
  @text_transformations
end

Class Method Details

.jsii_propertiesObject



5977
5978
5979
5980
5981
5982
5983
5984
# File 'wa_fv2/cfn_web_acl.rb', line 5977

def self.jsii_properties
  {
    :comparison_operator => "comparisonOperator",
    :field_to_match => "fieldToMatch",
    :size => "size",
    :text_transformations => "textTransformations",
  }
end

Instance Method Details

#to_jsiiObject



5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
# File 'wa_fv2/cfn_web_acl.rb', line 5986

def to_jsii
  result = {}
  result.merge!({
    "comparisonOperator" => @comparison_operator,
    "fieldToMatch" => @field_to_match,
    "size" => @size,
    "textTransformations" => @text_transformations,
  })
  result.compact
end