S-13 sul modulo ufficiale e correzioni all'integrità dei dati
Modulo S-13 - Il PDF scrive sopra il modulo ufficiale (FPDI, matrice convertita in PDF 1.4) invece di ricostruirlo in HTML: 20 righe per foglio come l'originale. - Una riga per ogni territorio attivo; riporto dell'ultimo rientro prima dell'anno; assegnazioni a cavallo d'anno su entrambi i fogli; scelta per data e non per anno registrato; nomi come "Cognome I.". - Logica spostata in App\Services\Registro\ModuloS13. Integrità dei dati - Export/import XML (e quindi backup/ripristino): le date non slittano più di un giorno; i file vecchi in UTC tornano al giorno giusto. - Import XML: rifiuta file estranei o incompleti senza toccare i dati, errore con riga e motivo, territori senza zona importati con il loro storico, caratteri di controllo rimossi in export, chi importa conserva password e ruolo di amministratore. - Assegnazioni: assegnazioneCorrente corretta (filtro dentro ofMany), periodi sovrapposti rifiutati in Assegna e Registro sotto lock, anno di servizio ricavato dalla data, niente date future nel Registro. - Utenti: non si declassa sé stessi né l'ultimo amministratore. - Entrypoint: non sovrascrive più la copia persistente di APP_KEY con un valore diverso; serve APP_KEY_ROTATE=1 per un cambio voluto. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -78,6 +78,21 @@ ok "Storage directories ready."
|
||||
KEY_FILE="/var/www/html/storage/app/.app_key"
|
||||
|
||||
if [ -n "${APP_KEY:-}" ]; then
|
||||
# The persisted copy is the backup of the key the data was encrypted
|
||||
# with. If the environment now carries a different one (a typo in
|
||||
# Dokploy, a value pasted from another install), overwriting the file
|
||||
# would destroy the only copy of the right key: refuse to start instead.
|
||||
# A deliberate rotation keeps the old key aside and needs an explicit flag.
|
||||
if [ -s "$KEY_FILE" ] && [ "$(cat "$KEY_FILE")" != "$APP_KEY" ]; then
|
||||
if [ "${APP_KEY_ROTATE:-}" = "1" ]; then
|
||||
BACKUP_FILE="${KEY_FILE}.prev-$(date +%Y%m%d-%H%M%S)"
|
||||
cp "$KEY_FILE" "$BACKUP_FILE"
|
||||
warn "APP_KEY_ROTATE=1: the previous key was saved to $BACKUP_FILE."
|
||||
warn "Data encrypted with it stays unreadable until re-encrypted."
|
||||
else
|
||||
die "APP_KEY in the environment differs from the key persisted in $KEY_FILE. Starting would make the encrypted personal data unreadable. Restore the previous APP_KEY in the environment, or set APP_KEY_ROTATE=1 if the change is deliberate (the old key is kept aside)."
|
||||
fi
|
||||
fi
|
||||
ok "APP_KEY provided via environment."
|
||||
printf '%s' "$APP_KEY" > "$KEY_FILE"
|
||||
elif [ -s "$KEY_FILE" ]; then
|
||||
|
||||
Reference in New Issue
Block a user