Help Center/ Web Application Firewall/ Best Practices/ Verifying a Global Protection Whitelist Rule by Simulating Requests with Postman
Updated on 2024-11-14 GMT+08:00

Verifying a Global Protection Whitelist Rule by Simulating Requests with Postman

Application Scenarios

After your website is connected to WAF, you can use an API test tool to send HTTP/HTTPS requests to the website and verify that WAF protection rules take effect. This topic uses Postman as an example to describe how to verify a global protection whitelist rule.

Example

Assume that your workloads are deployed in the /product directory, and parameter ID contains scripts or text in Rich Text Format (RTF) submitted by your customers. To ensure service running and improve WAF protection accuracy, you plan to mask false alarms generated for content submitted by the customers.

Resource and Cost Planning

Table 1 Resources and costs

Resource

Description

Monthly Fee

Web Application Firewall

Cloud - Standard edition

  • Billing mode: Yearly/Monthly
  • Domain name quota: 10, including a maximum of one top-level domain name
  • QPS quota: 2,000 QPS
  • Peak bandwidth: 100 Mbit/s inside the cloud and 30 Mbit/s outside the cloud

For details about pricing rules, see Billing Description.

Step 1: Buy the Standard Edition Cloud WAF

The following describes how to buy the standard edition cloud WAF.

  1. Log in to Huawei Cloud management console.
  2. On the management console page, choose Security & Compliance > Web Application Firewall.
  3. In the upper right corner of the page, click Buy WAF. On the purchase page displayed, select Cloud Mode for WAF Mode.

    • Region: Select the region nearest to your services WAF will protect.
    • Edition: Select Standard.
    • Expansion Package and Required Duration: Set them based on site requirements.

  4. Confirm the product details and click Buy Now in the lower right corner of the page.
  5. Check the order details and read the WAF Disclaimer. Then, select the box and click Pay Now.
  6. On the payment page, select a payment method and pay for your order.

Step 2: Add Website Information to WAF

The following example shows how to add a website information to WAF in cloud CNAME access mode.

  1. In the navigation pane on the left, choose Website Settings.
  2. In the upper left corner of the website list, click Add Website.
  3. Select Cloud - CNAME and click Configure Now.
  4. Configure website information as prompted.

    Figure 1 Configuring basic information
    Table 2 Key parameters

    Parameter

    Description

    Example Value

    Domain Name

    Domain name you want to add to WAF for protection.

    • The domain name has an ICP license.
    • You can enter a single domain name (for example, top-level domain name example.com or level-2 domain name www.example.com) or a wildcard domain name (*.example.com).

    www.example.com

    Protected Port

    The port over which the website traffic goes

    Standard ports

    Server Configuration

    Web server address settings. You need to configure the client protocol, server protocol, server weights, server address, and server port.

    • Client Protocol: protocol used by a client to access a server. The options are HTTP and HTTPS.
    • Server Protocol: protocol used by WAF to forward client requests. The options are HTTP and HTTPS.
    • Server Address: public IP address (generally corresponding to the A record of the domain name configured on the DNS) or domain name (generally corresponding to the CNAME record of the domain name configured on the DNS) of the web server that a client accesses.
    • Server Port: service port over which the WAF instance forwards client requests to the origin server.
    • Weight: Requests are distributed across backend origin servers based on the load balancing algorithm you select and the weight you assign to each server.

    Client Protocol: Select HTTP.

    Server Protocol: HTTP

    Server Address: IPv4 XXX.XXX.1.1

    Server Port: 80

    Use Layer-7 Proxy

    You need to configure whether you deploy layer-7 proxies in front of WAF.

    Set this parameter based on your website deployment.

    Yes

  5. Click Next. Then, whitelist WAF back-to-source IP address, test WAF, and modify DNS records as prompted.

    Figure 2 Domain name added to WAF

Step 3: Verify a Global Protection Whitelist Rule by Simulating Requests with Postman

  1. Ensure that Basic Web Protection is enabled and its mode is Block. Enable General Check under it.
  2. Download and install Postman.
  3. On Postman, set the request path to /product and parameter ID to a common test script and send the request. The access request to the protected website is blocked.

  4. Handle the false alarm.

    1. Log in to the management console.
    2. Click in the upper left corner of the management console and select a region or project.
    3. Click in the upper left corner and choose Web Application Firewall under Security & Compliance.
    4. In the navigation pane on the left, choose Events.
    5. On the Events page, WAF 010000 rule for XSS Attack is hit.
    6. In the row containing the event, click Handle as False Alarm.
    7. In the Handle False Alarm dialog box, add a global protection whitelist rule as shown in Figure 3.
      Figure 3 Add Global Protection Whitelist Rule
    8. Click OK.

      It takes about 5 minutes for a protection rule to take effect.

  5. On Postman, set the request path to /product and parameter ID to a common test script and send the request again. The access request to the protected website is blocked again.

  6. Handle the false alarms that hit the 110053 XSS attack rule by referring to Step 4.

    Figure 4 Add Global Protection Whitelist Rule

  7. On Postman, set the request path to /product and parameter ID to a common test script and send the request third time. The access request to the protected website is still blocked.

  8. Handle the false alarm that hits the 110060 rule for XSS attack by referring to Step 4.

    Figure 5 Add Global Protection Whitelist Rule

  9. On Postman, set the request path to /product and the parameter ID to a common test script and send the request forth time. In this case, the access request to the protected website is not blocked. All global protection whitelist rules have taken effect.

    Go to the Event page, no new XSS attack event is displayed.

  10. Simulate an attack on Postman to verify that the configured global protection whitelist rules do not stop WAF from blocking XSS attacks against other parameters.

    1. On Postman, set the request path to /product and parameter item to a common test script and send the request. The access request to the protected website is blocked.

    2. On the Events page, view the XSS attack against parameter item.

  11. Simulate an attack on Postman to verify that the configured global protection whitelist rules do not stop WAF from blocking XSS attacks against other paths.

    1. On Postman, set the request path to /order and parameter ID to a common test script and send the request. The access request to the protected website is blocked.

    2. On the Events page, view the event generated for blocked XSS attack against /order (URL) and parameter ID.