Skip to content

Modes and limits Since v0.1 ​

These settings apply to a whole application: its protection mode, what happens when inspection fails, the allowed methods and the bounds on each request. The last section covers settings that are shared by every application.

Before you begin ​

  • Role: operator for the application (viewer can read the settings).
  • To judge detect results, you need the application's events: Monitor > Events.

Switch an application between detect and block ​

In detect, the application logs what it would block. In block, it stops attacks. A module in block inside an application in detect only logs. The workflow: watch the events, add exceptions for false positives, then switch to block.

text
1. Open Applications > All applications, and select the application.
2. Open Request checks > General.
3. Under Security policy, set Protection mode.
4. Select Preview changes, add a comment and select Apply.
sh
waap apps set -app shop -m "enforce" policy.mode=block
yaml
# applications[].policy in the configuration
policy:
  mode: block

A false positive blocks a real user

Read a few days of events from normal traffic before you switch to block.

Choose the failure policy ​

The failure policy decides what happens when inspection itself fails: an error in the pipeline, a module that stops at its time budget, or Envoy not reaching the inspection service.

text
1. Open Applications > All applications, and select the application.
2. Open Request checks > General.
3. Under Security policy, set When inspection fails.
4. Select Preview changes, add a comment and select Apply.
sh
waap apps set -app shop -m "refuse when inspection fails" policy.on_inspection_failure=fail_closed
yaml
policy:
  on_inspection_failure: fail_closed   # default: fail_open

fail_open passes the request. fail_closed refuses it with 503.

fail_closed can refuse all traffic

If the inspection service is down, every request to a fail_closed application is refused. Use it where a missed attack costs more than an outage.

Set request limits ​

Limits bound the work done for one request. An over-limit request is refused with 413 (body) or 431 (headers), and an event explains why.

text
1. Open Applications > All applications, and select the application.
2. Open Request checks > General.
3. Under Request limits, set Request body, Headers, Header bytes, Parameters and
   Time per module.
4. Select Preview changes, add a comment and select Apply.
sh
waap apps set -app shop -m "bigger uploads" policy.limits.request_body=8MiB
yaml
policy:
  limits:
    request_body: 8MiB
    header_count: 100
    header_bytes: 32KiB
    arguments: 1000
    module_budget: 50ms

The time budget ​

policy.limits.module_budget bounds each module. What happens at the budget depends on whether the module has a result.

  • A module that stops without a result is an inspection failure. The failure policy decides, and the event's error names the module, for example signatures: stopped after request headers: context deadline exceeded.
  • A module that finishes late with a finding still acts on it: it blocks in block and logs in detect. The event keeps the overrun (signatures: exceeded time budget (61ms > 50ms)) and the request trace shows it.

Over-budget runs mean the host is overloaded or the rules are slow for the traffic.

Choose the allowed methods and the block status ​

policy.allowed_methods lists the methods the application accepts. Others are refused. Envoy's parser refuses unknown methods first, and they appear only in the access log. policy.block_response.status is the status sent with the block page.

sh
waap apps set -app shop -m "no PUT" policy.allowed_methods=GET,HEAD,POST,OPTIONS,PATCH,DELETE policy.block_response.status=403
yaml
policy:
  allowed_methods: [GET, HEAD, POST, OPTIONS, PATCH, DELETE]
  block_response: {status: 403}

Replace the block pages ​

Each application can show its own page for four situations: blocked, rate_limited (429), unavailable (503, inspection failed with fail_closed) and error. API clients get JSON with the event reference instead.

text
1. Open Applications > All applications, and select the application.
2. Open Traffic > Error and block pages.
3. For a kind, upload an HTML file. It is checked before you apply.
   Select Preview changes, then Apply. Reset returns to the built-in page.
sh
waap pages set -app shop -kind blocked -f page.html -m "branded block page"
waap pages reset -app shop -kind blocked

The page is plain HTML of at most 64 KiB. Scripts do not run in it. It can use the placeholders , , and .

Settings reference ​

Security policy ​

SettingWhat it doesDefaultAllowed valuesApplies in
Protection mode (policy.mode)Logs only, or stops attacks.detectdetect, blockall
When inspection fails (policy.on_inspection_failure)Pass or refuse the request when inspection fails.fail_openfail_open, fail_closedall
Allowed methods (policy.allowed_methods)Methods the application accepts.GET, HEAD, POST, OPTIONS, PUT, PATCH, DELETEuppercase HTTP methods, no duplicatesall
Block status (policy.block_response.status)Status sent with the block page.403400 to 599block

Request limits ​

SettingWhat it doesDefaultAllowed valuesApplies in
Request body (policy.limits.request_body)Bytes of request body accepted and inspected.1MiB1 byte to 64 MiBall
Headers (policy.limits.header_count)Request headers accepted.1001 to 1000all
Header bytes (policy.limits.header_bytes)Bytes of all request headers together.32KiB1 KiB to 1 MiBall
Parameters (policy.limits.arguments)Query and body parameters per request.10001 to 10000all
Time per module (policy.limits.module_budget)Inspection time one module may take per request.50ms1ms to 5sall

JSON and XML nesting depth and element counts are API protection limits, not application limits. Their defaults are 32 levels each, with a maximum of 512 (policy.api.limits.json.depth, policy.api.limits.xml.depth).

Settings shared by every application ​

Shared settings live outside any one application. Edit them under System > Settings, or with waap settings get SECTION and waap settings set SECTION KEY=VALUE... (get lists each key with its default and range).

SectionWhat it controlsWhere
eventsEvent storage: bytes of request body kept per event, retention, maximum event count and storage size.System > Settings > Event storage
trafficThe traffic log.System > Settings > Traffic log
geoipThe country database.System > Settings > Country database
bot_catalogWhether published search-engine ranges are downloaded, and your own catalog entries.Shared lists > Bot catalog
managementManagement access (administrators).System > Accounts and access
haHigh-availability pair settings (administrators).System > High availability

Event storage ​

SettingWhat it doesDefaultAllowed valuesApplies in
Request body bytes kept per eventCap on the body saved with an event.empty: each application's request body limit0 keeps none; at most 64 KiBall applications
RetentionHow long events are kept.720h (30 days)1h to 3 yearsall applications
Most events keptCount cap; the oldest go first.1000000up to 100000000all applications
Most event storage (max_bytes)Size cap; the oldest go first.2GiB1 MiB to 16 TiBall applications

Limits apply at the next cleanup, within minutes.

Durations use hours

Go durations have no d unit. Write 30 days as 720h.

Limits ​

LimitValue
Request body64 MiB maximum
Headers per request1000 maximum
Header bytes1 MiB maximum
Parameters per request10000 maximum
Module time budget5s maximum
Block page64 KiB

For every default and bound in one place, see Limits and defaults.

Troubleshooting ​

An attack was allowed although the application is in block. Cause: the module is in detect, or it exceeded its time budget without a result under fail_open. Check: the event's mode and error, and the request trace. Fix: set the module to block, or speed up the rules and raise the budget.

Requests are refused with 413 or 431. Cause: a request is over a limit. Check: the event of the refusal. Fix: raise the limit if the traffic is legitimate.

Requests are refused with 503. Cause: inspection failed and the application is fail_closed. Check: the inspection service status and the event's error. Fix: restore the service or choose fail_open.