Skip to main content
The owasp-crs-request action enables rule processing on incoming HTTP requests to your endpoint. To use rule processing to block malicious HTTP responses, enable the OWASP CRS Response action.
Use both OWASP CRS actions for comprehensive protection.The Request action protects against malicious client requests (such as SQL injection and XSS attacks). The Response action protects against data leaks or vulnerabilities in your upstream service’s responses (such as exposed SQL error messages and sensitive data).Together, they provide defense-in-depth security for both incoming and outgoing traffic.
OWASP stands for the Open Web Application Security Project, an online community that, among other things, maintains annual lists of the most critical web application security risks. The OWASP Core Rule Set (CRS) is a set of attack detection rules that you can use in your Traffic Policies. It includes protections against attacks like SQL Injection, Cross Site Scripting, Local File Inclusion, and many others.

Configuration reference

This is the Traffic Policy configuration reference for this action.

Supported phases

on_http_request

Type

owasp-crs-request

Configuration fields

Behavior

This action evaluates rules for request headers and body (when process_body is enabled), and each matching rule adds to the overall score of a request. If the score exceeds the set score threshold, the action blocks the request. The tallying process is called Anomaly Scoring, and the CRS website describes it in detail. This action costs 10 Traffic Policy Units (TPUs) per request evaluated.

Default behavior

The default behavior for this action is based on the following Coraza directives and rules from v4.14.0 of the CRS: Included in these rules is an inbound anomaly score threshold of 5 and a paranoia level of 1.

Managing fallback behavior (on_error)

If on_error is set to halt (default) and the action encounters an error while evaluating rules, the Traffic Policy chain halts and no further actions run. For example, if you have a log action after the owasp-crs-request action, the log action doesn’t run and ngrok returns the error. However, if on_error is set to continue, actions that appear after the owasp-crs-request action still run even if the owasp-crs-request action encounters an error.

Body processing

When process_body is enabled, ngrok buffers and evaluates rules against the first 4KB of the body. If the body is larger than 4KB, ngrok ignores the portion after the first 4KB.
Enabling process_body buffers the request body in memory, which may increase latency for large payloads.

Rule exclusion

When exclude_rule_ids is configured, ngrok skips evaluation of the specified rule IDs. This allows you to disable specific OWASP CRS rules that may be causing false positives in your environment.

Inbound anomaly score threshold exceeded

If the anomaly score accumulated from matching rules exceeds the threshold, ngrok blocks the request with a HTTP 403 response. The request doesn’t make it to your upstream.

Failure to process the body successfully

If ngrok can’t read the request body successfully, ngrok blocks the request with a HTTP 500 response. The request doesn’t make it to your upstream.

Non-terminating action

This is a Non-terminating action. It does not return a response, and will allow Traffic Policy processing to continue to the next Action in the chain. All Cloud Endpoint Traffic Policies must end with a terminating action. This requirement does not apply to Agent Endpoints.

Examples

Running in block mode

The following configuration demonstrates how to run the owasp-crs-request action in block mode.

Example Traffic Policy document

Example request that ngrok would block

In this example, a curl command attempts to connect to example.ngrok.app, and ngrok blocks the request and returns ERR_NGROK_3700.

Running in test mode

The following configuration demonstrates how to run the owasp-crs-request action in test mode, where the action evaluates rules but doesn’t enforce blocks.

Example Traffic Policy document

Action result variables

The following variables are made available for use in subsequent expressions and CEL interpolations after the action has run. Variable values will only apply to the last action execution, results are not concatenated.