> For the complete documentation index, see [llms.txt](https://daddy-studios.gitbook.io/daddy-studios-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://daddy-studios.gitbook.io/daddy-studios-docs/scripts/daddy-marketplace/configuration/security.md).

# Security

Defaults are fine for most servers. Change these only if you understand what they protect.

```lua
Config.Security = {
    distanceCheck = true,
    maxDistance   = 10.0,           -- meters
    rateLimitMs   = 1000,
    maxRateLimitViolations = 5,
    rateLimitBlockMinutes  = 5,
}
```

## Distance check

`distanceCheck = true` requires the player to still be within `maxDistance` of the market they opened, for **every** action — not just when opening the UI. A player who walks away, or a modified client that never opened the UI at all, is refused.

The location itself is never taken from the client: the server remembers which market the player opened and uses that. Sending a different `location_id` changes nothing.

{% hint style="warning" %}
Turning `distanceCheck` off lets players trade from anywhere on the map. Only do that if your server design actually wants a phone-style marketplace.
{% endhint %}

## Rate limits

| Option                   | Meaning                                                                  |
| ------------------------ | ------------------------------------------------------------------------ |
| `rateLimitMs`            | Minimum time between two actions from the same player (default 1 second) |
| `maxRateLimitViolations` | How many times they may exceed that before being blocked                 |
| `rateLimitBlockMinutes`  | How long the temporary block lasts                                       |

The defaults let normal browsing, buying and bidding through untouched while stopping automated spam. If your players report being blocked during ordinary use, raise `maxRateLimitViolations` before lowering `rateLimitMs`.

## What the server validates

Every action is re-checked server-side, regardless of what the client sent:

* prices, quantities and totals are recalculated from the database row, never taken from the client
* item metadata comes from the seller's actual inventory item
* the category is resolved from `Config.ItemCategories` on the server
* the market location is the one the player opened
* blacklist, weapon block, price limits, payment restrictions, job and category rules all run again on the server

Records are claimed atomically in SQL before any money or item moves, so duplicate or simultaneous requests cannot both succeed. See [Database](/daddy-studios-docs/scripts/daddy-marketplace/database.md).

## Identifiers

Players never receive each other's real identifiers. The UI works with opaque ids, so a citizenid or license cannot be harvested from a listing, a bid or a seller profile. A seller who lists anonymously cannot be looked up from the listing either.

## Record retention

```lua
Config.HistoryRetentionDays = 90
```

Finished trades, history, resolved offers and delivered depot rows older than this are removed automatically. Open listings, active auctions, unfilled orders and undelivered items are never touched. `0` keeps everything forever. Details on the [Database](/daddy-studios-docs/scripts/daddy-marketplace/database.md) page.

## Next steps

* [Database](/daddy-studios-docs/scripts/daddy-marketplace/database.md)
* [Commands & Permissions](/daddy-studios-docs/scripts/daddy-marketplace/commands-and-permissions.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://daddy-studios.gitbook.io/daddy-studios-docs/scripts/daddy-marketplace/configuration/security.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
