Sign up Log in
n/nodepend · 24d ago · 229 views
u/James💯LegendMANAGER
n/nodependu/James MANAGER · 24d ago

NodePend WAF Advanced Protection Guide

NodePend WAF Advanced Protection Guide

Where to find it: select a website → Settings → WAF → Advanced Protection.

Use Advanced Protection for request inspection, rate limiting, and anomaly monitoring when your site sees APIs repeatedly hit with abnormal parameters, accounts being repeatedly tried for login, a sudden spike in attacks, or unfamiliar scripts on payment pages.

Advanced Protection includes API Protection, Login Protection, Attack Volume Spike Alerts, and Client-Side Script Monitoring. Available features depend on your site plan; if the page says a feature isn't available, you'll need a plan that includes it.

Start with the business scenario: which feature fits my problem?

Use case Common pain point Feature How it helps
Store checkout, app backends, partner APIs APIs keep receiving requests with missing fields, wrong types, or schema violations, causing repeated backend processing and error logs OpenAPI request validation Identifies abnormal requests based on the API spec and, with rules, blocks them before they reach origin, reducing wasted processing; log-only mode can also help debug client integration issues
Member centers, SaaS business APIs Protected APIs repeatedly receive calls with no token, expired tokens, or invalid signatures JWT validation Filters out these requests early, reducing repeated signature verification and processing at origin; the origin still decides which data a given user can access
Product, content, or data queries using GraphQL Deeply nested queries can trigger a lot of backend lookups and slow down APIs GraphQL depth limit Blocks queries beyond the configured nesting depth, reducing pressure from some complex queries
Account logins for stores, forums, and membership systems The same account is repeatedly tried for login, or users keep using passwords that have been publicly exposed Login protection Limits login submission rate per account; after identifying leaked passwords, provides results for origin to prompt a password change or add verification
Sites without someone continuously watching security logs Attack volume suddenly rises, but investigation only starts after users report issues Attack volume spike alerts Sends a site notification when WAF block/challenge volume meets the condition, helping ops and operations teams investigate promptly
Payment pages, checkout pages, key business forms After integrating multiple third-party components, it's hard to notice new unfamiliar script sources on the page Client-side script monitoring Collects browser reports to help locate unapproved script sources and verify their business purpose

API and Login Protection rely on inbound rules to take effect; attack alerts handle notifications, and script monitoring handles reporting. Pick what fits your business—you don't need to enable everything at once.

1. First-time setup: configure first, then enable rules

  1. Confirm the site WAF is enabled. To use API/Login Protection, inbound protection also needs to be enabled.
  2. Enable the features you need under Advanced Protection, fill in the parameters, and click Save at the bottom of the page.
  3. If the page says the API/Login Protection rule group is missing, click Add Preset Rules. Save the parameters you've entered first—the page will refresh after adding the preset.
  4. Go to Inbound Rules and check the relevant rule group and individual rules. Newly added preset rules are disabled by default and set to Log Only; you need to manually enable the rules you plan to use.
  5. Leave them on Log Only first, test with normal business requests and test requests you expect to match, and check whether the logs look as expected.
  6. Once you've confirmed the scope and actions are correct, turn off Log Only for the rules that should take protection action. After saving, wait for nodes to update their config.

Log Only is good for observing matches and won't block anything. After you turn it off, the rule performs its configured action; if the action is just tagging, requests still won't be blocked.

2. API Protection

For public APIs, authenticated business APIs, and GraphQL services. After enabling API Protection, choose the validation methods your business needs—you don't have to fill in every field.

OpenAPI request validation

Use case: the order API keeps receiving parameters that don't match the contract. For example, a missing quantity field or a number sent as text; this can come from client version incompatibility, integration mistakes, or abnormal calls. Use Log Only first to see which requests don't match the spec, fix legitimate clients, then block requests you're sure are invalid to reduce the cost of origin repeatedly handling them.

Paste the OpenAPI 3 document provided by your backend into OpenAPI Document; JSON or YAML is supported. The system uses it to check request paths, HTTP methods, parameters, and request bodies.

For example, if the API spec requires the POST /api/orders request body to include an integer quantity, you can test the rule with requests that omit the field or have the wrong type. Required constraints need to be explicitly declared in the OpenAPI document.

Then go to Inbound Rules and enable Does Not Match OpenAPI Definition. When the preset takes real action, it returns HTTP 400; while left on Log Only, it's for observation.

Scope the rule to the API paths covered by the document. Paths not in the document may also be judged as non-compliant; applying it site-wide could affect the homepage, static files, or other public pages. If the document is empty, this validation is skipped.

JWT validation

Use case: member APIs are repeatedly called with invalid tokens. For APIs that require login, such as orders and profiles, you can validate tokens at the edge so requests with missing tokens, invalid signatures, or expired tokens end early. The origin still needs to check whether the user behind a valid token is allowed to read or modify the target data—for example, user A must not be able to access user B's orders.

A JWT is an access token issued by your login system. Fill this in according to your existing login system's configuration:

Setting What to enter
Token location Usually the Authorization header, e.g. Authorization: Bearer <token>; you can also specify a cookie name
JWKS URL Public HTTPS key URL provided by the auth service, e.g. https://auth.example.com/.well-known/jwks.json; must be reachable from the nodes
Public key (PEM) When verifying with a public key, enter the PEM public key from the auth service—do not enter the private key
HMAC secret When using HMAC signing, enter the same shared secret as the auth service; at least 16 characters
Issuer Optional, corresponds to iss in the token; if filled in, it will be checked for a match
Audience Optional, corresponds to aud; separate multiple values with commas; the token must match at least one

Choose one of JWKS, public key, or HMAC secret based on how the auth service signs tokens. Don't use localhost or internal addresses for JWKS. Tokens must contain a valid expiration time exp. If both a cookie and a header are configured, the specified cookie takes priority when present.

Go to Inbound Rules and enable Invalid JWT. This preset matches requests with no token, an invalid token, or an expired token, and returns HTTP 401 when it takes real action.

Make sure to scope the JWT rule to paths that require auth, e.g. /api/private/. Login endpoints, public APIs, and other pages that allow anonymous access should be excluded as needed; CORS preflight requests also need separate confirmation. JWT validation does not replace origin-side permission checks for user identity, roles, and resource ownership.

GraphQL protection

Use case: a single request queries products, stores, product lists, and other related data through multiple levels. This kind of deep nesting can make one request trigger a lot of backend processing. Set a query depth limit to restrict overly deep requests. Depth is only one factor in query cost; field count, page size, and database overhead still need to be controlled by the business service.

Enter API paths in GraphQL Paths, separated by commas; leave empty to use /graphql. This is an exact path match, so /graphql does not include /graphql/admin.

Go to Inbound Rules and enable GraphQL Query Too Deep. The current preset matches queries nested more than 10 levels deep and returns HTTP 400 when it takes real action; adjust the threshold in the rule based on your actual query structure.

3. Login Protection

For username/password login endpoints in stores, forums, membership systems, etc. It mainly helps with two kinds of problems:

  • The same account is repeatedly tried for login. Set a submission rate limit per account to reduce repeated attempts in a short period, which helps mitigate password guessing against a single account. It is not a complete detection of all credential-stuffing, so you should still combine it with measures such as MFA.
  • A user is using a password that has been publicly exposed. Users may not know their usual password has appeared in a public breach corpus. The check result can be passed to the origin to prompt a password change or add verification during login, helping reduce the risk of reusing leaked passwords.
Setting What to enter
Login endpoint path Enter the path that actually receives login submissions, e.g. /api/auth/login; separate multiple with commas
Username field For example username or email; separate multiple with commas
Password field For example password or pwd; separate multiple with commas
Check leaked passwords Checks whether the password appears in Have I Been Pwned's public leaked-password corpus
Tell origin Puts the available password check result into a forwarded request header for the origin to handle

Login detection only applies to POST requests on the specified paths, with exact path matching. What you enter is the login submission endpoint, not necessarily the login page users open in a browser. URL-encoded forms and top-level JSON fields are supported; for example, with {"email":"user@example.com","password":"示例密码"}, set the username field to email and the password field to password. Nested structures like user.password cannot be read directly as field names.

If field names are left empty, common names are detected: usernames include username, email, user, account, login, phone; passwords include password, pass, pwd, passwd.

In Inbound Rules, you can enable:

  • Frequent logins for the same account: the current preset is more than 10 login requests for the same account within 5 minutes; when taking real action, requests over the limit return HTTP 429. It counts login requests, not password failures confirmed by origin, and can be adjusted for your business.
  • Login with a leaked password: the current preset action adds a leakedPassword tag so it's easier to see in logs. It does not automatically reject the login or change the password.

The password corpus lookup only sends the first 5 hexadecimal characters of the password's SHA-1 hash to the lookup service; it never sends the plaintext password to that service. Normal login requests are still forwarded to the origin. A hit means the password has appeared in a public breach corpus—it does not mean the current account has been compromised; a miss also doesn't guarantee the password is safe.

After enabling Tell Origin, the origin can read:

Request header result Meaning
X-Password-Leaked: 1 Password matched the public breach corpus
X-Password-Leaked: 0 No match in this lookup
No such header The check may not have run, the password may not have been read, or the lookup failed; do not treat this as a pass

The origin needs to implement the password-change prompt, second-factor verification, and other business flows itself. Enabling this option alone won't automatically show users a prompt.

4. Attack Volume Spike Alerts

Use case: attacks suddenly increase during a campaign, and ops staff aren't continuously watching logs. You can set absolute count and relative-to-history change conditions, and get a notification to arrange investigation when they're met. The alert interval controls how often repeat notifications are sent; after receiving one, use the matched rules and normal business traffic to decide whether further action is needed.

This feature counts requests blocked or challenged by the WAF every 5 minutes. When conditions are met, it notifies the site owner via site notification. Log Only matches do not count toward attack volume.

Setting Meaning Example
Alert threshold Minimum attack count in a 5-minute window, at least 10 1000 per 5 minutes
Spike multiplier Current count must reach the specified multiple of the average per 5 minutes over the previous hour; set to 0 to only use the threshold 5x
Alert interval Minimum time between two notifications, at least 5 minutes 60 minutes

These are examples for illustration; adjust them to your site's actual attack volume. For example, if the previous hour averaged 300 per 5 minutes and you set the threshold to 1000 and the multiplier to 5, the current window must reach 1500 and satisfy the alert interval before a notification is sent. If the historical average is 0, the absolute threshold is used.

Alerts depend on logs and security analytics being collected normally. They're useful for spotting changes in attack volume; enabling alerts does not automatically adjust blocking rules.

5. Client-Side Script Monitoring

Use case: a payment or checkout page integrates payment components, customer support, and analytics scripts, and then an unfamiliar script source shows up. Monitoring reports can help you spot this change and verify whether it came from a normal business release, a third-party component change, or something abnormal that needs further investigation.

First add confirmed legitimate sources to the allowlist, then watch for new reports. This feature provides investigation clues; it does not automatically determine whether a script is malicious, nor does it block it from running. If the script content on an allowed source is modified, it may not necessarily trigger a report.

  1. Enable Client-Side Script Monitoring.

  2. Enter path prefixes in Monitored Pages, e.g. /checkout, /pay.

  3. Enter sources you've confirmed you use in Allowed Script Sources, one per line, for example:

    https://js.stripe.com
    https://cdn.example.com
    
  4. Click Save, wait for the config to take effect, then visit the relevant pages in a browser.

  5. Check Scripts Reported in the Last 30 Days. After verifying a source belongs to normal business, click Allow, then click Save at the bottom of the page again.

Behaviors to know:

  • Monitored pages use prefix matching, so /pay also matches /payment; choose prefixes accordingly.
  • External scripts from the same origin as the site are allowed by default; inline scripts on the page may still generate reports.
  • The feature uses Content-Security-Policy-Report-Only to ask browsers to report anomalies; it only reports and does not block script execution.
  • Monitoring applies to HTML responses with status 200 on matching paths. If the origin already has this report policy response header, the system will not overwrite it.
  • The table shows reported sources, counts, and visitor IP counts; it is not a complete inventory of every script on the site. Historical records don't disappear immediately when a source is added to the allowlist.
  • Changes to script content on an allowed source may not be caught by this feature; it does not provide script file integrity verification.

When you find an unfamiliar source, first verify whether it comes from a payment component, analytics tool, or other business dependency, then decide whether to allow it.

6. Example: how a membership store might choose features

Suppose the store has an order API, username/password login, and a checkout page. You can configure it step by step:

Business goal Configuration How to verify it works
Reduce invalid order requests Configure an OpenAPI document for the order API and scope the rule to the endpoints covered by the document Normal order requests pass; requests missing required parameters from the document are logged as expected and rejected once the rule takes real action
Reject invalid login tokens early Configure JWT validation for APIs that require login, excluding login and public APIs Valid tokens work normally; missing or expired tokens match the corresponding rule; the origin still checks order ownership
Mitigate repeated login attempts on an account Configure the actual login submission path and fields, and enable the account rate rule Normal logins are unaffected; a test account that exceeds the configured rate matches the rule
Prompt users to handle leaked passwords Enable password checking and Tell Origin, and have the origin integrate a password-change prompt or extra verification The origin can distinguish between a hit, a miss, and no check result
Arrange investigation when attack volume is abnormal Set the alert threshold, multiplier, and interval based on normal attack levels When the count meets the conditions, the site owner receives a site notification
Spot unfamiliar script sources on the checkout page Monitor /checkout and allow verified payment and other necessary script sources Add a controlled, harmless script from an unapproved source to a test page and check whether a corresponding report appears

For content-only sites, start with attack alerts and script monitoring on key pages; for businesses using JWT or GraphQL, then enable the corresponding API protection. All blocking rules should be observed first, then adjusted based on real traffic.

7. FAQ

Problem How to check
No blocking after enabling API/Login Protection Check whether WAF, inbound protection, the rule group, and the specific rule are enabled, and whether the rule is still on Log Only; confirm nodes have updated their config
A normal page suddenly returns 400/401 Check whether the OpenAPI/JWT rule is covering public pages; change the rule back to Log Only first, adjust the path scope, and test again
Login requests aren't being detected Verify the actual submission path, POST method, form/JSON format, and username/password field names
No user prompt after enabling password checking The origin needs to read the check result and implement the prompt flow; the preset only applies a tag
There are WAF matches but no attack alert Check whether matches are Log Only, whether both threshold and multiplier are met, whether it's still within the alert interval, and whether log collection is working
Script monitoring has no reports Check the page path, the 200 HTML response, and the report policy response header; confirm a browser actually visited and an unapproved source appeared; no report doesn't mean there are no scripts on the page
Clicking Allow Script Source doesn't take effect You also need to click Save and wait for nodes to update their config

After each adjustment, test both normal business requests and requests you expect to match, and confirm the response, logs, and origin behavior are as expected.

Translated by AI from 简体中文

4
0
Log into join the discussion.

0 replies

Sort order

No replies yet. Be the first to say something.