
Hari 15: Fase 1 Selesai, 4 Quality Gates, 0 CVE
Fase 1 selesai! 15 hari membangun pipeline CI/CD dengan 4 quality gates, 17 security fixes, threat model 18 ancaman, dan 0 CVE tersisa.
15 Hari, Apa yang Sudah Dibangun?
Fase 1 DevSecOps Challenge resmi selesai. Dari proyek kosong sampai pipeline CI/CD yang benar-benar memblokir kode tidak aman. Ini retrospektif dari 15 hari kerja keras.
Pipeline Architecture
graph LR
Push[git push / PR] --> Build[Build & Test]
Push --> Secret[Secret Scan<br/>Gitleaks]
Push --> SCA[SCA Scan<br/>Trivy]
Push --> SAST[SAST Scan<br/>Semgrep]
Build --> |Tests Pass| OK[✅ Pipeline Green]
Secret --> |No Leaks| OK
SCA --> |No CVE| OK
SAST --> |No ERROR| OK
4 job berjalan paralel, semua harus hijau untuk pipeline pass. Dengan 4 layer caching (Go modules, Gitleaks binary, Trivy DB, Semgrep rules), estimasi pipeline 30-40% lebih cepat dari versi tanpa cache.
4 Quality Gates
| Gate | Tool | Block Kondisi | Status |
|---|---|---|---|
| Secret Scan | Gitleaks | Any leak detected | ✅ Aktif + --no-gitignore |
| SCA | Trivy | CRITICAL/HIGH CVE | ✅ Aktif, 0 CVE current |
| SAST | Semgrep | ERROR finding | ✅ Aktif, 1 WARNING accepted |
| Build & Test | Go 1.26 | Test failure atau race condition | ✅ Aktif, 24 tests |
Security Improvements Applied
| Day | Apa yang Ditemukan | Apa yang Diperbaiki |
|---|---|---|
| 03-04 | Hardcoded credentials | Pindah ke env vars |
| 05-07 | 4 CVE di dependencies | jwt-go → golang-jwt, upgrade gin |
| 08-10 | MD5 password hashing | bcrypt (industry standard) |
| 11 | 5 kerentanan yang scanner lewati | Input validation, JWT auth, security headers, body limit, logging |
| 12 | Pipeline lambat tanpa cache | 4 layer caching |
| 13 | 18 ancaman STRIDE | 6 mitigasi, 4 partial, 8 belum |
| 14 | Gitleaks skip .gitignore files |
--no-gitignore flag |
Total: 17 security fixes diterapkan selama 14 hari.
Threat Model Highlights
Dari 18 ancaman yang diidentifikasi dengan STRIDE + DREAD:
Critical (DREAD ≥ 8):
- No rate limiting (9.6) — siapa saja bisa flood API
- Balance exposure (8.4) — siapa saja bisa lihat saldo siapa saja
- Account ID manipulation (8.0) — transfer dari akun siapa saja
Sudah Mitigated (6):
- JWT token forgery → HMAC-SHA256 signing ✅
- Input validation → negative/zero/NaN/empty amounts ✅
- JWT payload manipulation → signature verification ✅
- Large request body → LimitBodySize middleware ✅
- Error message leakage → generic JSON errors ✅
- Missing security headers → 5 headers implemented ✅
Metrics
| Metrik | Nilai |
|---|---|
| CVE ditemukan | 4 (1 CRITICAL, 3 HIGH) |
| CVE diperbaiki | 4/4 (100%) |
| CVE tersisa | 0 |
| SAST findings ditemukan | 2 |
| SAST diperbaiki | 1/2 (1 WARNING accepted) |
| Secret leaks ditemukan | 2 |
| Secret leaks diperbaiki | 2/2 |
| AI audit findings | 5 |
| AI audit diperbaiki | 5/5 (100%) |
| STRIDE threats diidentifikasi | 18 |
| Unit tests | 24 (semua PASS) |
| Pipeline jobs | 4 (parallel) |
| Pipeline cache layers | 4 |
7 Pelajaran dari Fase 1
1. .gitignore bukan security boundary. git add -f bisa bypass. Gitleaks harus pakai --no-gitignore di CI.
2. Scanner otomatis tidak cukup. Trivy + Semgrep temukan 6 findings. AI audit temukan 5 lagi yang keduanya lewati.
3. JWT Authentication ≠ Authorization. Auth (siapa kamu?) sudah ada. Authz (apa yang boleh?) belum.
4. Pipeline caching hemat 30-40% waktu. 4 layer cache: Go modules, Gitleaks binary, Trivy DB, Semgrep rules.
5. Threat modeling mengisi gap antara scanner dan manual review. STRIDE + DREAD memberikan framework systematic untuk mengidentifikasi ancaman.
6. math.IsInf dan math.IsNaN penting untuk financial API. Float64 JSON values bisa mengandung NaN dan Infinity.
7. Intentional vulnerability test memvalidasi defense layer. Tanpa test ini, kita tidak tahu Gitleaks CI skip .gitignore file.
What's Next: Fase 2
Fase 2 (Hari 16-30) akan fokus pada Infrastructure as Code & Container Security:
- Multi-stage Dockerfile
- Container image scanning (Trivy image)
- Dockerfile hardening (non-root, read-only FS)
- Image signing (Cosign)
- Terraform + IaC scanning (Checkov, tfsec)
- DAST (OWASP ZAP)
- Compliance as Code (InSpec)
Fase 1 selesai. 0 CVE. 4 quality gates aktif. Pipeline hijau. 🎉
Diskusi & Komentar
Artikel Terkait
Hari 5: Trivy SCA Scan Nemukan 4 CVE di Golang API
Hari kelima 60 hari DevSecOps! Scan dependensi Go pakai Trivy dan nemukan 4 CVE termasuk 1 CRITICAL — termasuk library deprecated jwt-go.
Hari 8: Semgrep SAST Scan Temukan Kode Tidak Aman
Hari kedelapan 60 hari DevSecOps! Install Semgrep, buat kode insecure (MD5), dan scan ketemu 2 finding — MD5 weak hash dan HTTP server tanpa TLS.
Hari 10: MD5 ke Bcrypt, Pipeline Hijau Lagi
Hari kesepuluh 60 hari DevSecOps! Fix SAST findings — ganti MD5 ke bcrypt, hapus custom rule HTTP TLS, dan pipeline CI kembali hijau setelah 4 job semua pass.