Skip to content
v2.277.0

RegexPatternSetReferenceStatementProperty Struct ​

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 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.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_wafv2 as wafv2 } from 'aws-cdk-lib';

declare const all: any;
declare const allQueryArguments: any;
declare const method: any;
declare const queryString: any;
declare const singleHeader: any;
declare const singleQueryArgument: any;
declare const uriPath: any;
const regexPatternSetReferenceStatementProperty: wafv2.CfnWebACL.RegexPatternSetReferenceStatementProperty = {
  arn: 'arn',
  fieldToMatch: {
    allQueryArguments: allQueryArguments,
    body: {
      oversizeHandling: 'oversizeHandling',
    },
    cookies: {
      matchPattern: {
        all: all,
        excludedCookies: ['excludedCookies'],
        includedCookies: ['includedCookies'],
      },
      matchScope: 'matchScope',
      oversizeHandling: 'oversizeHandling',
    },
    headerOrder: {
      oversizeHandling: 'oversizeHandling',
    },
    headers: {
      matchPattern: {
        all: all,
        excludedHeaders: ['excludedHeaders'],
        includedHeaders: ['includedHeaders'],
      },
      matchScope: 'matchScope',
      oversizeHandling: 'oversizeHandling',
    },
    ja3Fingerprint: {
      fallbackBehavior: 'fallbackBehavior',
    },
    ja4Fingerprint: {
      fallbackBehavior: 'fallbackBehavior',
    },
    jsonBody: {
      matchPattern: {
        all: all,
        includedPaths: ['includedPaths'],
      },
      matchScope: 'matchScope',

      // the properties below are optional
      invalidFallbackBehavior: 'invalidFallbackBehavior',
      oversizeHandling: 'oversizeHandling',
    },
    method: method,
    queryString: queryString,
    singleHeader: singleHeader,
    singleQueryArgument: singleQueryArgument,
    uriFragment: {
      fallbackBehavior: 'fallbackBehavior',
    },
    uriPath: uriPath,
  },
  textTransformations: [{
    priority: 123,
    type: 'type',
  }],

  // the properties below are optional
  preParseTextTransformations: [{
    priority: 123,
    type: 'type',
  }],
};
python
# 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.CfnWebACL.RegexPatternSetReferenceStatementProperty(
    arn="arn",
    field_to_match=wafv2.CfnWebACL.FieldToMatchProperty(
        all_query_arguments=all_query_arguments,
        body=wafv2.CfnWebACL.BodyProperty(
            oversize_handling="oversizeHandling"
        ),
        cookies=wafv2.CfnWebACL.CookiesProperty(
            match_pattern=wafv2.CfnWebACL.CookieMatchPatternProperty(
                all=all,
                excluded_cookies=["excludedCookies"],
                included_cookies=["includedCookies"]
            ),
            match_scope="matchScope",
            oversize_handling="oversizeHandling"
        ),
        header_order=wafv2.CfnWebACL.HeaderOrderProperty(
            oversize_handling="oversizeHandling"
        ),
        headers=wafv2.CfnWebACL.HeadersProperty(
            match_pattern=wafv2.CfnWebACL.HeaderMatchPatternProperty(
                all=all,
                excluded_headers=["excludedHeaders"],
                included_headers=["includedHeaders"]
            ),
            match_scope="matchScope",
            oversize_handling="oversizeHandling"
        ),
        ja3_fingerprint=wafv2.CfnWebACL.JA3FingerprintProperty(
            fallback_behavior="fallbackBehavior"
        ),
        ja4_fingerprint=wafv2.CfnWebACL.JA4FingerprintProperty(
            fallback_behavior="fallbackBehavior"
        ),
        json_body=wafv2.CfnWebACL.JsonBodyProperty(
            match_pattern=wafv2.CfnWebACL.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_fragment=wafv2.CfnWebACL.UriFragmentProperty(
            fallback_behavior="fallbackBehavior"
        ),
        uri_path=uri_path
    ),
    text_transformations=[wafv2.CfnWebACL.TextTransformationProperty(
        priority=123,
        type="type"
    )],

    # the properties below are optional
    pre_parse_text_transformations=[wafv2.CfnWebACL.PreParseTextTransformationProperty(
        priority=123,
        type="type"
    )]
)
java
// 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;

RegexPatternSetReferenceStatementProperty regexPatternSetReferenceStatementProperty = RegexPatternSetReferenceStatementProperty.builder()
        .arn("arn")
        .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())
                .headerOrder(HeaderOrderProperty.builder()
                        .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())
                .ja3Fingerprint(JA3FingerprintProperty.builder()
                        .fallbackBehavior("fallbackBehavior")
                        .build())
                .ja4Fingerprint(JA4FingerprintProperty.builder()
                        .fallbackBehavior("fallbackBehavior")
                        .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)
                .uriFragment(UriFragmentProperty.builder()
                        .fallbackBehavior("fallbackBehavior")
                        .build())
                .uriPath(uriPath)
                .build())
        .textTransformations(List.of(TextTransformationProperty.builder()
                .priority(123)
                .type("type")
                .build()))

        // the properties below are optional
        .preParseTextTransformations(List.of(PreParseTextTransformationProperty.builder()
                .priority(123)
                .type("type")
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.WAFv2;

var all;
var allQueryArguments;
var method;
var queryString;
var singleHeader;
var singleQueryArgument;
var uriPath;

var regexPatternSetReferenceStatementProperty = new RegexPatternSetReferenceStatementProperty {
    Arn = "arn",
    FieldToMatch = new FieldToMatchProperty {
        AllQueryArguments = allQueryArguments,
        Body = new BodyProperty {
            OversizeHandling = "oversizeHandling"
        },
        Cookies = new CookiesProperty {
            MatchPattern = new CookieMatchPatternProperty {
                All = all,
                ExcludedCookies = new [] { "excludedCookies" },
                IncludedCookies = new [] { "includedCookies" }
            },
            MatchScope = "matchScope",
            OversizeHandling = "oversizeHandling"
        },
        HeaderOrder = new HeaderOrderProperty {
            OversizeHandling = "oversizeHandling"
        },
        Headers = new HeadersProperty {
            MatchPattern = new HeaderMatchPatternProperty {
                All = all,
                ExcludedHeaders = new [] { "excludedHeaders" },
                IncludedHeaders = new [] { "includedHeaders" }
            },
            MatchScope = "matchScope",
            OversizeHandling = "oversizeHandling"
        },
        Ja3Fingerprint = new JA3FingerprintProperty {
            FallbackBehavior = "fallbackBehavior"
        },
        Ja4Fingerprint = new JA4FingerprintProperty {
            FallbackBehavior = "fallbackBehavior"
        },
        JsonBody = new JsonBodyProperty {
            MatchPattern = new JsonMatchPatternProperty {
                All = all,
                IncludedPaths = new [] { "includedPaths" }
            },
            MatchScope = "matchScope",

            // the properties below are optional
            InvalidFallbackBehavior = "invalidFallbackBehavior",
            OversizeHandling = "oversizeHandling"
        },
        Method = method,
        QueryString = queryString,
        SingleHeader = singleHeader,
        SingleQueryArgument = singleQueryArgument,
        UriFragment = new UriFragmentProperty {
            FallbackBehavior = "fallbackBehavior"
        },
        UriPath = uriPath
    },
    TextTransformations = new [] { new TextTransformationProperty {
        Priority = 123,
        Type = "type"
    } },

    // the properties below are optional
    PreParseTextTransformations = new [] { new PreParseTextTransformationProperty {
        Priority = 123,
        Type = "type"
    } }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var all interface{}
var allQueryArguments interface{}
var method interface{}
var queryString interface{}
var singleHeader interface{}
var singleQueryArgument interface{}
var uriPath interface{}

regexPatternSetReferenceStatementProperty := &RegexPatternSetReferenceStatementProperty{
	Arn: jsii.String("arn"),
	FieldToMatch: &FieldToMatchProperty{
		AllQueryArguments: allQueryArguments,
		Body: &BodyProperty{
			OversizeHandling: jsii.String("oversizeHandling"),
		},
		Cookies: &CookiesProperty{
			MatchPattern: &CookieMatchPatternProperty{
				All: all,
				ExcludedCookies: []*string{
					jsii.String("excludedCookies"),
				},
				IncludedCookies: []*string{
					jsii.String("includedCookies"),
				},
			},
			MatchScope: jsii.String("matchScope"),
			OversizeHandling: jsii.String("oversizeHandling"),
		},
		HeaderOrder: &HeaderOrderProperty{
			OversizeHandling: jsii.String("oversizeHandling"),
		},
		Headers: &HeadersProperty{
			MatchPattern: &HeaderMatchPatternProperty{
				All: all,
				ExcludedHeaders: []*string{
					jsii.String("excludedHeaders"),
				},
				IncludedHeaders: []*string{
					jsii.String("includedHeaders"),
				},
			},
			MatchScope: jsii.String("matchScope"),
			OversizeHandling: jsii.String("oversizeHandling"),
		},
		Ja3Fingerprint: &JA3FingerprintProperty{
			FallbackBehavior: jsii.String("fallbackBehavior"),
		},
		Ja4Fingerprint: &JA4FingerprintProperty{
			FallbackBehavior: jsii.String("fallbackBehavior"),
		},
		JsonBody: &JsonBodyProperty{
			MatchPattern: &JsonMatchPatternProperty{
				All: all,
				IncludedPaths: []*string{
					jsii.String("includedPaths"),
				},
			},
			MatchScope: jsii.String("matchScope"),

			// the properties below are optional
			InvalidFallbackBehavior: jsii.String("invalidFallbackBehavior"),
			OversizeHandling: jsii.String("oversizeHandling"),
		},
		Method: method,
		QueryString: queryString,
		SingleHeader: singleHeader,
		SingleQueryArgument: singleQueryArgument,
		UriFragment: &UriFragmentProperty{
			FallbackBehavior: jsii.String("fallbackBehavior"),
		},
		UriPath: uriPath,
	},
	TextTransformations: []interface{}{
		&TextTransformationProperty{
			Priority: jsii.Number(123),
			Type: jsii.String("type"),
		},
	},

	// the properties below are optional
	PreParseTextTransformations: []interface{}{
		&PreParseTextTransformationProperty{
			Priority: jsii.Number(123),
			Type: jsii.String("type"),
		},
	},
}

Properties ​

arnstringarnstrarnStringArnstringArn*stringrequired#
The Amazon Resource Name (ARN) of the `RegexPatternSet` that this statement references.
fieldToMatchIResolvable | CfnWebACL.FieldToMatchPropertyfield_to_matchtyping.Union[IResolvable, FieldToMatchProperty]fieldToMatchIResolvableFieldToMatchIResolvableFieldToMatchinterface{}required#
The part of the web request that you want AWS WAF to inspect.
preParseTextTransformationsoptionalIResolvable | IResolvable | CfnWebACL.PreParseTextTransformationProperty[]pre_parse_text_transformationsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, PreParseTextTransformationProperty]]]preParseTextTransformationsoptionalIResolvablePreParseTextTransformationsoptionalIResolvablePreParseTextTransformationsoptionalinterface{}#
textTransformationsIResolvable | IResolvable | CfnWebACL.TextTransformationProperty[]text_transformationstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, TextTransformationProperty]]]textTransformationsIResolvableTextTransformationsIResolvableTextTransformationsinterface{}required#
Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection.
notes

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.