Class CfnWebACL.JsonBodyProperty
Inspect the body of the web request as JSON. The body immediately follows the request headers.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.WAFv2
Assembly: Amazon.CDK.AWS.WAFv2.dll
Syntax (csharp)
public class JsonBodyProperty : Object, CfnWebACL.IJsonBodyProperty
Syntax (vb)
Public Class JsonBodyProperty
Inherits Object
Implements CfnWebACL.IJsonBodyProperty
Remarks
This is used to indicate the web request component to inspect, in the FieldToMatch
specification.
Use the specifications in this object to indicate which parts of the JSON body to inspect using the rule's inspection criteria. AWS WAF inspects only the parts of the JSON that result from the matches that you indicate.
Example JSON: "JsonBody": { "MatchPattern": { "All": {} }, "MatchScope": "ALL" }
ExampleMetadata: fixture=_generated
Examples
// 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 jsonBodyProperty = new JsonBodyProperty {
MatchPattern = new JsonMatchPatternProperty {
All = all,
IncludedPaths = new [] { "includedPaths" }
},
MatchScope = "matchScope",
// the properties below are optional
InvalidFallbackBehavior = "invalidFallbackBehavior",
OversizeHandling = "oversizeHandling"
};
Synopsis
Constructors
JsonBodyProperty() |
Properties
InvalidFallbackBehavior | What AWS WAF should do if it fails to completely parse the JSON body. The options are the following:. |
MatchPattern | The patterns to look for in the JSON body. |
MatchScope | The parts of the JSON to match against using the |
OversizeHandling | What AWS WAF should do if the body is larger than AWS WAF can inspect. |
Constructors
JsonBodyProperty()
public JsonBodyProperty()
Properties
InvalidFallbackBehavior
What AWS WAF should do if it fails to completely parse the JSON body. The options are the following:.
public string InvalidFallbackBehavior { get; set; }
Property Value
System.String
Remarks
If you don't provide this setting, AWS WAF parses and evaluates the content only up to the first parsing failure that it encounters.
AWS WAF does its best to parse the entire JSON body, but might be forced to stop for reasons such as invalid characters, duplicate keys, truncation, and any content whose root node isn't an object or an array.
AWS WAF parses the JSON in the following examples as two valid key, value pairs:
MatchPattern
The patterns to look for in the JSON body.
public object MatchPattern { get; set; }
Property Value
System.Object
Remarks
AWS WAF inspects the results of these pattern matches against the rule inspection criteria.
MatchScope
The parts of the JSON to match against using the MatchPattern
.
public string MatchScope { get; set; }
Property Value
System.String
Remarks
If you specify All
, AWS WAF matches against keys and values.
OversizeHandling
What AWS WAF should do if the body is larger than AWS WAF can inspect.
public string OversizeHandling { get; set; }
Property Value
System.String
Remarks
AWS WAF does not support inspecting the entire contents of the web request body if the body exceeds the limit for the resource type. If the body is larger than the limit, the underlying host service only forwards the contents that are below the limit to AWS WAF for inspection.
The default limit is 8 KB (8,192 kilobytes) for regional resources and 16 KB (16,384 kilobytes) for CloudFront distributions. For CloudFront distributions, you can increase the limit in the web ACL AssociationConfig
, for additional processing fees.
The options for oversize handling are the following:
You can combine the MATCH
or NO_MATCH
settings for oversize handling with your rule and web ACL action settings, so that you block any request whose body is over the limit.
Default: CONTINUE