Skip to content

Commit

Permalink
docs(client-wafv2): JSON body inspection: Update documentation to cla…
Browse files Browse the repository at this point in the history
…rify that JSON parsing doesn't include full validation.
  • Loading branch information
awstools committed Jul 1, 2024
1 parent 66a9332 commit 7af1f21
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
29 changes: 9 additions & 20 deletions clients/client-wafv2/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,11 +555,12 @@ export type JsonMatchScope = (typeof JsonMatchScope)[keyof typeof JsonMatchScope
* <p>This is used to indicate the web request component to inspect, in the <a>FieldToMatch</a> specification. </p>
* <p>Use the specifications in this object to indicate which parts of the JSON body to
* inspect using the rule's inspection criteria. WAF inspects only the parts of the JSON
* that result from the matches that you indicate.
* </p>
* that result from the matches that you indicate. </p>
* <p>Example JSON: <code>"JsonBody": \{ "MatchPattern": \{ "All": \{\} \}, "MatchScope": "ALL"
* \}</code>
* </p>
* <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>
* in the <i>WAF Developer Guide</i>.</p>
* @public
*/
export interface JsonBody {
Expand Down Expand Up @@ -605,24 +606,12 @@ export interface JsonBody {
* </ul>
* <p>If you don't provide this setting, WAF parses and evaluates the content only up to the
* first parsing failure that it encounters. </p>
* <p>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. </p>
* <p>WAF parses the JSON in the following examples as two valid key, value pairs: </p>
* <ul>
* <li>
* <p>Missing comma: <code>\{"key1":"value1""key2":"value2"\}</code>
* </p>
* </li>
* <li>
* <p>Missing colon: <code>\{"key1":"value1","key2""value2"\}</code>
* </p>
* </li>
* <li>
* <p>Extra colons: <code>\{"key1"::"value1","key2""value2"\}</code>
* </p>
* </li>
* </ul>
* <note>
* <p>WAF parsing doesn't fully validate the input JSON string, so parsing can succeed even for invalid JSON. When
* parsing succeeds, WAF doesn't apply the fallback behavior. For more information,
* 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>
* in the <i>WAF Developer Guide</i>.</p>
* </note>
* @public
*/
InvalidFallbackBehavior?: BodyParsingFallbackBehavior;
Expand Down
4 changes: 2 additions & 2 deletions codegen/sdk-codegen/aws-models/wafv2.json
Original file line number Diff line number Diff line change
Expand Up @@ -7153,7 +7153,7 @@
"InvalidFallbackBehavior": {
"target": "com.amazonaws.wafv2#BodyParsingFallbackBehavior",
"traits": {
"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>"
"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>"
}
},
"OversizeHandling": {
Expand All @@ -7164,7 +7164,7 @@
}
},
"traits": {
"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>"
"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>"
}
},
"com.amazonaws.wafv2#JsonMatchPattern": {
Expand Down

0 comments on commit 7af1f21

Please sign in to comment.