

**推出 的新主控台體驗 AWS WAF**

您現在可以使用更新後的體驗，在主控台的任何位置存取 AWS WAF 功能。如需詳細資訊，請參閱[使用 主控台](https://docs.aws.amazon.com/waf/latest/developerguide/working-with-console.html)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 封鎖沒有有效 AWS WAF 字符的請求
<a name="waf-tokens-block-missing-tokens"></a>

本節說明如何封鎖在使用 AWS WAF 行動 SDK 時缺少字符的登入請求。

當您使用智慧型威脅 AWS 受管規則規則群組 `AWSManagedRulesACFPRuleSet`、 `AWSManagedRulesATPRuleSet`和 時`AWSManagedRulesBotControlRuleSet`，規則群組會叫用 AWS WAF 權杖管理來評估 Web 請求權杖的狀態，並相應地標記請求。

**注意**  
字符標籤只會套用到您使用其中一個受管規則群組評估的 Web 請求。

如需權杖管理套用之標籤的相關資訊，請參閱上一節：[中的字符標籤類型 AWS WAF](waf-tokens-labeling.md)。

智慧型威脅緩解受管規則群組接著會處理字符需求，如下所示：
+ `AWSManagedRulesACFPRuleSet` `AllRequests` 規則設定為針對所有請求執行 Challenge動作，有效地封鎖任何沒有`accepted`字符標籤的 。
+ 會`AWSManagedRulesATPRuleSet`封鎖具有`rejected`字符標籤的請求，但不會封鎖具有`absent`字符標籤的請求。
+ `AWSManagedRulesBotControlRuleSet` 目標保護層級會在用戶端傳送五個沒有`accepted`字符標籤的請求後，向用戶端提出挑戰。它不會封鎖沒有有效字符的個別請求。規則群組的常見保護層級不會管理字符需求。

如需智慧型威脅規則群組的其他詳細資訊，請參閱 [AWS WAF 詐騙控制帳戶建立詐騙預防 (ACFP) 規則群組](aws-managed-rule-groups-acfp.md)[AWS WAF 詐騙控制帳戶接管預防 (ATP) 規則群組](aws-managed-rule-groups-atp.md)和 [AWS WAF 機器人控制規則群組](aws-managed-rule-groups-bot.md)。

**使用 Bot Control 或 ATP 受管規則群組時，封鎖缺少字符的請求**  
使用 Bot Control 和 ATP 規則群組時，如果請求沒有有效的權杖，則可以退出規則群組評估，並繼續由保護套件 (Web ACL) 進行評估。

若要封鎖缺少字符或字符遭到拒絕的所有請求，請在受管規則群組之後新增要立即執行的規則，以擷取和封鎖規則群組未為您處理的請求。

以下是使用 ATP 受管規則群組之保護套件 (Web ACL) 的範例 JSON 清單。保護套件 (Web ACL) 具有新增的規則，可擷取並處理`awswaf:managed:token:absent`標籤。規則會將評估範圍縮小為前往登入端點的 Web 請求，以符合 ATP 規則群組的範圍。新增的規則會以粗體列出。

```
{
  "Name": "exampleWebACL",
  "Id": "55555555-6666-7777-8888-999999999999",
  "ARN": "arn:aws:wafv2:us-east-1:111111111111:regional/webacl/exampleWebACL/55555555-4444-3333-2222-111111111111",
  "DefaultAction": {
    "Allow": {}
  },
  "Description": "",
  "Rules": [
    {
      "Name": "AWS-AWSManagedRulesATPRuleSet",
      "Priority": 1,
      "Statement": {
        "ManagedRuleGroupStatement": {
          "VendorName": "AWS",
          "Name": "AWSManagedRulesATPRuleSet",
          "ManagedRuleGroupConfigs": [
            {
              "AWSManagedRulesATPRuleSet": {
                "LoginPath": "/web/login",
                "RequestInspection": {
                  "PayloadType": "JSON",
                  "UsernameField": {
                    "Identifier": "/form/username"
                  },
                  "PasswordField": {
                    "Identifier": "/form/password"
                  }
                },
                "ResponseInspection": {
                  "StatusCode": {
                    "SuccessCodes": [
                      200
                    ],
                    "FailureCodes": [
                      401,
                      403,
                      500
                    ]
                  }
                }
              }  
            }
          ]
        }
      },
      "OverrideAction": {
        "None": {}
      },
      "VisibilityConfig": {
        "SampledRequestsEnabled": true,
        "CloudWatchMetricsEnabled": true,
        "MetricName": "AWS-AWSManagedRulesATPRuleSet"
      }
    },
    {
      "Name": "RequireTokenForLogins",
      "Priority": 2,
      "Statement": {
        "AndStatement": {
          "Statements": [
            {
              "Statement": {
                "LabelMatchStatement": {
                  "Scope": "LABEL",
                  "Key": "awswaf:managed:token:absent"
                }
              }
            },
            {
              "ByteMatchStatement": {
                "SearchString": "/web/login",
                "FieldToMatch": {
                  "UriPath": {}
                },
                "TextTransformations": [
                  {
                    "Priority": 0,
                    "Type": "NONE"
                 }
                ],
                "PositionalConstraint": "STARTS_WITH"
              }
            },
            {
              "ByteMatchStatement": {
                "SearchString": "POST",
                "FieldToMatch": {
                  "Method": {}
                },
                "TextTransformations": [
                  {
                    "Priority": 0,
                    "Type": "NONE"
                  }
                ],
                "PositionalConstraint": "EXACTLY"
              }
            }
          ]
        }
      },
      "Action": {
        "Block": {}
      },
      "VisibilityConfig": {
        "SampledRequestsEnabled": true,
        "CloudWatchMetricsEnabled": true,
        "MetricName": "RequireTokenForLogins"
      } 
    }
  ],
  "VisibilityConfig": {
    "SampledRequestsEnabled": true,
    "CloudWatchMetricsEnabled": true,
    "MetricName": "exampleWebACL"
  },
  "Capacity": 51,
  "ManagedByFirewallManager": false,
  "RetrofittedByFirewallManager": false,
  "LabelNamespace": "awswaf:111111111111:webacl:exampleWebACL:"
}
```