> For the complete documentation index, see [llms.txt](https://docs.hipersnipe.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hipersnipe.com/architecture/security.md).

# Security model

## Wallet encryption

Private keys are encrypted at rest using **Fernet** (symmetric AES).

| Component      | Location                                                    |
| -------------- | ----------------------------------------------------------- |
| Master key     | `ENCRYPTION_KEY` env var or `secure_storage/encryption.key` |
| Per-user salt  | Stored with encrypted key material                          |
| Implementation | `encryption.py` → `EncryptionManager`                       |

Keys are decrypted only in memory at trade execution time. The bot never displays private keys in Telegram.

## Token security checks

Before and during trading, `assets_security.py` and RugCheck integration evaluate:

* Mint authority renounced
* Freeze authority revoked
* LP burn / lock status
* Bundle concentration (top holder %)
* Honeypot probe (optional, admin toggle)

Pump.fun bonding tokens use relaxed defaults where LP checks do not apply.

## RPC security

* Secrets in `.env` only—never in code or git
* Admin RPC hot-swap via DB does not expose keys in Telegram messages
* dRPC URLs filtered to prevent credit burn and blocked methods

## Telegram security

* `middleware/security_telemetry.py` — anomaly logging to `security.log`
* `middleware/maintenance.py` — maintenance mode gate
* Admin commands restricted to `ADMIN_USER_IDS`

## Partner channel interceptor

Bot must be channel admin with **Edit Messages of Others** to inject buy buttons. Without this permission, injection silently fails.

## Operational hygiene

1. Run bot as dedicated Linux user (not root)
2. Restrict `.env` and `secure_storage/` file permissions (`chmod 600`)
3. Use firewall; expose no public ports except SSH
4. Rotate `ENCRYPTION_KEY` only with a planned migration (requires re-encrypting all keys)

## Disclaimer

See [Disclaimer](/legal/disclaimer.md). The team is not liable for fund loss from software bugs, RPC failures, or user error.


---

# 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 dynamically by asking a question.

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

```
GET https://docs.hipersnipe.com/architecture/security.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
