# Security

***

## 🔒 Security

### 6 Layers of Protection

#### 1. Server-Side Material Verification

All material checks happen on the server. Client cannot fake having items.

#### 2. Distance Check

Server verifies player is within `maxTableDistance` of the craft table.

```lua
Config.Security.maxTableDistance = 10.0
```

#### 3. Time Validation

Server tracks craft start time and validates completion time. Speed hacks are detected.

```
Config.Craft.timeTolerance = 2000  -- 2 second tolerance for lag
```

#### 4. Rate Limiting

Maximum requests per second per player.

```
Config.Security.rateLimit = 3
```

#### 5. Duplicate Prevention

Only one active craft per player. Attempting multiple crafts is flagged.

#### 6. Queue System

Maximum concurrent craft operations.

```
Config.Craft.maxQueue = 5
```

### Punishment Options

```
Config.Security = {
    logSuspicious  = true,     -- Log to console and webhook
    kickOnExploit  = false,    -- Kick player on detection
    banOnExploit   = false,    -- Ban player on detection
    banSystem      = 'qb',    -- 'qb' | 'esx' | 'custom'
    banDuration    = 0,        -- 0 = permanent (in minutes)
}
```

### Discord Logging

When `Config.Webhook.exploit` URL is set, all security violations are logged to Discord with:

* Player name and identifier
* Violation type
* Detailed data (distance, timing, etc.)
* Server name and timestamp


---

# 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://elena-scripts.gitbook.io/elenascripts/gameplay/craft-system/security.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.
