Unable to get WAF rule OversizeHandling property from Lambda

0

From what I can tell, it doesn't seem to be possible to retrieve the OversideHandling property for a WAF rule using a Lambda function. The WAF is returned using client.get_web_acl(...), however the OversizeHandling is stripped out of the rules inside the WAF.

This is problematic because our workflow is that we create a stack in CloudFormation using aws-waf-security-automations, then have a lambda run to make our own customisations to these rules and save them. Because the OversizeHandling is stripped during this process, the end result we are not compliant with the breaking changes being introduced at the end of this month that makes specifying the OversizeHandling mandatory.

I've created a simple proof of concept to demonstrate this:

WAF

Note the OversizeHandling is present in the Body of the SqliMatchStatement

{
  "Name": "test-waf2-CloudFrontWAFAutomationsTest-1JLD9J7O1XHCD",
...
  "Rules": [
...
    {
      "Name": "test-waf2-CloudFrontWAFAutomationsTest-1JLD9J7O1XHCDSqlInjectionRule",
      "Priority": 20,
      "Statement": {
        "OrStatement": {
          "Statements": [
...
            {
              "SqliMatchStatement": {
                "FieldToMatch": {
                  "Body": {
                    "OversizeHandling": "CONTINUE"
                  }
                },
                "TextTransformations": [
                  {
                    "Priority": 1,
                    "Type": "URL_DECODE"
                  },
                  {
                    "Priority": 2,
                    "Type": "HTML_ENTITY_DECODE"
                  }
                ],
                "SensitivityLevel": "LOW"
              }
            }
...

Test lambda:

import json
import logging
import boto3

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

client = boto3.client('wafv2')

def lambda_handler(event, context):
    web_acl = client.get_web_acl(Name="test-waf2-CloudFrontWAFAutomationsTest-1JLD9J7O1XHCD", Id="b01b9488-6255-443a-b3f5-5f384dc4f0b9", Scope="CLOUDFRONT")
    logger.info("Web ACL: %s", web_acl)

Lambda log output

Note there is no OversizeHandling under the Body of the SqliMatchStatement. The SensitivityLevel also appears to be missing.

{
   "WebACL":{
      "Name":"test-waf2-CloudFrontWAFAutomationsTest-1JLD9J7O1XHCD"
...
      "Rules":[
...
         {
            "Name":"test-waf2-CloudFrontWAFAutomationsTest-1JLD9J7O1XHCDSqlInjectionRule",
            "Priority":20,
            "Statement":{
               "OrStatement":{
                  "Statements":[
...
                     {
                        "SqliMatchStatement":{
                           "FieldToMatch":{
                              "Body":{
                                 
                              }
                           },
                           "TextTransformations":[
                              {
                                 "Priority":1,
                                 "Type":"URL_DECODE"
                              },
                              {
                                 "Priority":2,
                                 "Type":"HTML_ENTITY_DECODE"
                              }
                           ]
                        }
                     },

Does anyone have any idea why the OversizeHandling is being stripped, or have a suggestion for a workaround? Thank you!

질문됨 일 년 전78회 조회
답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠