Security Checklist Sebelum Deploy
Sebelum mendeploy aplikasi ke production, pastikan semua aspek keamanan sudah dicek. Checklist ini membantu memastikan tidak ada yang terlewat.
1. Authentication & Authorization
- Password di-hash dengan bcrypt atau Argon2
- Session management dengan HttpOnly, Secure, SameSite cookies
- Implementasi rate limiting pada login endpoint
- Semua endpoint sensitif memerlukan authorization check
- CSRF protection aktif untuk semua form
2. Input & Output
// Checklist validasi
// ✅ Semua input divalidasi di server-side
// ✅ Parameterized queries untuk semua database operations
// ✅ Output di-encode sesuai context (HTML, JS, URL)
// ✅ File upload divalidasi (tipe, ukuran, konten)
// ✅ Content-Type header di-set dengan benar
3. HTTP Security
# Headers yang harus ada
Strict-Transport-Security: max-age=31536000; includeSubDomains
Content-Security-Policy: default-src 'self'; ...
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Referrer-Policy: strict-origin-when-cross-origin
# Redirect HTTP ke HTTPS
# CORS dikonfigurasi dengan whitelist spesifik
4. Data Protection
- HTTPS aktif di semua environment
- Data sensitif di database terenkripsi
- Backup terenkripsi dan teruji
- PII (Personally Identifiable Information) dilindungi
5. Infrastructure
# Checklist server
# ✅ APP_DEBUG=false
# ✅ Error messages generik (tidak ekspos detail)
# ✅ Firewall dikonfigurasi
# ✅ SSH menggunakan key, bukan password
# ✅ Automatic security updates aktif
# ✅ Dependencies up-to-date dan di-audit
6. Secrets Management
- .env tidak di-commit ke git
- Semua secrets di environment variables atau secret manager
- Default credentials sudah diganti
- Debug endpoints dinonaktifkan di production
Tools untuk Automated Checking
# Scan dependencies
npm audit
composer audit
# Scan security headers
curl -I https://yoursite.com
# Online tools
# - securityheaders.com
# - observatory.mozilla.org
# - ssllabs.com/ssltest (TLS configuration)
# SAST tools
# - SonarQube
# - Snyk Code
# - GitHub CodeQL
Deployment Checklist Template
- [ ] Environment variables set di production
- [ ] Debug mode OFF
- [ ] Security headers configured
- [ ] HTTPS enforced
- [ ] Dependencies audited
- [ ] Database credentials rotated
- [ ] Backup verified
- [ ] Monitoring dan alerting aktif
- [ ] Rate limiting aktif
- [ ] Error handling tidak expose detail internal