feat: require a write token or session on mutating portal API routes

- Adds IPFS_WRITE_TOKEN to lib/config.ts
- Default-deny per route (not per method): the public explorer issues reads as POST
- Existing portal session JWT remains valid, so the logged-in UI keeps working
- Public gateway reads (/ipfs/<cid>) are unchanged
This commit is contained in:
maikrolf
2026-09-30 21:10:21 +02:00
parent d0632d4dcc
commit 88f2c7e5aa
6 changed files with 520 additions and 0 deletions
+7
View File
@@ -22,3 +22,10 @@
# IPFS Gateway (for share links)
# NEXT_PUBLIC_GATEWAY_URL=https://ipfs.maos.dedyn.io
# Write-authentication voor muterende /api/* endpoints
# (POST /api/add, /api/files/upload, /api/pins; DELETE /api/files/<cid>, /api/pins/<cid>).
# Zonder deze waarde blijven writes OPEN met een luide waarschuwing in de log.
# Zelfde waarde als IPFS_WRITE_TOKEN aan de MAOS-kant (anders pint MAOS niet mee).
# Genereer met: openssl rand -hex 32
# IPFS_WRITE_TOKEN=