Core Protections
- JWT Authentication: 128-char secrets & refresh token rotation.
- Password Policy: Minimum length, complexity enforced.
- Account Lockout: ป้องกัน brute force (จำกัดจำนวนครั้ง / เวลารอ).
- Rate Limiting: แยกตาม endpoints (auth, payment, apiKeys).
- Helmet Security Headers: ป้องกัน XSS / clickjacking เบื้องต้น.
- CORS Restriction: Allowlist เฉพาะ origin ที่กำหนด.
- Input Validation: ใช้ express-validator ลด injection risk.
- Stripe Integration: ใช้ Payment Intents + webhook signature verify.
Headers
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 99
X-Content-Type-Options: nosniff
Content-Security-Policy: default-src 'self'
(CSP สามารถขยายเพิ่มเติมในอนาคตสำหรับ script-src เฉพาะที่จำเป็น)
Hardening Roadmap
- เพิ่ม Audit Log ครอบคลุมทุกการเปลี่ยนแปลงสำคัญ
- Implement refresh token rotation & blacklist
- เพิ่ม 2FA (TOTP) ในการล็อกอินผู้ดูแลระบบ
- เพิ่ม Subresource Integrity (SRI) hash ให้ CDN scripts
- แยก Secret ออกจาก build (ใช้ Vault/Secrets Manager)
Reference
ดูรายละเอียดเชิงลึกได้ที่ไฟล์ SECURITY_README.md ใน repository.