Class: AWSCDK::WAFv2::CfnRuleGroup::SizeConstraintStatementProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
wa_fv2/cfn_rule_group.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:



3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
# File 'wa_fv2/cfn_rule_group.rb', line 3956

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::CfnRuleGroup::FieldToMatchProperty.new(**field_to_match.transform_keys(&:to_sym)) : field_to_match
  Jsii::Type.check_type(@field_to_match, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c193YWZ2Mi5DZm5SdWxlR3JvdXAuRmllbGRUb01hdGNoUHJvcGVydHkifV19fQ==")), "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("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfd2FmdjIuQ2ZuUnVsZUdyb3VwLlRleHRUcmFuc2Zvcm1hdGlvblByb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "textTransformations")
end

Instance Attribute Details

#comparison_operatorString (readonly)

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



3971
3972
3973
# File 'wa_fv2/cfn_rule_group.rb', line 3971

def comparison_operator
  @comparison_operator
end

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

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



3976
3977
3978
# File 'wa_fv2/cfn_rule_group.rb', line 3976

def field_to_match
  @field_to_match
end

#sizeNumeric (readonly)

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



3981
3982
3983
# File 'wa_fv2/cfn_rule_group.rb', line 3981

def size
  @size
end

#text_transformationsAWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::WAFv2::CfnRuleGroup::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.



3988
3989
3990
# File 'wa_fv2/cfn_rule_group.rb', line 3988

def text_transformations
  @text_transformations
end

Class Method Details

.jsii_propertiesObject



3990
3991
3992
3993
3994
3995
3996
3997
# File 'wa_fv2/cfn_rule_group.rb', line 3990

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

Instance Method Details

#to_jsiiObject



3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
# File 'wa_fv2/cfn_rule_group.rb', line 3999

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