# Encryption and access

## Encryption in transit

| Service                                                                                                           | Protection                                                                                                    |
| ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| **Websites and applications** (my.simafri.com, Simafri Suite, Simafri ERP, Serenity websites, this documentation) | HTTPS; an `http://` address redirects to `https://`                                                           |
| **Client area and Simafri ERP**                                                                                   | one-year HSTS, content security policy (CSP), display inside a third-party frame forbidden                    |
| **Mail collection** (IMAP 993, POP3 995)                                                                          | TLS from the start of the connection, TLS 1.2 at least; no plain-text port                                    |
| **Mail sent** from software (SMTP 587)                                                                            | mandatory TLS; the password is accepted only under TLS                                                        |
| **Mail between servers**                                                                                          | TLS offered and used as soon as the other server speaks it, certificate verified                              |
| **Calendars, contacts, Drive** (CalDAV, CardDAV, WebDAV)                                                          | HTTPS                                                                                                         |
| **Web hosting**                                                                                                   | mandatory encrypted FTP; SFTP and SSH                                                                         |
| **VPS**                                                                                                           | SSH with a key; your websites' HTTPS reaches your server untouched, and your server keeps its own certificate |

Session cookies are restricted to HTTPS, out of reach of the page's scripts and limited to the site that set them.

## Encryption at rest

* **Application backups** are encrypted on our machines before leaving for the vault, which receives only encrypted data, then encrypted a second time in storage (AES-256).
* **VPS and web hosting backups** are encrypted on the host server before being copied outside the data centre; the key is held in escrow, separately.
* **Simafri ERP attachments** (scanned invoices, receipts) are encrypted by the application itself, with AES-256-GCM, using a key specific to each account.
* **Secrets** (passwords of migrated mailboxes, sending keys, the two-factor authentication secret) are encrypted in the database.
* **Passwords and tokens** are never stored in plain text: they are kept as hashes, and compared in constant time.

## Authentication

### Your Simafri identity

Your Simafri identity opens the client area [my.simafri.com](https://my.simafri.com/), Simafri Suite and the editing of your Serenity website.

* **Two-factor authentication** with an authenticator app: a six-digit code renewed every thirty seconds, refused if it has already been used, and ten single-use backup codes, kept as hashes. See [Two-factor authentication](https://docs.simafri.com/en/espace-client/double-authentification/).
* **Passwords** of at least twelve characters. A password that has already appeared in a public data breach is refused: the check sends only the first five characters of its hash, never the password.
* **Brakes**: five sign-in attempts per minute, five two-factor authentication codes per quarter of an hour.
* **Short-lived links**: a new-password link is valid for one hour, an invitation for seven days, and a new invitation cancels the previous one.

### Simafri Suite

* Each mailbox has its own password, of at least twelve characters, which the account holder gives and resets; each change is announced in the mailbox itself.
* **Application passwords** give each device (Outlook, a phone) its own access, limited to mail or to calendars, and revocable one by one.
* Against repeated attempts on IMAP, POP3, SMTP and calendars: beyond ten failures in a quarter of an hour, a source is stopped; if a mailbox is targeted from everywhere at once, only the networks it usually uses still get through.
* Sending from an unusual network abroad is limited to five messages per hour, until the network is recognised: a stolen password is not enough to turn the mailbox into a source of spam.

### Simafri ERP

* Passwords of at least twelve characters, five sign-in attempts per quarter of an hour.
* An invitation is valid for 72 hours and works only once.
* Suspended access closes open sessions on the spot.

## Roles

Each product sets out what each person can see and do:

| Product           | Roles                                                                                |
| ----------------- | ------------------------------------------------------------------------------------ |
| **Client area**   | owner, manager, operator, employee; billing, members and domains stay with the owner |
| **Simafri Suite** | owner, manager, operator, employee; a mailbox is read only by the people who read it |
| **Simafri ERP**   | owner, manager, operator                                                             |
| **Serenity**      | holder and editors; the website's appearance and invitations stay with the holder    |

See [Members and roles](https://docs.simafri.com/en/espace-client/membres-et-roles/).

## Isolation between clients

Each client's data is separated by account: queries to the database are restricted automatically to the account of the signed-in person. Simafri ERP's automated tests check this isolation with every change. A Serenity website is served only under its own domain names, and an email address can be created only on a domain of the account.

## The Simafri team's access

* The team's back office is closed to the public: it requires strong authentication in front of the application, and answers any other visitor like a page that does not exist.
* The Simafri team does not enter a client's Simafri ERP.
* The administration tools open to the team's AI assistants are read-only on Simafri Suite and on Simafri ERP.

## AI assistants connected through MCP

Your Simafri products connect to your AI assistant through MCP. These connections follow OAuth security rules:

* **mandatory PKCE**, in its S256 form;
* **one-hour access tokens**, renewed by a token that changes with every use; a replayed token revokes the whole authorisation;
* **the rights of the person who authorises**, never more: the assistant sees what that person's screen shows them;
* **Simafri ERP** offers a **read-only** authorisation or a read and write one;
* **revocation is immediate**, from each product's connected applications screen.

Every action an assistant takes on a Serenity website is recorded in the website's log, in your name, and every call to the client area's MCP server is logged, without the values you pass to it.

## Traceability

* **Simafri ERP** keeps an audit log that the database itself forbids anyone to modify or erase. An issued invoice is neither modified nor deleted, numbering is continuous with no gaps, and a correction goes through a credit note.
* **Serenity** records every action on a website (who, when, through which channel, on which document) in the website's log, and keeps every version restorable.
* **Simafri Suite** records on each mailbox's screen who reads it, and every password change, with its date and its author.
