@metasession.co/devaudit-cli 0.1.36 → 0.1.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,84 @@
1
+ # Incident Classification — framework attribution decision tree
2
+
3
+ Used by both `e2e-test-engineer` (when filing defects) and `governance-doc-author` (when authoring the project-level incident-report template). Single source of truth so the two skills don't drift.
4
+
5
+ ## Decision tree
6
+
7
+ Every `incident_report` evidence row closes `ISO29119.3.5.4` (baseline). Additional clauses depend on the incident's scope.
8
+
9
+ | Defect / incident characteristic | Frameworks/clauses attributed |
10
+ |---|---|
11
+ | **Any test failure / defect** (baseline — always) | `ISO29119.3.5.4` Test incident report |
12
+ | **Ops impact** (downtime, persistent errors, perf regression, data corruption) | + `SOC2.CC7.2` System monitoring and incident response |
13
+ | **Security vulnerability** (auth bypass, injection, data exposure beyond GDPR scope) | + `SOC2.CC7.2` + relevant ISO 27001 controls |
14
+ | **Personal data exposed / lost / mishandled** | + `GDPR.Art-33` (always — supervisory authority within 72h) + `GDPR.Art-34` (when data subjects need notification per Art. 34(1)) |
15
+ | **AI/ML failure** (model hallucination, biased output, oversight bypass, transparency failure) | + relevant EU AI Act articles (`Art-9` risk, `Art-14` human oversight, `Art-15` accuracy/robustness) |
16
+
17
+ ## Baseline rule
18
+
19
+ The first row is **mandatory**: every incident_report attributes to `ISO29119.3.5.4` no matter what else applies. The "no specific framework impact" case (a regular bug with no PII, no security, no ops impact) still produces a valid incident_report closing the baseline — never a silently-dropped report.
20
+
21
+ ## Conditional rules
22
+
23
+ The remaining rows are conditional. Tick the matching characteristic; ensure the corresponding section of the incident-report template is non-stub before commit.
24
+
25
+ ### Ops impact
26
+
27
+ Signals: production downtime, sustained error-rate elevation, perf regression measured in p95 or SLO breaches, data corruption.
28
+
29
+ If yes:
30
+ - §1 Summary must name the affected systems + duration
31
+ - §3 Affected scope must include user-count estimate
32
+ - §6 Containment must name what was done to mitigate
33
+
34
+ ### Security vulnerability
35
+
36
+ Signals: auth bypass, injection (SQL / NoSQL / template / OS), broken access control, secrets in logs / git, dependency CVE exploit path.
37
+
38
+ If yes:
39
+ - §5 Root cause must name the vulnerability class (OWASP / CWE id where applicable)
40
+ - §7 Follow-up actions must include the regression test that prevents recurrence
41
+ - Security lead listed in §8 Sign-off
42
+
43
+ ### Personal data exposed / lost / mishandled (GDPR)
44
+
45
+ Signals: any unauthorised disclosure of personal data, data loss without backup, data sent to unintended recipients, retention exceeded, lawful-basis collapse.
46
+
47
+ If yes:
48
+ - §4 GDPR triage **must** be fully filled: data subject count, data categories, special-category-data Y/N
49
+ - Art. 33: notification to supervisory authority within 72h of awareness → document timestamp + sent-to in §2 Timeline
50
+ - Art. 34: notification to data subjects when likely to result in HIGH risk → document the decision (with rationale) in §4
51
+ - DPO listed in §8 Sign-off
52
+
53
+ ### AI/ML failure (EU AI Act)
54
+
55
+ Signals: model produced incorrect / biased / harmful output that reached a user; oversight gate bypassed; accuracy / robustness regression in production.
56
+
57
+ If yes:
58
+ - §5 Root cause must name the model + invocation path + what guardrail failed
59
+ - §7 Follow-up actions must include the change to the AI oversight path (Art. 14)
60
+ - Cross-link to `compliance/governance/ai-disclosure.md` from §1 Summary
61
+
62
+ ## Worked examples
63
+
64
+ ### Example 1 — Non-PII, non-security defect
65
+
66
+ A unit-conversion bug in a public-facing page rounds metric prices incorrectly. Discovered via failing e2e. No data exposure, no ops impact beyond cosmetic, no AI involved.
67
+
68
+ **Attribution:** `ISO29119.3.5.4` only.
69
+
70
+ The incident-report is still valid and load-bearing — without it the test incident clause stays MISSING. Don't pad with false GDPR / security ticks.
71
+
72
+ ### Example 2 — PII exposure via misconfigured RLS policy
73
+
74
+ A Supabase RLS policy was deployed with a typo causing users to see other users' application details (name, email, application status). Found by an e2e regression test. No financial impact, no service downtime — but ~3,000 users were affected over a 6-hour window.
75
+
76
+ **Attribution:** `ISO29119.3.5.4` + `SOC2.CC7.2` (incident response invoked) + `GDPR.Art-33` (supervisory authority notified within 72h) + `GDPR.Art-34` (data subjects notified — risk threshold met).
77
+
78
+ §4 GDPR triage filled: 3,000 affected, categories = name + email + application metadata, no special-category data, Art-34 notification sent within 72h via in-app banner + email.
79
+
80
+ ## Cross-references
81
+
82
+ - `e2e-test-engineer/SKILL.md` Phase 6 (Filing defects) — uses this table when filing a defect that meets incident criteria.
83
+ - `governance-doc-author/SKILL.md` Phase 6 — uses this table when authoring the project-level `incident-report.md` template.
84
+ - `compliance/governance/incident-report.md.template` — Framework attribution section embeds the same conditional checklist.
@@ -148,7 +148,18 @@ Reached only on the **tracked** route from Phase 0 (the issue is already fetched
148
148
  2. **Classify risk** per `Test_Policy.md` §Risk-Based Testing. Emit a one-paragraph rationale citing the signals you used (auth surface, financial calc, data egress, RBAC, AI decisioning, etc.).
149
149
  3. **Assign REQ-XXX.** Inspect `compliance/RTM.md` for existing entries; take the next free number. If the issue references an existing REQ, use that instead.
150
150
  4. **Detect over-scoping.** If the issue spans clearly distinct deliverables (e.g. "build SAML SSO + reorganise the admin dashboard + migrate from Postgres 14 to 16"), halt with a clear message asking the user to split the issue into separate ones. Do not proceed past Phase 1.
151
- 5. **Write the implementation plan.** Create `compliance/plans/REQ-XXX/implementation-plan.md` per the stage-1 template (sections: context, acceptance criteria, technical approach, security considerations, dependencies, test scope). For HIGH/CRITICAL also include: threat model (against STRIDE categories applicable to the touched surfaces), four-eyes attestation slot, rollback plan.
151
+ 5. **Write the implementation plan.** Create `compliance/plans/REQ-XXX/implementation-plan.md` from `sdlc/files/_common/Implementation_Plan_TEMPLATE.md` (synced into the consumer's `SDLC/` directory at install). The template's shape is load-bearing it carries the **Framework attribution** section that closes four framework clauses on upload:
152
+
153
+ | Clause | What the plan must contain |
154
+ |---|---|
155
+ | **ISO 29119 §3.4** Test Plan | Acceptance criteria + verification strategy per AC. |
156
+ | **ISO 27001 A.8.25** Secure SDLC | Threat model + secrets / dependency considerations. |
157
+ | **GDPR Art. 25** Data protection by design | Per-purpose data flows + lawful basis + retention. Explicit "no personal data" callout if not applicable. |
158
+ | **EU AI Act Art. 11** Technical documentation | Model provenance + oversight path when AI is in scope. Explicit "no AI in scope" callout if not. |
159
+
160
+ For HIGH/CRITICAL also include: threat model (against STRIDE categories applicable to the touched surfaces), four-eyes attestation slot, rollback plan — the template has slots for all of these.
161
+
162
+ **Don't delete sections** — mark with `N/A — <reason>` if a clause genuinely doesn't apply (e.g. UI-only change with no personal-data scope). Empty stubs commit-then-upload as placeholder evidence and break the audit trail.
152
163
  6. **Update `compliance/RTM.md`** with the new entry: REQ-XXX, title, risk class, linked issue, linked test cases (placeholder).
153
164
  7. **Post plan summary as an issue comment.** Format: TL;DR; Risk class + signals; Acceptance criteria; Technical approach (one paragraph); Dependencies; Test scope.
154
165
  8. **Checkpoint** — pause for human approval **iff** risk class is HIGH or CRITICAL. LOW and MEDIUM pass through to Phase 2 automatically. The checkpoint can be forced on for all classes via the `--require-plan-approval` flag (or `DEVAUDIT_REQUIRE_PLAN_APPROVAL=1` env var) for orgs that want it always-on.
@@ -210,9 +210,62 @@ jobs:
210
210
  # Open PR (or update existing).
211
211
  EXISTING=$(gh pr list --head "${BRANCH}" --json number --jq '.[0].number' || true)
212
212
  if [ -z "$EXISTING" ]; then
213
+ # Two-part PR body:
214
+ # 1. The 60% operator-fill checklist with per-clause attribution
215
+ # 2. The auto-filled section list (40% workflow-derived)
216
+ # Both are inline so the reviewer can tick boxes and the
217
+ # auto-generated half stays visible. Per-clause links use the
218
+ # consumer's portal base URL — fall back to the SDLC docs when
219
+ # DEVAUDIT_BASE_URL isn't set in the workflow env.
220
+ BASE="${DEVAUDIT_BASE_URL:-https://github.com/metasession-dev/DevAudit-Installer/blob/main/docs/governance-templates.md}"
221
+ PR_BODY=$(cat <<PRBODY
222
+ Auto-generated quarterly periodic-review for **${REVIEW_ID}** by the \`Periodic Review\` workflow.
223
+
224
+ ## What auto-filled (~40%)
225
+
226
+ - Review-period metrics: releases shipped, gate pass rate, SAST + dependency findings, audit-log volume, open issues
227
+ - Frontmatter (\`review_id\`, period dates, generated_at)
228
+ - Section 2 control-area headers wired to the right framework clauses
229
+
230
+ ## What still needs the operator (~60%)
231
+
232
+ Each item below corresponds to a section of the doc. **Tick the box once the section is non-stub** — leaving REPLACE markers in place will fail audit review and the merge bar.
233
+
234
+ ### §3 Review notes
235
+ - [ ] Qualitative observations on the review period (≥2 sentences; no \`REPLACE\` text remaining)
236
+ - [ ] Cross-reference any incidents from this period (\`compliance/governance/incident-report-*.md\`)
237
+
238
+ ### §4 Control-effectiveness judgement
239
+ *Closes \`SOC2.CC4.1\` + \`ISO27001.A.12.1\` only when ALL control areas have a non-stub judgement.*
240
+
241
+ - [ ] Access control (ISO 27001 A.5.15) — effective / partially / not + 1-line evidence
242
+ - [ ] Secure SDLC (ISO 27001 A.8.25) — judgement + evidence
243
+ - [ ] Secure coding (ISO 27001 A.8.28) — judgement + evidence (SAST + dep-audit pass rate)
244
+ - [ ] Security testing (ISO 27001 A.8.29) — judgement + evidence (E2E pass rate)
245
+ - [ ] Change management (ISO 27001 A.8.32 + SOC 2 CC8.1) — judgement + evidence (four-eyes approvals count)
246
+ - [ ] Monitoring activities (ISO 27001 A.8.16 + EU AI Act Art. 12) — judgement + evidence (audit-log volume / coverage)
247
+
248
+ ### §5 Follow-up actions
249
+ - [ ] Each material finding → owner → due date (or "none for this period" stated explicitly)
250
+ - [ ] Carry-over actions from last quarter's review → status updated
251
+
252
+ ### §6 Sign-off
253
+ - [ ] Reviewer name + date (must be different from the actor who made code changes that the review is judging)
254
+ - [ ] Approver name + date (when \`risk_tier\` is medium or higher — dual-actor required)
255
+
256
+ ## Closes once merged
257
+
258
+ - \`SOC2.CC4.1\` (Monitoring of internal controls)
259
+ - \`ISO27001.A.12.1\` (Operational procedures and responsibilities)
260
+
261
+ Verify at \`${BASE}/projects/<slug>/compliance\` after the PR-merge push lands on develop — both clauses should flip MISSING → COVERED within ~2 minutes. Stays COVERED for 365 days (portal's \`freshnessDays\`), then flips to EXPIRED until the next quarterly review.
262
+
263
+ See [\`docs/governance-templates.md\`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/docs/governance-templates.md#soc-2--trust-services-criteria) for full guidance.
264
+ PRBODY
265
+ )
213
266
  gh pr create --base develop --head "${BRANCH}" \
214
267
  --title "chore(compliance): periodic review ${REVIEW_ID}" \
215
- --body "Auto-generated quarterly periodic-review for **${REVIEW_ID}** by the \`Periodic Review\` workflow.\n\n**Required before merge:**\n- [ ] Replace \`REPLACE — …\` markers in the **Review notes** section\n- [ ] Fill in control-effectiveness judgement for each control area\n- [ ] Add reviewer + approver names (dual-actor)\n- [ ] List follow-up actions with owners + dates\n\nSee [\`docs/governance-templates.md\`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/docs/governance-templates.md#soc-2--trust-services-criteria) (SDLC repo) for guidance.\n\nCloses \`SOC2.CC4.1\` + \`ISO27001.A.12.1\` for the period once the PR lands on develop."
268
+ --body "$PR_BODY"
216
269
  else
217
270
  echo "PR #${EXISTING} already open for this period — branch updated in place."
218
271
  fi