Appearance
Approve rules and preview their impact Since v0.1
Approved rules live in the policy under positive.rules, one rule per endpoint (METHOD /template). Learned rules (source: learned) and manual rules (source: manual) are the same object, so every approval is a new policy version with a diff, an audit entry and a rollback.
Before you begin
- Role:
operator. Viewers can preview impact and read rules. - Keep the module in
detectmode until the preview and the events agree. - Keep
unknown_endpointsatlogwhile you approve endpoint by endpoint.
Approve suggestions
You can approve a whole endpoint, a single parameter, every new suggestion at once, or an edited suggestion (it stays learned). Approving one parameter of an endpoint without a rule creates a rule that accepts any content type and knows the other parameters by name only.
text
1. Open Learned model > Suggestions.
2. Select Approve... beside a new endpoint or parameter, or Approve all new.
3. In the dialog, select Preview approval: it shows seven days of traffic impact
and the dry-run policy changes.
4. Enter a comment and select Approve rules. Close approval cancels.sh
waap learning suggestions -app shop
waap learning preview -app shop -id ID
waap learning approve -dry-run -app shop -id ID
waap learning approve -m "Reviewed" -app shop -id IDRepeat -id for several items; -all selects all new endpoints; -f edited-rules.yaml takes a list of edited rules. These selections are exclusive. The CLI reads the suggestions' policy version before it submits.
Edit before approving
Select Edit before approve on a new endpoint. The form has content types (one per line), each parameter's name and location, type, minimum and maximum length in bytes, required, character classes and enum values (one per line). Empty content types accept any; none means no body; maximum length 0 is unbounded. Preview the edited rule before you approve it.
When approval is refused
| Answer | Cause | Fix |
|---|---|---|
| 422 | A manual rule covers the endpoint, even a wider one such as GET /{x} over GET /items. | Edit the manual rule instead. |
| 422 | The suggestion is rejected, or the selection holds nothing new. | Restore it first. |
| 409 | The policy changed since you read the suggestions (base_version). | Read again, preview again, repeat. Nothing is retried for you. |
A new endpoint marked in policy already has a learned rule that no longer covers everything learned; approving it again replaces that rule.
Preview the impact
The preview evaluates the policy's rules, with your approval merged in, against the last days of observed clean traffic (default 7, range 1 to 90) and against recorded attacks. Nothing changes. What the rules would refuse in clean traffic is the expected false-positive rate.
text
1. Open Learned model > Rules and preview, Preview current rules.
2. Set Days (1 to 90). Optionally select Override enforcement for this preview
and choose the three checkbox values.
3. Select Preview impact.sh
waap learning preview -days 30 -refuse-unknown-endpoints -app shop
waap learning preview -json -no-confirm -app shopObservations keep shapes, not values, so each count is a range: exact where one check decides (type, required, content type, unknown parameter), an upper bound where several checks may hit the same request (~ in the table). Rate is the upper bound divided by the observed requests. Per endpoint the preview lists rule ID, parameter, count, action and the expected profile in words. Manual RE2 patterns are listed as unchecked.
For recorded attacks, the preview reads up to 5,000 recent events that another module refused and reports how many the rules would have caught, by rule ID, with up to 50 examples. Snippets follow the application's logging mask, so the count is a lower bound. With confirm_anomalies on, a value counts as refused if confirmed only when the attack classifier recognises an attack in the snippet.
Write manual rules
text
1. Open Learned model > Rules and preview, Positive rules.
2. Select Add manual rule, Edit rule ... or Remove rule ....
3. Fill in the form (same fields as an edited suggestion, plus the endpoint,
source and RE2 pattern).
4. Select Preview changes, then Apply. Close rule form cancels.sh
waap positive rules add -dry-run -app shop -f one-rule.yaml
waap positive rules add -m "order rule" -app shop -f one-rule.yaml
waap positive rules edit -app shop -endpoint 'POST /api/orders/{id}' -f one-rule.yaml
waap positive rules remove -app shop -endpoint 'POST /api/orders/{id}'
waap positive rules list -json -app shopyaml
# applications[].policy.positive in the configuration
positive:
unknown_endpoints: log
rules:
- endpoint: "POST /api/orders/{id}"
source: manual
content_types: [application/json]
parameters:
- { name: id, in: path, type: integer, required: true }
- { name: code, in: json, pattern: "^[A-Z]{3}-[0-9]+$" }The manual-rule CLI reads one mapping per file. An omitted source is manual. You can also edit the whole list: waap rules get|set -app shop -list positive_rules.
Rule fields
| Setting | What it does | Default | Allowed values | Applies in |
|---|---|---|---|---|
endpoint | METHOD /template. Variables are whole segments such as {id}. | required | a method and a path | all |
content_types | Accepted content types. | any | list; none for no body | all |
parameters[].name, in | The parameter. | required | in: path, query, form, multipart, json, xml, header, cookie | all |
type | Expected value type. | any | boolean, integer, decimal, uuid, hex, datetime, email, base64, alphanumeric, text | all |
length | Length in bytes. | unbounded | max: 0 is unbounded | all |
required | Request is refused when missing. | false | true, false | all |
charset | Allowed character classes. | any | classes | all |
enum | Allowed values. | none | up to 256 values | all |
pattern | RE2 expression the value must match. | none | up to 1 KiB | manual rules only |
The most specific template matches a request: literal segments win, from the left.
Limits
| Limit | Value |
|---|---|
| Rules per application | 5,000 |
| Parameters per rule | 128 |
| Enum values per parameter | 256 |
| Pattern length | 1 KiB (RE2 only) |
| Preview window | 1 to 90 days |
| Attack events read by the preview | 5,000 (up to 50 examples) |