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
- Confirm the site WAF is enabled. To use API/Login Protection, inbound protection also needs to be enabled.
- Enable the features you need under Advanced Protection, fill in the parameters, and click Save at the bottom of the page.
- 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.
- 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.
- 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.
- 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
leakedPasswordtag 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.
-
Enable Client-Side Script Monitoring.
-
Enter path prefixes in Monitored Pages, e.g.
/checkout, /pay. -
Enter sources you've confirmed you use in Allowed Script Sources, one per line, for example:
https://js.stripe.com https://cdn.example.com -
Click Save, wait for the config to take effect, then visit the relevant pages in a browser.
-
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
/payalso 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-Onlyto 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.
NodePend WAF 高级防护使用说明
入口:选择网站 → 设置 → WAF → 高级防护。
当网站遇到接口被反复提交异常参数、账号被频繁尝试登录、攻击突然增多,或支付页面出现陌生脚本时,可以使用高级防护进行请求检查、频率限制和异常监控。
高级防护包括 API 防护、登录防护、攻击量突增告警和客户端脚本监控。可用功能取决于网站套餐;页面提示未开放时,需要使用包含相应功能的套餐。
先看业务场景:我遇到的问题适合用哪项功能?
| 适用业务场景 | 常见痛点 | 对应功能 | 能带来的帮助 |
|---|---|---|---|
| 商城下单、App 后端、合作伙伴 API | 接口不断收到缺字段、类型错误或不符合约定的请求,后端反复处理并产生错误日志 | OpenAPI 请求校验 | 按接口文档识别异常请求,配合规则在到达源站前拦截,减少无效处理;仅记录模式也可帮助排查客户端接入问题 |
| 会员中心、SaaS 业务接口 | 受保护接口反复收到无令牌、令牌过期或签名无效的调用 | JWT 校验 | 提前筛除这类请求,减少源站重复验签与处理;具体用户能操作哪些数据仍由源站判断 |
| 使用 GraphQL 的商品、内容或数据查询 | 层层嵌套的查询可能带来大量后端查询,拖慢接口 | GraphQL 深度限制 | 拦截超过设定嵌套深度的查询,减轻部分复杂查询带来的压力 |
| 商城、论坛、会员系统的账号登录 | 同一账号被反复尝试登录,或用户继续使用曾公开泄露的密码 | 登录防护 | 限制同一账号的登录提交频率;识别泄露密码后,供源站提示改密或追加验证 |
| 没有专人持续查看安全日志的网站 | 攻击量突然上升,却要等用户反馈异常才开始排查 | 攻击量突增告警 | 当 WAF 拦截/挑战量达到条件时发送站内消息,帮助运营和运维及时安排排查 |
| 支付页、结算页、关键业务表单 | 接入多个第三方组件后,不容易发现页面新增了陌生脚本来源 | 客户端脚本监控 | 收集浏览器报告,帮助定位未允许的脚本来源,并核实其业务用途 |
API 和登录防护需要配合入站规则执行;攻击告警负责通知,脚本监控负责报告。可根据实际业务选用,不必一次开启全部功能。
一、首次使用:先配置,再启用规则
- 确认网站 WAF 已开启。使用 API/登录防护时,还需开启入站防护。
- 在「高级防护」中启用需要的功能,填写参数,点击页面底部「保存」。
- 如果页面提示缺少 API/登录防护规则组,点击「添加预设规则」。请先保存已填写的参数,添加预设后页面会刷新。
- 前往「入站规则」,检查相应规则组和具体规则。新添加的预设规则默认关闭,并设置为「仅记录」;需要手动启用准备使用的规则。
- 先保持「仅记录」,用正常业务请求和预期会命中的测试请求验证,查看日志是否符合预期。
- 确认作用范围和动作正确后,再对需要执行防护动作的规则取消「仅记录」。保存后,等待节点更新配置。
「仅记录」适合观察命中情况,不会执行拦截动作。取消后执行规则配置的动作;如果动作只是打标签,仍不会拦截请求。
二、API 防护
适用于开放接口、需要登录的业务接口和 GraphQL 服务。开启「API 防护」后,按业务选择需要的校验方式,不必填写全部项目。
OpenAPI 请求校验
业务场景:下单接口不断收到不符合约定的参数。 例如数量字段缺失、数值被传成文本,可能来自客户端版本不兼容、接入错误或异常调用。先用「仅记录」了解哪些请求不符合文档,修正正常客户端后,再拦截确定无效的请求,减少源站反复处理这类请求的成本。
将后端提供的 OpenAPI 3 文档粘贴到「OpenAPI 文档」,支持 JSON 或 YAML。系统据此检查请求路径、HTTP 方法、参数和请求体。
例如,接口文档要求 POST /api/orders 的请求体包含整数类型的 quantity,可以用缺少该字段或类型错误的请求验证规则。必填条件需要在 OpenAPI 文档中明确声明。
接着到入站规则启用「不符合 OpenAPI 定义」。该预设正式执行时返回 HTTP 400;保持「仅记录」时用于观察。
请把规则限定到文档覆盖的 API 路径。 未写入文档的路径也可能被判定为不符合,整站应用可能影响首页、静态文件或其他公开页面。文档留空时不进行此项校验。
JWT 校验
业务场景:会员接口反复被无效令牌调用。 对必须登录才能访问的订单、个人资料等接口,可在边缘节点校验令牌,让缺少令牌、签名无效或已过期的请求提前结束。源站仍需检查有效令牌对应的用户是否有权读取或修改目标数据,例如用户 A 不能访问用户 B 的订单。
JWT 是登录系统签发的访问令牌。请按现有登录系统的配置填写:
| 配置项 | 填写说明 |
|---|---|
| 令牌位置 | 通常使用 Authorization 请求头,例如 Authorization: Bearer <令牌>;也可指定 Cookie 名称 |
| JWKS 地址 | 认证服务提供的公网 HTTPS 公钥地址,例如 https://auth.example.com/.well-known/jwks.json;需要能从节点访问 |
| 公钥(PEM) | 使用公钥验签时,填写认证服务提供的 PEM 公钥,不要填写私钥 |
| HMAC 密钥 | 使用 HMAC 签名时,填写与认证服务一致的共享密钥;至少 16 个字符 |
| 签发者 | 可选,对应令牌中的 iss;填写后校验是否一致 |
| 接收方 | 可选,对应 aud;多个值用逗号分隔,令牌需匹配其中至少一个 |
JWKS、公钥和 HMAC 密钥按认证服务的签名方式选择一项。JWKS 不应填写 localhost 或内网地址。令牌需要包含有效的到期时间 exp。如果同时配置 Cookie 和请求头,存在指定 Cookie 时优先使用 Cookie。
到入站规则启用「JWT 无效」。该预设会匹配没有令牌、令牌无效或令牌过期的请求,正式执行时返回 HTTP 401。
务必将 JWT 规则限定在需要鉴权的路径,例如 /api/private/。 登录接口、公开接口和其他允许匿名访问的页面应按业务需求排除;跨域预检请求也需要单独确认。JWT 校验不能替代源站对用户身份、角色和资源归属的权限检查。
GraphQL 防护
业务场景:一个请求层层查询商品、店铺、商品列表等关联数据。 这类深层嵌套可能让一次请求触发大量后端处理。设置查询深度上限,可限制其中过深的请求。深度只是查询成本的一个因素,字段数量、分页大小和数据库开销仍需由业务服务控制。
在「GraphQL 路径」填写接口路径,多个用逗号分隔;留空使用 /graphql。这里按路径精确匹配,例如 /graphql 不包含 /graphql/admin。
到入站规则启用「GraphQL 查询过深」。当前预设匹配嵌套超过 10 层的查询,正式执行时返回 HTTP 400;可根据实际查询结构在规则中调整阈值。
三、登录防护
适用于商城、论坛、会员系统等账号密码登录接口,主要帮助处理两类问题:
- 同一账号被反复尝试登录。 为账号设置提交频率限制,减少短时间重复尝试,有助于缓解针对同一账号的密码猜测。它不是对所有撞库行为的完整识别,仍应结合业务的多因素认证等措施。
- 用户使用了曾公开泄露的密码。 用户可能不知道常用密码已出现在公开泄露库中。检查结果可交给源站,在登录流程中提醒修改密码或追加验证,帮助降低重复使用泄露密码带来的风险。
| 配置项 | 填写说明 |
|---|---|
| 登录接口路径 | 填写实际接收登录提交的路径,例如 /api/auth/login;多个用逗号分隔 |
| 用户名字段 | 例如 username 或 email;多个用逗号分隔 |
| 密码字段 | 例如 password 或 pwd;多个用逗号分隔 |
| 检查泄露密码 | 查询密码是否出现在 Have I Been Pwned 的公开泄露密码库 |
| 告诉源站 | 将可用的密码检查结果放入转发请求头,供源站处理 |
登录识别只针对指定路径的 POST 请求,路径精确匹配。填写的是登录提交接口,未必是浏览器打开的登录页面。支持普通 URL 编码表单或 JSON 顶层字段;例如 {"email":"user@example.com","password":"示例密码"},用户名字段填写 email,密码字段填写 password。嵌套结构如 user.password 不能直接作为字段名读取。
字段名留空时,会识别常见名称:用户名包括 username、email、user、account、login、phone;密码包括 password、pass、pwd、passwd。
在入站规则中,可选择启用:
- 同一账号频繁登录:当前预设为同一账号 5 分钟内超过 10 次登录请求,正式执行时对超出的请求返回 HTTP 429。统计的是登录请求次数,不是源站确认的密码错误次数,可按业务调整。
- 使用已泄露的密码登录:当前预设动作为添加
leakedPassword标签,便于查看日志,不会自动拒绝登录或修改密码。
密码库查询仅向查询服务发送密码 SHA-1 摘要的前 5 个十六进制字符,不会向该查询服务发送明文密码。正常登录请求仍会转发给源站。命中表示该密码曾出现在公开泄露库中,不代表当前账号已被盗;未命中也不代表密码一定安全。
启用「告诉源站」后,源站可读取:
| 请求头结果 | 含义 |
|---|---|
X-Password-Leaked: 1 |
密码命中公开泄露库 |
X-Password-Leaked: 0 |
本次查询未命中 |
| 没有此请求头 | 可能未执行检查、未读取到密码或查询失败,不能当作检查通过 |
源站需要自行实现修改密码提示、二次验证等业务流程。仅开启该选项不会自动给用户展示提示。
四、攻击量突增告警
业务场景:活动期间攻击突然增多,运营人员没有持续查看日志。 可以设置绝对次数和相对历史水平的变化条件,在达到条件时收到消息并安排排查。告警间隔用于控制重复通知频率;收到通知后,可结合命中规则和正常业务访问情况,判断是否需要进一步处理。
该功能每 5 分钟统计一次被 WAF 拦截或挑战的请求,达到条件后,通过站内消息通知网站所有者。「仅记录」的命中不计入攻击量。
| 配置项 | 含义 | 配置示例 |
|---|---|---|
| 告警阈值 | 一个 5 分钟窗口内的最低攻击次数,至少 10 次 | 1000 次/5 分钟 |
| 突增倍数 | 当前次数需达到前一小时每 5 分钟平均次数的指定倍数;填 0 只看阈值 | 5 倍 |
| 告警间隔 | 两次通知之间至少间隔多久,至少 5 分钟 | 60 分钟 |
以上是说明用的示例,需按网站实际攻击量调整。例如,前一小时平均每 5 分钟 300 次,设置阈值 1000、倍数 5,则当前窗口需达到 1500 次,并满足告警间隔,才会通知。历史平均值为 0 时,按绝对阈值判断。
告警依赖日志和安全分析正常采集,适合用于发现攻击量变化;开启告警本身不会自动调整拦截规则。
五、客户端脚本监控
业务场景:支付或结算页面接入了支付组件、客服和统计脚本,后续却出现一个不认识的脚本来源。 监控报告可以帮助你发现这个变化,核实它来自正常业务上线、第三方组件变化,还是需要进一步排查的异常引入。
先将已确认的正常来源加入允许列表,再关注新出现的报告。该功能提供排查线索,不会自动判定脚本是否恶意,也不会阻止其运行;已允许来源上的脚本内容被修改,未必会触发报告。
-
开启「客户端脚本监控」。
-
在「监控的页面」填写路径前缀,例如
/checkout, /pay。 -
在「允许的脚本来源」中填写确认使用的来源,每行一个,例如:
https://js.stripe.com https://cdn.example.com -
点击「保存」,等待配置生效后,用浏览器访问相应页面。
-
查看「近 30 天上报的脚本」。核实来源属于正常业务后,可点击「允许」,然后再次点击页面底部「保存」。
需要了解的行为:
- 监控页面使用前缀匹配,例如
/pay也会匹配/payment,请根据需要选择前缀。 - 与网站同源的外部脚本默认允许;页面内联脚本仍可能产生报告。
- 功能通过
Content-Security-Policy-Report-Only请求浏览器报告异常,只报告,不阻止脚本执行。 - 监控适用于匹配路径、状态为 200 的 HTML 响应。如果源站已有该报告策略响应头,系统不会覆盖它。
- 表格展示上报来源、次数和访客 IP 数,不是网站所有脚本的完整清单。历史记录不会因加入允许列表而立即消失。
- 已允许来源上的脚本内容变化,不一定会被该功能发现;它不提供脚本文件完整性校验。
发现陌生来源时,先核实是否来自支付组件、统计工具或其他业务依赖,再决定是否允许。
六、示例:一个会员商城如何选配
假设商城有订单接口、账号密码登录和结算页面,可以分步配置:
| 业务目标 | 配置方式 | 如何确认效果 |
|---|---|---|
| 减少无效下单请求 | 为订单 API 配置 OpenAPI 文档,将规则限定到文档覆盖的接口 | 正常订单请求通过;缺少文档规定的必填参数时产生预期记录,正式执行后被拒绝 |
| 提前拒绝无效登录令牌 | 为必须登录的 API 配置 JWT 校验,排除登录和公开接口 | 有效令牌正常访问;缺失或过期令牌被对应规则命中;源站继续检查订单归属 |
| 缓解账号重复登录尝试 | 配置实际登录提交路径及字段,启用账号频率规则 | 正常登录不受影响;测试账号超过配置频率后命中规则 |
| 提醒用户处理泄露密码 | 开启密码检查和「告诉源站」,由源站接入改密提示或追加验证 | 源站能够区分命中、未命中和没有检查结果三种情况 |
| 在攻击量异常时安排排查 | 按平时攻击水平设置告警阈值、倍数和间隔 | 统计达到条件时,网站所有者收到站内消息 |
| 发现结算页陌生脚本来源 | 监控 /checkout,允许已核实的支付和其他必要脚本来源 |
在测试页面引入受控、未允许来源的无害脚本后,检查是否出现对应报告 |
只提供内容展示的网站,可以先考虑攻击告警和关键页面脚本监控;使用 JWT 或 GraphQL 的业务,再启用相应 API 防护。所有拦截规则都应先观察,再结合实际流量调整。
七、常见问题
| 问题 | 检查方法 |
|---|---|
| 开启 API/登录防护后没有拦截 | 检查 WAF、入站防护、规则组、具体规则是否开启,以及规则是否仍为「仅记录」;确认节点已更新配置 |
| 普通页面突然返回 400/401 | 检查 OpenAPI/JWT 规则是否覆盖了公开页面;可先把相关规则改回「仅记录」,调整路径范围后再验证 |
| 登录请求没有被识别 | 核对实际提交路径、POST 方法、表单/JSON 格式,以及用户名和密码字段名 |
| 开启密码检查后没有提示用户 | 需要源站读取检查结果并实现提示流程;预设只打标签 |
| 有 WAF 命中却没有攻击告警 | 检查是否仅记录、阈值和倍数是否同时满足、是否仍在告警间隔内,以及日志采集是否正常 |
| 脚本监控没有报告 | 核对页面路径、200 HTML 响应和报告策略响应头;确认浏览器实际访问,且出现了未允许来源;没有报告不代表页面没有脚本 |
| 点击「允许脚本来源」后未生效 | 还需点击「保存」,并等待节点更新配置 |
每次调整后,请同时验证正常业务请求和预期会被命中的请求,确认访问结果、日志和源站行为符合预期。
Translated by AI from 简体中文Original (简体中文)
0 replies
Sort orderNo replies yet. Be the first to say something.