docs: correct LOG_EXPOSE_API scope — does not gate /openapi.json or /docs
Those two routes are only gated by requireAdminAuth (Basic Auth), independent of LOG_EXPOSE_API, which controls /api/logs* and the dev/test echo endpoints. Previous wording implied all of /api/logs*, /openapi.json, and /docs shared the same LOG_EXPOSE_API gate. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
0936b0e84f
commit
28ccc8001f
|
|
@ -40,7 +40,9 @@ LOG_TO_CONSOLE=true
|
|||
LOG_BUFFER_SIZE=1000
|
||||
|
||||
# Exposes GET /api/logs, /api/logs/files, /api/logs/files/:filename, /api/logs/view,
|
||||
# /openapi.json, /docs. Defaults to false (closed) when unset — opt in explicitly.
|
||||
# and registers the LOG_EXPOSE_API-only dev/test endpoints (/api/echo, /api/echo2,
|
||||
# /api/test/notify-erp). Does NOT affect /openapi.json or /docs (those are gated only
|
||||
# by LOG_BASIC_AUTH_USER/PASS below). Defaults to false (closed) when unset.
|
||||
LOG_EXPOSE_API=false
|
||||
# Required in production to protect the log endpoints (HTTP Basic Auth, browser-native prompt).
|
||||
# Leaving these empty only works in non-production NODE_ENV.
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ Paling nyaman dibaca lewat `GET /api/logs/view` (filter level, cari teks, klik n
|
|||
1. **Signature Verification** — webhook, token payment link, notifikasi ERP semuanya ditandatangani/diverifikasi.
|
||||
2. **Idempotency** — cegah duplikasi order/notifikasi ERP; state disimpan konsisten pakai `order_id` yang sudah disanitasi (Midtrans-safe) di semua map internal (`activeOrders`, `notifiedOrders`, `orderRetryCount`, `orderMerchantId`), sehingga tidak ada mismatch walau `order_id` asli mengandung karakter seperti `:`.
|
||||
3. **API Key Authentication** — `X-API-KEY` untuk `/createtransaksi` dan `POST /api/payment-links`. Dev mode fallback (bypass) hanya aktif kalau `NODE_ENV !== 'production'` **dan** key belum di-set.
|
||||
4. **HTTP Basic Auth untuk admin tooling** — `/api/logs*`, `/openapi.json`, `/docs` dilindungi `LOG_BASIC_AUTH_USER`/`PASS`, dan tertutup total secara default lewat `LOG_EXPOSE_API=false` (harus di-set eksplisit `true` untuk mengaktifkan). **Wajib set `LOG_BASIC_AUTH_USER`/`PASS` di production** sebelum mengaktifkan `LOG_EXPOSE_API`, karena gerbang Basic Auth-nya sendiri bergantung pada `NODE_ENV=production` untuk benar-benar dipaksa (lihat poin 8).
|
||||
4. **HTTP Basic Auth untuk admin tooling** — `/api/logs*`, `/openapi.json`, `/docs` semuanya dilindungi `requireAdminAuth` (`LOG_BASIC_AUTH_USER`/`PASS`). **Wajib di-set di production** — gerbang ini bergantung pada `NODE_ENV=production` untuk benar-benar dipaksa (lihat poin 8). Terpisah dari itu, `LOG_EXPOSE_API=false` (default) mematikan `/api/logs*` dengan 403 sekalipun auth-nya lolos, dan membuat endpoint dev/test (`/api/echo`, `/api/echo2`, `/api/test/notify-erp`) tidak terdaftar sama sekali — flag ini **tidak** memengaruhi `/openapi.json` atau `/docs`.
|
||||
5. **Rate Limiting** — `/createtransaksi`, `/api/payment-links`, `/api/payments/charge`, `/api/payments/snap/token` dibatasi per-IP (`RATE_LIMIT_MAX` request per `RATE_LIMIT_WINDOW_MS`) untuk mencegah bot abuse / card-testing pada endpoint yang memang harus tetap bisa diakses langsung dari browser tanpa API key.
|
||||
6. **CORS** — dibatasi lewat `CORS_ALLOWED_ORIGINS` (comma-separated). Kosong = izinkan semua origin (default dev).
|
||||
7. **Payload Masking** — field sensitif (card number, CVV, token, server key) otomatis disamarkan di log.
|
||||
|
|
|
|||
Loading…
Reference in New Issue