Add security hardening and PostgreSQL 18 upgrade support

Add ALLOWED_HOSTS configuration to restrict trusted hosts in TrustedHostMiddleware. Enhance SSRF protection to block all private, loopback, link-local, multicast, reserved, and unspecified IP addresses using ipaddress module and DNS resolution checks. Add encrypt_value/decrypt_value aliases for encryption functions. Upgrade PostgreSQL from 16 to 18.4 in Docker Compose with updated data directory path (/var/lib/postgresql). Add security_opt no
This commit is contained in:
2026-06-21 09:44:47 +02:00
parent d694c8b8e3
commit dfec7976c4
8 changed files with 78 additions and 20 deletions
+15
View File
@@ -112,6 +112,21 @@ docker compose up -d
docker compose exec api alembic upgrade head
```
### PostgreSQL 18 Upgrade Note
The bundled Docker Compose stack uses PostgreSQL 18.4. PostgreSQL 18 changed the
official Docker image data directory, so existing PostgreSQL 16/17 deployments
should be backed up before upgrading and restored into the new container:
```bash
docker compose exec postgres pg_dump -U nexadash nexadash > nexadash-backup.sql
docker compose down
docker volume rm nexadash_postgres_data
docker compose up -d postgres
docker compose exec -T postgres psql -U nexadash nexadash < nexadash-backup.sql
docker compose up -d
```
## Developer Setup
### Backend