- app runs as uid 1000; a one-shot data-permissions service chowns ./data to it and closes it to others (works on an older root-owned install with no host sudo); files are created 0600 (umask 077) - python:3.12-slim and caddy:2-alpine pinned by digest; dependencies installed from requirements.lock with --require-hashes - the Fernet key is XPRV_ENCRYPTION_KEY_FILE (./secrets/xprv_encryption.key, a compose secret), out of every environment variable and of a ./data backup - setup.md no longer presents a second way to run the server (B-72) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
26 lines
1.5 KiB
Markdown
26 lines
1.5 KiB
Markdown
# ADR-01 — La piattaforma è custodiale: tutte le chiavi sono generate e tenute dal server
|
|
|
|
- **Stato:** Accettata
|
|
- **Area:** Custodia, chiavi e indirizzi
|
|
- **Fonte di verità per:** la scelta di progetto descritta qui sotto; i requisiti (`PREFISSO-NN`) che la attuano stanno nei documenti di dominio, indicati nelle *Conseguenze*.
|
|
|
|
## Decisione
|
|
|
|
**La piattaforma è custodiale: tutte le chiavi sono generate e
|
|
tenute dal server.** Una sola master xprv, cifrata con Fernet a riposo; la
|
|
chiave di cifratura sta in un file montato nel container
|
|
(`XPRV_ENCRYPTION_KEY_FILE`, permessi `0600`, vedi
|
|
[architettura.md](../architettura.md#configurazione)), mai nel database né in
|
|
git. L'utente non controlla nulla finché non preleva.
|
|
- *Motivazione:* un'esperienza da «conto» (registrazione con username e
|
|
password, scommessa con un clic) senza portafoglio lato utente, firme o
|
|
PSBT da gestire nel browser.
|
|
- *Alternative scartate:* portafoglio non custodiale con firma lato client.
|
|
- *Conseguenze:* la compromissione del server (file cifrato + variabile
|
|
d'ambiente) espone tutti i fondi; da qui l'esportazione WIF accettata
|
|
([ADR-39](ADR-39-l-esportazione-chiave-privata-wif-utente.md)), l'assenza di recupero password ([ADR-37](ADR-37-nessun-recupero-password-reset.md)) e il modello di
|
|
minaccia di [sicurezza.md](../sicurezza.md).
|
|
|
|
*Codice:* `app/wallet/hd.py:_load_account_key` · `app/wallet/keystore.py:decrypt_xprv` · `app/wallet/hd.py:generate_master_key` ·
|
|
*Test:* `tests/unit/test_hd.py`
|