analyse-problem

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

A3 Problem Analysis

A3问题分析

Apply A3 problem-solving format for comprehensive, single-page problem documentation and resolution planning.
采用A3问题解决格式,完成全面的单页问题记录与解决方案规划。

Description

说明

Structured one-page analysis format covering: Background, Current Condition, Goal, Root Cause Analysis, Countermeasures, Implementation Plan, and Follow-up. Named after A3 paper size; emphasizes concise, complete documentation.
结构化单页分析格式,涵盖:背景、现状、目标、根本原因分析、对策、实施计划及跟进。因采用A3纸张尺寸而得名;强调简洁且完整的记录。

Usage

使用方法

/analyse-problem [problem_description]
/analyse-problem [problem_description]

Variables

变量

  • PROBLEM: Issue to analyze (default: prompt for input)
  • OUTPUT_FORMAT: markdown or text (default: markdown)
  • PROBLEM:待分析的问题(默认:提示输入)
  • OUTPUT_FORMAT:markdown或text(默认:markdown)

Steps

步骤

  1. Background: Why this problem matters (context, business impact)
  2. Current Condition: What's happening now (data, metrics, examples)
  3. Goal/Target: What success looks like (specific, measurable)
  4. Root Cause Analysis: Why problem exists (use 5 Whys or Fishbone)
  5. Countermeasures: Proposed solutions addressing root causes
  6. Implementation Plan: Who, what, when, how
  7. Follow-up: How to verify success and prevent recurrence
  1. 背景:该问题的重要性(背景、业务影响)
  2. 现状:当前情况(数据、指标、示例)
  3. 目标:成功的标准(具体、可衡量)
  4. 根本原因分析:问题产生的原因(使用5 Whys或Fishbone分析法)
  5. 对策:针对根本原因提出的解决方案
  6. 实施计划:责任人、内容、时间、方法
  7. 跟进:如何验证成功并防止问题复发

A3 Template

A3模板

═══════════════════════════════════════════════════════════════
                    A3 PROBLEM ANALYSIS
═══════════════════════════════════════════════════════════════

TITLE: [Concise problem statement]
OWNER: [Person responsible]
DATE: [YYYY-MM-DD]

┌─────────────────────────────────────────────────────────────┐
│ 1. BACKGROUND (Why this matters)                            │
├─────────────────────────────────────────────────────────────┤
│ [Context, impact, urgency, who's affected]                  │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 2. CURRENT CONDITION (What's happening)                     │
├─────────────────────────────────────────────────────────────┤
│ [Facts, data, metrics, examples - no opinions]              │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 3. GOAL/TARGET (What success looks like)                    │
├─────────────────────────────────────────────────────────────┤
│ [Specific, measurable, time-bound targets]                  │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 4. ROOT CAUSE ANALYSIS (Why problem exists)                 │
├─────────────────────────────────────────────────────────────┤
│ [5 Whys, Fishbone, data analysis]                           │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 5. COUNTERMEASURES (Solutions addressing root causes)       │
├─────────────────────────────────────────────────────────────┤
│ [Specific actions, not vague intentions]                    │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 6. IMPLEMENTATION PLAN (Who, What, When)                    │
├─────────────────────────────────────────────────────────────┤
│ [Timeline, responsibilities, dependencies, milestones]      │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 7. FOLLOW-UP (Verification & Prevention)                    │
├─────────────────────────────────────────────────────────────┤
│ [Success metrics, monitoring plan, review dates]            │
└─────────────────────────────────────────────────────────────┘

═══════════════════════════════════════════════════════════════
═══════════════════════════════════════════════════════════════
                    A3 PROBLEM ANALYSIS
═══════════════════════════════════════════════════════════════

TITLE: [简洁的问题描述]
OWNER: [负责人]
DATE: [YYYY-MM-DD]

┌─────────────────────────────────────────────────────────────┐
│ 1. 背景(问题的重要性)                                      │
├─────────────────────────────────────────────────────────────┤
│ [背景、影响、紧迫性、受影响对象]                            │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 2. 现状(当前情况)                                         │
├─────────────────────────────────────────────────────────────┤
│ [事实、数据、指标、示例 - 不含主观观点]                      │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 3. 目标(成功的标准)                                        │
├─────────────────────────────────────────────────────────────┤
│ [具体、可衡量、有时间限制的目标]                            │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 4. 根本原因分析(问题产生的原因)                           │
├─────────────────────────────────────────────────────────────┤
│ [5 Whys、Fishbone、数据分析]                               │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 5. 对策(针对根本原因的解决方案)                           │
├─────────────────────────────────────────────────────────────┤
│ [具体行动,而非模糊意向]                                    │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 6. 实施计划(责任人、内容、时间)                            │
├─────────────────────────────────────────────────────────────┤
│ [时间线、职责、依赖项、里程碑]                              │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 7. 跟进(验证与预防)                                      │
├─────────────────────────────────────────────────────────────┤
│ [成功指标、监控计划、复查日期]                              │
└─────────────────────────────────────────────────────────────┘

═══════════════════════════════════════════════════════════════

Examples

示例

Example 1: Database Connection Pool Exhaustion

示例1:数据库连接池耗尽

═══════════════════════════════════════════════════════════════
                    A3 PROBLEM ANALYSIS
═══════════════════════════════════════════════════════════════

TITLE: API Downtime Due to Connection Pool Exhaustion
OWNER: Backend Team Lead
DATE: 2024-11-14

┌─────────────────────────────────────────────────────────────┐
│ 1. BACKGROUND                                                │
├─────────────────────────────────────────────────────────────┤
│ • API goes down 2-3x per week during peak hours             │
│ • Affects 10,000+ users, average 15min downtime             │
│ • Revenue impact: ~$5K per incident                         │
│ • Customer satisfaction score dropped from 4.5 to 3.8       │
│ • Started 3 weeks ago after traffic increased 40%           │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 2. CURRENT CONDITION                                         │
├─────────────────────────────────────────────────────────────┤
│ Observations:                                                │
│ • Connection pool size: 10 (unchanged since launch)         │
│ • Peak concurrent users: 500 (was 300 three weeks ago)      │
│ • Average request time: 200ms (was 150ms)                   │
│ • Connections leaked: ~2 per hour (never released)          │
│ • Error: "Connection pool exhausted" in logs                │
│                                                              │
│ Pattern:                                                     │
│ • Occurs at 2pm-4pm daily (peak traffic)                    │
│ • Gradual degradation over 30 minutes                       │
│ • Recovery requires app restart                             │
│ • Long-running queries block pool (some 30+ seconds)        │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 3. GOAL/TARGET                                               │
├─────────────────────────────────────────────────────────────┤
│ • Zero downtime due to connection exhaustion                │
│ • Support 1000 concurrent users (2x current peak)           │
│ • All connections released within 5 seconds                 │
│ • Achieve within 1 week                                     │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 4. ROOT CAUSE ANALYSIS                                       │
├─────────────────────────────────────────────────────────────┤
│ 5 Whys:                                                      │
│ Problem: Connection pool exhausted                          │
│ Why 1: All 10 connections in use, none available            │
│ Why 2: Connections not released after requests              │
│ Why 3: Error handling doesn't close connections             │
│ Why 4: Try-catch blocks missing .finally()                  │
│ Why 5: No code review checklist for resource cleanup        │
│                                                              │
│ Contributing factors:                                        │
│ • Pool size too small for current load                      │
│ • No connection timeout configured (hangs forever)          │
│ • Slow queries hold connections longer                      │
│ • No monitoring/alerting on pool metrics                    │
│                                                              │
│ ROOT CAUSE: Systematic issue with resource cleanup +        │
│             insufficient pool sizing                         │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 5. COUNTERMEASURES                                           │
├─────────────────────────────────────────────────────────────┤
│ Immediate (This Week):                                       │
│ 1. Audit all DB code, add .finally() for connection release │
│ 2. Increase pool size: 10 → 30                              │
│ 3. Add connection timeout: 10 seconds                       │
│ 4. Add pool monitoring & alerts (>80% used)                 │
│                                                              │
│ Short-term (2 Weeks):                                        │
│ 5. Optimize slow queries (add indexes)                      │
│ 6. Implement connection pooling best practices doc          │
│ 7. Add automated test for connection leaks                  │
│                                                              │
│ Long-term (1 Month):                                         │
│ 8. Migrate to connection pool library with auto-release     │
│ 9. Add linter rule detecting missing .finally()             │
│ 10. Create PR checklist for resource management             │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 6. IMPLEMENTATION PLAN                                       │
├─────────────────────────────────────────────────────────────┤
│ Week 1 (Nov 14-18):                                          │
│ • Day 1-2: Audit & fix connection leaks [Dev Team]          │
│ • Day 2: Increase pool size, add timeout [DevOps]           │
│ • Day 3: Set up monitoring [SRE]                            │
│ • Day 4: Test under load [QA]                               │
│ • Day 5: Deploy to production [DevOps]                      │
│                                                              │
│ Week 2 (Nov 21-25):                                          │
│ • Optimize identified slow queries [DB Team]                │
│ • Write best practices doc [Tech Writer + Dev Lead]         │
│ • Create connection leak test [QA Team]                     │
│                                                              │
│ Week 3-4 (Nov 28 - Dec 9):                                   │
│ • Evaluate connection pool libraries [Dev Team]             │
│ • Add linter rules [Dev Lead]                               │
│ • Update PR template [Dev Lead]                             │
│                                                              │
│ Dependencies: None blocking Week 1 fixes                     │
│ Resources: 2 developers, 1 DevOps, 1 SRE                    │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 7. FOLLOW-UP                                                 │
├─────────────────────────────────────────────────────────────┤
│ Success Metrics:                                             │
│ • Zero downtime incidents (monitor 4 weeks)                 │
│ • Pool usage stays <80% during peak                         │
│ • No connection leaks detected                              │
│ • Response time <200ms p95                                  │
│                                                              │
│ Monitoring:                                                  │
│ • Daily: Check pool usage dashboard                         │
│ • Weekly: Review connection leak alerts                     │
│ • Bi-weekly: Team retrospective on progress                 │
│                                                              │
│ Review Dates:                                                │
│ • Week 1 (Nov 18): Verify immediate fixes effective         │
│ • Week 2 (Nov 25): Assess optimization impact               │
│ • Week 4 (Dec 9): Final review, close A3                    │
│                                                              │
│ Prevention:                                                  │
│ • Add connection handling to onboarding                     │
│ • Monthly audit of resource management code                 │
│ • Include pool metrics in SRE runbook                       │
└─────────────────────────────────────────────────────────────┘

═══════════════════════════════════════════════════════════════
═══════════════════════════════════════════════════════════════
                    A3 PROBLEM ANALYSIS
═══════════════════════════════════════════════════════════════

TITLE: 因连接池耗尽导致的API停机
OWNER: 后端团队负责人
DATE: 2024-11-14

┌─────────────────────────────────────────────────────────────┐
│ 1. 背景                                                    │
├─────────────────────────────────────────────────────────────┤
│ • API在高峰时段每周停机2-3次                               │
│ • 影响10000+用户,平均停机15分钟                            │
│ • 收入影响:每次事件约5000美元                              │
│ • 客户满意度评分从4.5降至3.8                                │
│ • 流量增长40%后,3周前开始出现该问题                        │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 2. 现状                                                     │
├─────────────────────────────────────────────────────────────┤
│ 观察结果:                                                  │
│ • 连接池大小:10(自上线后未变更)                          │
│ • 高峰并发用户数:500(3周前为300)                        │
│ • 平均请求时间:200ms(此前为150ms)                        │
│ • 连接泄漏:每小时约2个(未被释放)                          │
│ • 错误日志:"Connection pool exhausted"                     │
│                                                              │
│ 规律:                                                     │
│ • 每日14:00-16:00(高峰时段)发生                            │
│ • 30分钟内逐渐恶化                                          │
│ • 恢复需重启应用                                            │
│ • 长时间查询阻塞连接池(部分查询耗时30+秒)                  │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 3. 目标                                                     │
├─────────────────────────────────────────────────────────────┤
│ • 零因连接耗尽导致的停机事件                                │
│ • 支持1000并发用户(当前高峰的2倍)                        │
│ • 所有连接在5秒内释放                                      │
│ • 1周内达成目标                                            │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 4. 根本原因分析                                           │
├─────────────────────────────────────────────────────────────┤
│ 5 Whys分析法:                                              │
│ 问题:连接池耗尽                                            │
│ 原因1:10个连接全部被占用,无可用连接                        │
│ 原因2:请求完成后连接未被释放                                │
│ 原因3:错误处理未关闭连接                                    │
│ 原因4:Try-catch块缺少.finally()语句                        │
│ 原因5:资源清理无代码审查清单                                │
│                                                              │
│ 促成因素:                                                  │
│ • 连接池大小无法满足当前负载                                │
│ • 未配置连接超时(永久挂起)                                │
│ • 慢查询占用连接时间过长                                    │
│ • 无连接池指标监控/告警                                    │
│                                                              │
│ 根本原因:资源清理存在系统性问题 + 连接池配置不足             │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 5. 对策                                                     │
├─────────────────────────────────────────────────────────────┤
│ 立即行动(本周):                                           │
│ 1. 审核所有数据库代码,添加.finally()释放连接                │
│ 2. 连接池大小从10调整为30                                  │
│ 3. 添加连接超时:10秒                                       │
│ 4. 添加连接池监控与告警(使用率>80%时触发)                  │
│                                                              │
│ 短期行动(2周内):                                          │
│ 5. 优化慢查询(添加索引)                                    │
│ 6. 编写连接池最佳实践文档                                    │
│ 7. 添加连接泄漏自动化测试                                    │
│                                                              │
│ 长期行动(1个月内):                                         │
│ 8. 迁移至支持自动释放的连接池库                              │
│ 9. 添加检测缺失.finally()的代码检查规则                      │
│ 10. 创建资源管理PR检查清单                                  │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 6. 实施计划                                               │
├─────────────────────────────────────────────────────────────┤
│ 第1周(11月14日-18日):                                    │
│ • 第1-2天:审核并修复连接泄漏问题 [开发团队]                │
│ • 第2天:调整连接池大小、添加超时 [DevOps]                 │
│ • 第3天:搭建监控系统 [SRE]                                │
│ • 第4天:负载测试 [QA]                                     │
│ • 第5天:部署至生产环境 [DevOps]                          │
│                                                              │
│ 第2周(11月21日-25日):                                    │
│ • 优化已识别的慢查询 [数据库团队]                          │
│ • 编写最佳实践文档 [技术文档工程师 + 开发负责人]             │
│ • 创建连接泄漏测试 [QA团队]                                 │
│                                                              │
│ 第3-4周(11月28日-12月9日):                               │
│ • 评估连接池库选项 [开发团队]                              │
│ • 添加代码检查规则 [开发负责人]                             │
│ • 更新PR模板 [开发负责人]                                   │
│                                                              │
│ 依赖项:第1周修复工作无阻塞依赖                             │
│ 资源:2名开发人员、1名DevOps、1名SRE                        │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 7. 跟进                                                     │
├─────────────────────────────────────────────────────────────┤
│ 成功指标:                                                 │
│ • 零停机事件(监控4周)                                    │
│ • 高峰时段连接池使用率保持<80%                              │
│ • 未检测到连接泄漏                                          │
│ • p95响应时间<200ms                                        │
│                                                              │
│ 监控:                                                      │
│ • 每日:查看连接池使用率仪表盘                              │
│ • 每周:复查连接泄漏告警                                    │
│ • 每两周:团队回顾进展                                      │
│                                                              │
│ 复查日期:                                                  │
│ • 第1周(11月18日):验证立即修复效果                        │
│ • 第2周(11月25日):评估优化影响                            │
│ • 第4周(12月9日):最终复查,关闭A3文档                    │
│                                                              │
│ 预防措施:                                                  │
│ • 将连接处理纳入新员工培训                                  │
│ • 每月审核资源管理代码                                      │
│ • 将连接池指标纳入SRE运行手册                              │
└─────────────────────────────────────────────────────────────┘

═══════════════════════════════════════════════════════════════

Example 2: Security Vulnerability in Production

示例2:生产环境安全漏洞

═══════════════════════════════════════════════════════════════
                    A3 PROBLEM ANALYSIS
═══════════════════════════════════════════════════════════════

TITLE: Critical SQL Injection Vulnerability
OWNER: Security Team Lead
DATE: 2024-11-14

┌─────────────────────────────────────────────────────────────┐
│ 1. BACKGROUND                                                │
├─────────────────────────────────────────────────────────────┤
│ • Critical security vulnerability reported by researcher    │
│ • SQL injection in user search endpoint                     │
│ • Potential data breach affecting 100K+ user records        │
│ • CVSS score: 9.8 (Critical)                                │
│ • Vulnerability exists in production for 6 months           │
│ • Similar issue found in 2 other endpoints (scanning)       │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 2. CURRENT CONDITION                                         │
├─────────────────────────────────────────────────────────────┤
│ Vulnerable Code:                                             │
│ • /api/users/search endpoint uses string concatenation      │
│ • Input: search query (user-provided, not sanitized)        │
│ • Pattern: `SELECT * FROM users WHERE name = '${input}'`    │
│                                                              │
│ Scope:                                                       │
│ • 3 endpoints vulnerable (search, filter, export)           │
│ • All use same unsafe pattern                               │
│ • No parameterized queries                                  │
│ • No input validation layer                                 │
│                                                              │
│ Risk Assessment:                                             │
│ • Exploitable from public internet                          │
│ • No evidence of exploitation (logs checked)                │
│ • Similar code in admin panel (higher privilege)            │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 3. GOAL/TARGET                                               │
├─────────────────────────────────────────────────────────────┤
│ • Patch all SQL injection vulnerabilities within 24 hours   │
│ • Zero SQL injection vulnerabilities in codebase            │
│ • Prevent similar issues in future code                     │
│ • Verify no unauthorized access occurred                    │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 4. ROOT CAUSE ANALYSIS                                       │
├─────────────────────────────────────────────────────────────┤
│ 5 Whys:                                                      │
│ Problem: SQL injection vulnerability in production          │
│ Why 1: User input concatenated directly into SQL            │
│ Why 2: Developer wasn't aware of SQL injection risks        │
│ Why 3: No security training for new developers              │
│ Why 4: Security not part of onboarding checklist            │
│ Why 5: Security team not involved in development process    │
│                                                              │
│ Contributing Factors (Fishbone):                             │
│ • Process: No security code review                          │
│ • Technology: ORM not used consistently                     │
│ • People: Knowledge gap in secure coding                    │
│ • Methods: No SAST tools in CI/CD                           │
│                                                              │
│ ROOT CAUSE: Security not integrated into development        │
│             process, training gap                            │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 5. COUNTERMEASURES                                           │
├─────────────────────────────────────────────────────────────┤
│ Immediate (24 Hours):                                        │
│ 1. Patch all 3 vulnerable endpoints                         │
│ 2. Deploy hotfix to production                              │
│ 3. Scan codebase for similar patterns                       │
│ 4. Review access logs for exploitation attempts             │
│                                                              │
│ Short-term (1 Week):                                         │
│ 5. Replace all raw SQL with parameterized queries           │
│ 6. Add input validation middleware                          │
│ 7. Set up SAST tool in CI (Snyk/SonarQube)                  │
│ 8. Security team review of all data access code             │
│                                                              │
│ Long-term (1 Month):                                         │
│ 9. Mandatory security training for all developers           │
│ 10. Add security review to PR process                       │
│ 11. Migrate to ORM for all database access                  │
│ 12. Implement security champion program                     │
│ 13. Quarterly security audits                               │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 6. IMPLEMENTATION PLAN                                       │
├─────────────────────────────────────────────────────────────┤
│ Hour 0-4 (Emergency Response):                               │
│ • Write & test patches [Security + Senior Dev]              │
│ • Emergency PR review [CTO + Tech Lead]                     │
│ • Deploy to staging [DevOps]                                │
│                                                              │
│ Hour 4-24 (Production Deploy):                               │
│ • Deploy hotfix [DevOps + On-call]                          │
│ • Monitor for issues [SRE Team]                             │
│ • Scan logs for exploitation [Security Team]                │
│ • Notify stakeholders [Security Lead + CEO]                 │
│                                                              │
│ Day 2-7:                                                     │
│ • Full codebase remediation [Dev Team]                      │
│ • SAST tool setup [DevOps + Security]                       │
│ • Security review [External Auditor]                        │
│                                                              │
│ Week 2-4:                                                    │
│ • Security training program [Security + HR]                 │
│ • Process improvements [Engineering Leadership]             │
│                                                              │
│ Dependencies: External auditor availability (Week 2)         │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 7. FOLLOW-UP                                                 │
├─────────────────────────────────────────────────────────────┤
│ Success Metrics:                                             │
│ • Zero SQL injection vulnerabilities (verified by scan)     │
│ • 100% of PRs pass SAST checks                              │
│ • 100% developer security training completion               │
│ • No unauthorized access detected in log analysis           │
│                                                              │
│ Verification:                                                │
│ • Day 1: Verify patch deployed, vulnerability closed        │
│ • Week 1: External security audit confirms fixes            │
│ • Week 2: SAST tool catching similar issues                 │
│ • Month 1: Training completion, process adoption            │
│                                                              │
│ Prevention:                                                  │
│ • SAST tools block vulnerable code in CI                    │
│ • Security review required for data access code             │
│ • Quarterly penetration testing                             │
│ • Annual security training refresh                          │
│                                                              │
│ Incident Report:                                             │
│ • Post-mortem meeting: Nov 16                               │
│ • Document lessons learned                                  │
│ • Share with engineering org                                │
└─────────────────────────────────────────────────────────────┘

═══════════════════════════════════════════════════════════════
═══════════════════════════════════════════════════════════════
                    A3 PROBLEM ANALYSIS
═══════════════════════════════════════════════════════════════

TITLE: 严重SQL注入漏洞
OWNER: 安全团队负责人
DATE: 2024-11-14

┌─────────────────────────────────────────────────────────────┐
│ 1. 背景                                                    │
├─────────────────────────────────────────────────────────────┤
│ • 研究人员报告严重安全漏洞                                  │
│ • 用户搜索端点存在SQL注入                                  │
│ • 可能导致10万+用户记录泄露                                │
│ • CVSS评分:9.8(严重级)                                  │
│ • 漏洞已在生产环境存在6个月                                │
│ • 扫描发现另外2个端点存在类似问题                          │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 2. 现状                                                     │
├─────────────────────────────────────────────────────────────┤
│ 漏洞代码:                                                 │
│ • /api/users/search端点使用字符串拼接                        │
│ • 输入:搜索查询(用户提供,未经过滤)                      │
│ • 代码模式:`SELECT * FROM users WHERE name = '${input}'`    │
│                                                              │
│ 影响范围:                                                  │
│ • 3个端点存在漏洞(搜索、筛选、导出)                        │
│ • 均使用相同不安全模式                                      │
│ • 未使用参数化查询                                          │
│ • 无输入验证层                                              │
│                                                              │
│ 风险评估:                                                  │
│ • 可从公网利用                                              │
│ • 日志检查未发现被利用痕迹                                  │
│ • 管理面板存在类似代码(权限更高)                          │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 3. 目标                                                     │
├─────────────────────────────────────────────────────────────┤
│ • 24小时内修复所有SQL注入漏洞                              │
│ • 代码库中无SQL注入漏洞                                    │
│ • 防止未来代码出现类似问题                                  │
│ • 确认未发生未授权访问                                      │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 4. 根本原因分析                                           │
├─────────────────────────────────────────────────────────────┤
│ 5 Whys分析法:                                              │
│ 问题:生产环境存在SQL注入漏洞                                │
│ 原因1:用户输入直接拼接至SQL语句中                          │
│ 原因2:开发人员不了解SQL注入风险                            │
│ 原因3:新开发人员未接受安全培训                              │
│ 原因4:安全内容未纳入入职清单                                │
│ 原因5:安全团队未参与开发流程                                │
│                                                              │
│ 促成因素(Fishbone分析法):                                 │
│ • 流程:无安全代码审查                                      │
│ • 技术:ORM未被统一使用                                      │
│ • 人员:安全编码知识缺口                                    │
│ • 方法:CI/CD中无SAST工具                                  │
│                                                              │
│ 根本原因:安全未融入开发流程,存在培训缺口                  │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 5. 对策                                                     │
├─────────────────────────────────────────────────────────────┤
│ 立即行动(24小时内):                                        │
│ 1. 修复所有3个漏洞端点                                      │
│ 2. 部署热修复至生产环境                                    │
│ 3. 扫描代码库查找类似模式                                  │
│ 4. 复查访问日志排查利用尝试                                │
│                                                              │
│ 短期行动(1周内):                                         │
│ 5. 将所有原生SQL替换为参数化查询                            │
│ 6. 添加输入验证中间件                                      │
│ 7. 在CI中搭建SAST工具(Snyk/SonarQube)                    │
│ 8. 安全团队审核所有数据访问代码                            │
│                                                              │
│ 长期行动(1个月内):                                         │
│ 9. 为所有开发人员提供强制安全培训                          │
│ 10. 将安全审查纳入PR流程                                    │
│ 11. 所有数据库访问迁移至ORM                                │
│ 12. 实施安全负责人计划                                      │
│ 13. 每季度开展安全审计                                      │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 6. 实施计划                                               │
├─────────────────────────────────────────────────────────────┤
│ 第0-4小时(应急响应):                                       │
│ • 编写并测试补丁 [安全团队 + 资深开发]                      │
│ • 紧急PR审核 [CTO + 技术负责人]                             │
│ • 部署至预发布环境 [DevOps]                                │
│                                                              │
│ 第4-24小时(生产部署):                                       │
│ • 部署热修复 [DevOps + 值班人员]                          │
│ • 监控问题 [SRE团队]                                       │
│ • 扫描日志排查利用行为 [安全团队]                          │
│ • 通知利益相关方 [安全负责人 + CEO]                         │
│                                                              │
│ 第2-7天:                                                     │
│ • 全面修复代码库 [开发团队]                                │
│ • 搭建SAST工具 [DevOps + 安全团队]                         │
│ • 安全审查 [外部审计师]                                    │
│                                                              │
│ 第2-4周:                                                    │
│ • 安全培训计划 [安全团队 + HR]                             │
│ • 流程改进 [工程管理层]                                     │
│                                                              │
│ 依赖项:外部审计师可得性(第2周)                           │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ 7. 跟进                                                     │
├─────────────────────────────────────────────────────────────┤
│ 成功指标:                                                 │
│ • 扫描验证无SQL注入漏洞                                    │
│ • 100%的PR通过SAST检查                                      │
│ • 100%的开发人员完成安全培训                                │
│ • 日志分析未发现未授权访问                                  │
│                                                              │
│ 验证:                                                      │
│ • 第1天:验证补丁已部署,漏洞已修复                        │
│ • 第1周:外部安全审计确认修复有效                            │
│ • 第2周:SAST工具可检测类似问题                            │
│ • 第1个月:培训完成,流程落地                                │
│                                                              │
│ 预防措施:                                                  │
│ • SAST工具在CI中拦截漏洞代码                                │
│ • 数据访问代码需经过安全审查                                │
│ • 每季度开展渗透测试                                        │
│ • 每年更新安全培训内容                                      │
│                                                              │
│ 事件报告:                                                  │
│ • 事后复盘会议:11月16日                                    │
│ • 记录经验教训                                              │
│ • 向工程团队分享                                            │
└─────────────────────────────────────────────────────────────┘

═══════════════════════════════════════════════════════════════

Notes

注意事项

  • A3 forces concise, complete thinking (fits on one page)
  • Use data and facts, not opinions or blame
  • Root cause analysis is critical—use
    /why
    or
    /cause-and-effect
  • Countermeasures must address root causes, not symptoms
  • Implementation plan needs clear ownership and timelines
  • Follow-up ensures sustainable improvement
  • A3 becomes historical record for organizational learning
  • Update A3 as situation evolves (living document until closed)
  • Consider A3 for: incidents, recurring issues, major improvements
  • Overkill for: small bugs, one-line fixes, trivial issues
  • A3要求思考简洁且全面(内容可容纳在单页内)
  • 基于数据和事实,而非观点或指责
  • 根本原因分析至关重要——可配合使用
    /why
    /cause-and-effect
    工具
  • 对策必须针对根本原因,而非表面症状
  • 实施计划需明确责任人和时间线
  • 跟进可确保改进效果可持续
  • A3可作为组织学习的历史记录
  • 随着情况变化更新A3(直至关闭前为动态文档)
  • 适用场景:事件、重复问题、重大改进项目
  • 不适用场景:小bug、单行代码修复、琐碎问题