HotelHub HMSDocs

15 — Admin & Application Security #

Defense-in-depth across auth, authorization, secrets, audit, integrity. Both admin (vendor) panel dan user (hotel) panel covered.


1. Authentication #

Password policy #

2FA / MFA #

Session #

Login surface protection #


2. Authorization (RBAC) #

Layered #

  1. Authentication — siapa kamu? (login)
  2. Tenancy guard — kamu ngakses tenant yang benar?
  3. Property scope — kamu ngakses property yang punya akses?
  4. Role permission — kamu boleh lakukan action ini?
  5. Resource ownership — kamu owner of resource (kalau applicable, e.g. cashier hanya bisa edit folio shift-nya sendiri)?

Implementation #

Threshold-gated actions #

Beberapa action butuh approval (di atas threshold):

Workflow: requester submit → manager approve / reject → action executed. Logged di approval_requests.


3. Secret management #

App-level secrets (di .env) #

Tenant-managed secrets (BYOK) #

Storage:

Code-level secret hygiene #


4. Audit log #

Model #

audit_logs
├── id, property_id (nullable for global events)
├── user_id, user_type (admin|staff|api)
├── action (string e.g. 'reservation.created', 'user.login', 'secret.rotated')
├── auditable_type, auditable_id (polymorphic)
├── before (json, nullable)
├── after (json, nullable)
├── ip, user_agent, request_id
├── metadata (json — extra context)
└── created_at

What's logged (mandatory) #

Retention #

Tamper-evidence #


5. Data protection (UU PDP) #

Lihat juga 08-INDONESIA_COMPLIANCE.md untuk full PDP coverage.

Tagging PII #

Per kolom DB di-tag PII level via comment / migration metadata:

Access control #

Right to erasure #

Endpoint admin "Forget guest":

Data export (right to portability) #

Endpoint "Download my data" → ZIP berisi JSON profile + reservation history + folio.

Breach notification #


6. Network / infra security #


7. CSRF, XSS, SQLi, SSRF #


8. Dependency security #


9. Encryption at rest #


10. License & integrity check #

Aplikasi self-check:

Detail di 16-LICENSE_PAIRING_DESIGN.md.


11. Penetration testing #

Sebelum public launch:


12. Compliance certifications (target jangka panjang) #


13. Incident response #

Runbook urutan saat insiden:

  1. Detect — alert from monitoring / user report
  2. Classify — severity 1-4
  3. Contain — isolate affected system, rotate compromised secrets
  4. Eradicate — patch root cause
  5. Recover — restore service, verify integrity
  6. Postmortem — blameless writeup, action items, timeline
  7. Notify — affected parties, regulator (kalau PDP scope)

On-call rotation untuk SaaS mode (P2 saat ada ≥3 paying tenants).


14. Threat model summary #

Threat Mitigation
Stolen staff credential 2FA + lockout + alert
Insider exfil financial data Audit log + tamper detection + export approval
OTA channel injection (fake booking) Webhook signature verify, manual review high-value bookings
Card fraud via direct booking PG fraud module + Captcha + velocity checks
Ransomware on hotel server Encrypted backup + offsite (S3) + restore drill quarterly
API key leak by integrator Per-token scope + rate limit + revoke on detect
BYOK provider compromise (e.g. AI key leaked from staff) Notification + 1-click rotate from admin

15. Open questions #

  1. WebAuthn passkey adoption tier — Phase 2 atau lebih awal?
  2. Hardware security key support (YubiKey) untuk owner — niche, P2?
  3. SOC 2 timeline — mungkin Phase 3 saat ada >50 paying SaaS tenants?
  4. SIEM integration (Splunk/Datadog/Elastic) untuk owner enterprise — opt-in feature?