# Sovereignty and security

Dibab handles health, bank, tax and inheritance documents and reads mailboxes. This page says what Dibab connects to, where it keeps secrets, which two writes it refuses, and what it leaves to the person who runs it. It is for anyone deciding whether to point it at their own documents.

## What Dibab connects to

The code opens a network connection in four places, and in no other:

- HTTP requests to the model server, at `ollama.url` in the configuration, which is `http://localhost:11434` by default, so on the same machine. No document and no file name goes anywhere else.
- `ssh` sessions to the machines you list, to read their folders. Nothing is modified or removed there.
- IMAP connections to the mailboxes you list, opened read-only. No message is marked as read, flagged, copied, moved or deleted.
- If you enable OAuth2 for a mail account, the exchange of the token with the provider's authorisation endpoint.

The only modules that import an HTTP library are the two that call the model server and the one that renews the OAuth2 token; the IMAP code uses the standard `imaplib` module.

## Where the secrets live

No secret is written in `config.json`. A mail password is read from an environment variable that the configuration names. An OAuth2 token lives in a separate file with mode `600`, outside any repository, and is never journaled or printed. The journal itself holds file names, senders and categories, which already tell a lot about a person (a letter from a health body is enough), so it belongs in the destination vault, not beside it: when the three `suivi.*` keys point into the vault it is written there, and when they are absent it is written in clear under `~/.local/state/dibab/`.

## The two refusals

Dibab will not write without a configuration, and will not write into a vault that is not mounted. Both were played in the container of each of the four systems, and the codes are the ones the manual lists:

```text
sans_configuration_EXIT=1
ERROR: configuration not found. Locations tried, in order:
        1. the --config option: not given
        2. the DIBAB_CONFIG variable: not given
coffre_non_prouve_EXIT=2
ERROR: vault professionnel: vault not mounted (type overlay, expected fuse.gocryptfs) (~/Classement/Professionnel)
        Nothing was touched. Mount the destination directory, then run again.
```

The second refusal reads the filesystem type that `findmnt` reports for the root of the vault. It must be `fuse.gocryptfs`, unless `systemes_fichiers_acceptes` in the configuration names the type of another encryption (LUKS, eCryptfs); on a plain folder Dibab stops before writing anything. That protection is only as good as the list: a type that does not encrypt, written in `systemes_fichiers_acceptes`, removes it.

## Doubt, simulation and undo

The default mode is the simulation, `--dry-run`. A document the models do not agree on goes to the `TO_CHECK/` folder of its vault (set by `sous_repertoire_a_verifier`; the duplicate folder by `destination.repertoire_doublon`). Dibab never deletes a document: a duplicate is copied to the `duplicate/` folder of the vault before its source is removed. It does prune its own old journals. `--rollback` puts back the files of a session from the journal, and when one of them has been moved or changed since, it says so, leaves it alone and exits with code 1.

> **Limit**
>
> The `ssh` and IMAP scanners have been run against stand-in servers only; a run on a real machine and a real mailbox has not been played. A filing is worth what your models are worth: on the first trial on fifteen real documents, Dibab filed two, set three aside as not administrative and put ten in `TO_CHECK/`, out of caution, so measure on your own documents before trusting it. Dibab does not guarantee the perimeter of a household: the administrator commits to it, and whatever is in doubt is left out. It runs on Linux only, and the version is young.


## Report a vulnerability

A flaw is reported in private through the repository's security tab, never in a public issue. The policy, with its delays and what counts as a flaw, is [SECURITY.md](https://github.com/RonanDavalan/dibab/blob/main/SECURITY.md).

