EngineeringSolution ArchitectSecurity and Observability
Session 02 - Threat Modeling
4 min read8 lessons in this module
Tại Sao Cần Threat Modeling?
Threat modeling là quá trình có hệ thống để xác định, đánh giá và xử lý security threats trước khi code. Chi phí fix security bug tăng 30-100x nếu phát hiện ở production so với design phase.
Khi nào thực hiện?
Timing
Trigger
New system
Architecture design phase
Major feature
Thay đổi data flow, thêm integration mới
Post-incident
Sau security breach hoặc near-miss
Periodic review
Hàng quý cho critical systems
STRIDE Methodology
Microsoft STRIDE phân loại threats thành 6 categories:
Threat
Mô tả
Ví dụ .NET
Mitigation
Spoofing
Giả mạo identity
Fake JWT token
Authentication, token validation
Tampering
Sửa đổi data
Man-in-the-middle
Integrity checks, TLS, signing
Repudiation
Phủ nhận hành động
User phủ nhận đã xóa data
Audit logging, digital signatures
Info Disclosure
Lộ thông tin
Stack trace ở production
Error handling, encryption
Denial of Service
Làm service không hoạt động
DDoS, resource exhaustion
Rate limiting, autoscaling
Elevation of Privilege
Leo thang quyền
User thường access admin API
Authorization, least privilege
Data Flow Diagram cho .NET App
Level 0 - Context Diagram
Level 1 - Trust Boundaries
TB = Trust Boundary: Mỗi khi data cross boundary, cần validation và authentication.