# Security

> The threat model, keys and tokens, signed commits, and the checklist.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://git.docs.sypnia.com/security/

For agents: Threats/defenses: stolen credentials (session bound to device key, 1 h git tokens, expiring fine-grained PATs hashed with prefix for scanning, SSH keys per person); history rewriting (protected branches, no force-push, audit log of ref updates); malicious pushes (size limits, pre-receive checks); secrets committed (push protection scans for known token formats and blocks); cross-tenant (authorization on every request in Sypnia's layer and the engine; repository paths by id); supply chain of the engine (pinned versions, upstream security releases applied within days); webhook spoofing (HMAC signatures). Signed commits: SSH or GPG, verified badge, rule 'require signed commits'.

## Threat model

| Threat                            | Defense                                                                                                                                                  |
| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Stolen credentials**            | sessions bound to a key on your device; git tokens that last one hour; HTTPS tokens that expire, are stored hashed and carry a prefix scanners recognize |
| **Rewritten history**             | protected branches, no force-push, and a log of every branch update with who and when                                                                    |
| **A secret pushed by mistake**    | push protection: known token formats are detected and the push is blocked, with how to fix it                                                            |
| **One customer reaching another** | every request authorized in our layer and again in the engine; repositories stored by id, never by name                                                  |
| **A flaw in the engine**          | pinned versions; security releases applied within days                                                                                                   |
| **Forged webhooks**               | every delivery signed with HMAC-SHA256                                                                                                                   |

## Signed commits

Sign with your [SSH key](https://git.docs.sypnia.com/access/ssh-keys) or GPG. Signed commits show as **verified**, and a branch rule can require them.

## Checklist

- Protect `main`: pull requests, one approval, no force-push (the default).
- Prefer your Sypnia session to tokens on your own machines.
- Give tokens and deploy keys the least access, and an expiry.
- Turn on signed commits for production branches.
