Skip to content

Commit 7af1f21

Browse files
author
awstools
committed
docs(client-wafv2): JSON body inspection: Update documentation to clarify that JSON parsing doesn't include full validation.
1 parent 66a9332 commit 7af1f21

File tree

2 files changed

+11
-22
lines changed

2 files changed

+11
-22
lines changed

clients/client-wafv2/src/models/models_0.ts

+9-20
Original file line numberDiff line numberDiff line change
@@ -555,11 +555,12 @@ export type JsonMatchScope = (typeof JsonMatchScope)[keyof typeof JsonMatchScope
555555
* <p>This is used to indicate the web request component to inspect, in the <a>FieldToMatch</a> specification. </p>
556556
* <p>Use the specifications in this object to indicate which parts of the JSON body to
557557
* inspect using the rule's inspection criteria. WAF inspects only the parts of the JSON
558-
* that result from the matches that you indicate.
559-
* </p>
558+
* that result from the matches that you indicate. </p>
560559
* <p>Example JSON: <code>"JsonBody": \{ "MatchPattern": \{ "All": \{\} \}, "MatchScope": "ALL"
561560
* \}</code>
562561
* </p>
562+
* <p>For additional information about this request component option, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-statement-fields-list.html#waf-rule-statement-request-component-json-body">JSON body</a>
563+
* in the <i>WAF Developer Guide</i>.</p>
563564
* @public
564565
*/
565566
export interface JsonBody {
@@ -605,24 +606,12 @@ export interface JsonBody {
605606
* </ul>
606607
* <p>If you don't provide this setting, WAF parses and evaluates the content only up to the
607608
* first parsing failure that it encounters. </p>
608-
* <p>WAF does its best to parse the entire JSON body, but might be forced to stop for
609-
* reasons such as invalid characters, duplicate keys, truncation, and any content whose root
610-
* node isn't an object or an array. </p>
611-
* <p>WAF parses the JSON in the following examples as two valid key, value pairs: </p>
612-
* <ul>
613-
* <li>
614-
* <p>Missing comma: <code>\{"key1":"value1""key2":"value2"\}</code>
615-
* </p>
616-
* </li>
617-
* <li>
618-
* <p>Missing colon: <code>\{"key1":"value1","key2""value2"\}</code>
619-
* </p>
620-
* </li>
621-
* <li>
622-
* <p>Extra colons: <code>\{"key1"::"value1","key2""value2"\}</code>
623-
* </p>
624-
* </li>
625-
* </ul>
609+
* <note>
610+
* <p>WAF parsing doesn't fully validate the input JSON string, so parsing can succeed even for invalid JSON. When
611+
* parsing succeeds, WAF doesn't apply the fallback behavior. For more information,
612+
* see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-statement-fields-list.html#waf-rule-statement-request-component-json-body">JSON body</a>
613+
* in the <i>WAF Developer Guide</i>.</p>
614+
* </note>
626615
* @public
627616
*/
628617
InvalidFallbackBehavior?: BodyParsingFallbackBehavior;

codegen/sdk-codegen/aws-models/wafv2.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7153,7 +7153,7 @@
71537153
"InvalidFallbackBehavior": {
71547154
"target": "com.amazonaws.wafv2#BodyParsingFallbackBehavior",
71557155
"traits": {
7156-
"smithy.api#documentation": "<p>What WAF should do if it fails to completely parse the JSON body. The options are\n the following:</p>\n <ul>\n <li>\n <p>\n <code>EVALUATE_AS_STRING</code> - Inspect the body as plain text. WAF\n applies the text transformations and inspection criteria that you defined for the\n JSON inspection to the body text string.</p>\n </li>\n <li>\n <p>\n <code>MATCH</code> - Treat the web request as matching the rule statement.\n WAF applies the rule action to the request.</p>\n </li>\n <li>\n <p>\n <code>NO_MATCH</code> - Treat the web request as not matching the rule\n statement.</p>\n </li>\n </ul>\n <p>If you don't provide this setting, WAF parses and evaluates the content only up to the\n first parsing failure that it encounters. </p>\n <p>WAF does its best to parse the entire JSON body, but might be forced to stop for\n reasons such as invalid characters, duplicate keys, truncation, and any content whose root\n node isn't an object or an array. </p>\n <p>WAF parses the JSON in the following examples as two valid key, value pairs: </p>\n <ul>\n <li>\n <p>Missing comma: <code>{\"key1\":\"value1\"\"key2\":\"value2\"}</code>\n </p>\n </li>\n <li>\n <p>Missing colon: <code>{\"key1\":\"value1\",\"key2\"\"value2\"}</code>\n </p>\n </li>\n <li>\n <p>Extra colons: <code>{\"key1\"::\"value1\",\"key2\"\"value2\"}</code>\n </p>\n </li>\n </ul>"
7156+
"smithy.api#documentation": "<p>What WAF should do if it fails to completely parse the JSON body. The options are\n the following:</p>\n <ul>\n <li>\n <p>\n <code>EVALUATE_AS_STRING</code> - Inspect the body as plain text. WAF\n applies the text transformations and inspection criteria that you defined for the\n JSON inspection to the body text string.</p>\n </li>\n <li>\n <p>\n <code>MATCH</code> - Treat the web request as matching the rule statement.\n WAF applies the rule action to the request.</p>\n </li>\n <li>\n <p>\n <code>NO_MATCH</code> - Treat the web request as not matching the rule\n statement.</p>\n </li>\n </ul>\n <p>If you don't provide this setting, WAF parses and evaluates the content only up to the\n first parsing failure that it encounters. </p>\n <note>\n <p>WAF parsing doesn't fully validate the input JSON string, so parsing can succeed even for invalid JSON. When \n parsing succeeds, WAF doesn't apply the fallback behavior. For more information, \n see <a href=\"https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-statement-fields-list.html#waf-rule-statement-request-component-json-body\">JSON body</a> \n in the <i>WAF Developer Guide</i>.</p>\n </note>"
71577157
}
71587158
},
71597159
"OversizeHandling": {
@@ -7164,7 +7164,7 @@
71647164
}
71657165
},
71667166
"traits": {
7167-
"smithy.api#documentation": "<p>Inspect the body of the web request as JSON. The body immediately follows the request\n headers. </p>\n <p>This is used to indicate the web request component to inspect, in the <a>FieldToMatch</a> specification. </p>\n <p>Use the specifications in this object to indicate which parts of the JSON body to\n inspect using the rule's inspection criteria. WAF inspects only the parts of the JSON\n that result from the matches that you indicate.\n </p>\n <p>Example JSON: <code>\"JsonBody\": { \"MatchPattern\": { \"All\": {} }, \"MatchScope\": \"ALL\"\n }</code>\n </p>"
7167+
"smithy.api#documentation": "<p>Inspect the body of the web request as JSON. The body immediately follows the request\n headers. </p>\n <p>This is used to indicate the web request component to inspect, in the <a>FieldToMatch</a> specification. </p>\n <p>Use the specifications in this object to indicate which parts of the JSON body to\n inspect using the rule's inspection criteria. WAF inspects only the parts of the JSON\n that result from the matches that you indicate. </p>\n <p>Example JSON: <code>\"JsonBody\": { \"MatchPattern\": { \"All\": {} }, \"MatchScope\": \"ALL\"\n }</code>\n </p>\n <p>For additional information about this request component option, see <a href=\"https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-statement-fields-list.html#waf-rule-statement-request-component-json-body\">JSON body</a> \n in the <i>WAF Developer Guide</i>.</p>"
71687168
}
71697169
},
71707170
"com.amazonaws.wafv2#JsonMatchPattern": {

0 commit comments

Comments
 (0)