# 4. Security Rules

### 🛡️ Security Rules

The **Security Rules** section in ShieldsGuard provides powerful tools to filter, block, or manipulate specific aspects of incoming HTTP requests. This section empowers administrators to define granular behavioral policies, harden exposed endpoints, and mitigate suspicious or malicious activity on a per-rule basis.

Each rule type is modular, giving you complete control over how your system handles traffic based on IPs, headers, methods, paths, query strings, or even post payloads.

Below is a breakdown of what each rule type allows you to control:

***

#### 🔲 BlackList & WhiteList

Define explicit IP addresses or CIDR ranges to **block or allow** regardless of other rules or protections.

***

#### 📘 User Agent Filtering

Create rules based on the **User-Agent** header. Useful for blocking known bots, outdated clients, or malicious scanners.

***

#### 🧵 Query String Filtering

Inspect query parameters and block requests that contain suspicious or forbidden values.

***

#### 📥 HTTP Header Filtering

Control request behavior by filtering based on specific **HTTP headers**, such as `Referer`, `Origin`, or custom-defined headers.

***

#### 🚫 Block POST Values

Prevent requests containing specific keywords or data patterns in POST bodies. Ideal for blocking form spam or injection attempts.

***

#### 🔄 Custom Headers

Inject or modify **custom headers** into responses for security, debugging, or routing logic.

***

#### ⛔ Block URL Requests

Block access to specific URL strings or patterns regardless of method or query.

***

#### 🧭 URL Path Blocking

Block entire **URL path segments** such as `/admin`, `/debug`, or `/staging`. Supports wildcards and nested directories.

***

#### 🔐 Encrypt Path

Obfuscate sensitive paths using encryption to prevent reconnaissance and endpoint enumeration.

***

#### 🧹 Remove Request Value

Strip or replace parts of the request URI, headers, or parameters before it reaches backend services.

***

#### 🚫 Exclude Directories from Protection

Bypass WAF/DDoS inspection for specific static folders (e.g., `/uploads`, `/assets`) to improve performance or avoid unnecessary filtering.

***

> 🧠 These security rules act as a flexible policy enforcement layer — perfect for scenarios where WAF alone is not enough or too generalized.

Proper use of Security Rules gives you **surgical control** over traffic behavior, making ShieldsGuard a highly adaptable security platform for modern, high-risk environments.

{% content-ref url="/pages/9hK2LWCDIcBmoV2KBi3S" %}
[4.1 BlackList & WhiteList](/getting-started/4.-security-rules/4.1-blacklist-and-whitelist.md)
{% endcontent-ref %}

{% content-ref url="/pages/ilIPJjVyjAFq8ex7A9cd" %}
[4.2 User Agent Filtering](/getting-started/4.-security-rules/4.2-user-agent-filtering.md)
{% endcontent-ref %}

{% content-ref url="/pages/CzpcIbxskaxV8ibRjt54" %}
[4.3 Query String Filtering](/getting-started/4.-security-rules/4.3-query-string-filtering.md)
{% endcontent-ref %}

{% content-ref url="/pages/jSoDvXeGXL1cJ6jEP4LS" %}
[4.4 HTTP Header Filtering](/getting-started/4.-security-rules/4.4-http-header-filtering.md)
{% endcontent-ref %}

{% content-ref url="/pages/oixntE8HLAgj7YSDdKId" %}
[4.5 Block POST Values](/getting-started/4.-security-rules/4.5-block-post-values.md)
{% endcontent-ref %}

{% content-ref url="/pages/Wym2pEEEOLh6FUqCB1UL" %}
[4.6 Custom Headers](/getting-started/4.-security-rules/4.6-custom-headers.md)
{% endcontent-ref %}

{% content-ref url="/pages/mIicMhqPJug3t5LEHzHE" %}
[4.7 Block URL Requests](/getting-started/4.-security-rules/4.7-block-url-requests.md)
{% endcontent-ref %}

{% content-ref url="/pages/Ejp51Rc62M0pP7OMYTYE" %}
[4.8 URL Path Blocking](/getting-started/4.-security-rules/4.8-url-path-blocking.md)
{% endcontent-ref %}

{% content-ref url="/pages/AiZF70VqvZPrn3TAD8cS" %}
[4.9 Encrypt Path](/getting-started/4.-security-rules/4.9-encrypt-path.md)
{% endcontent-ref %}

{% content-ref url="/pages/nlmq35L5xfuzZAuDaYzj" %}
[4.10 Remove Request Value](/getting-started/4.-security-rules/4.10-remove-request-value.md)
{% endcontent-ref %}

{% content-ref url="/pages/4mLocuWKcnKFBWW4eSBJ" %}
[4.11 Exclude Directories from Protection](/getting-started/4.-security-rules/4.11-exclude-directories-from-protection.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shieldsguard.com/getting-started/4.-security-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
