universal-dev-standards 5.4.0 → 5.6.0

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.
Files changed (138) hide show
  1. package/bundled/ai/options/testing/integration-testing.ai.yaml +2 -2
  2. package/bundled/ai/options/testing/unit-testing.ai.yaml +2 -2
  3. package/bundled/ai/standards/adversarial-test.ai.yaml +277 -0
  4. package/bundled/ai/standards/audit-trail.ai.yaml +113 -0
  5. package/bundled/ai/standards/browser-compatibility-standards.ai.yaml +63 -0
  6. package/bundled/ai/standards/chaos-injection-tests.ai.yaml +91 -0
  7. package/bundled/ai/standards/container-image-standards.ai.yaml +88 -0
  8. package/bundled/ai/standards/container-security.ai.yaml +331 -0
  9. package/bundled/ai/standards/contract-testing-standards.ai.yaml +62 -0
  10. package/bundled/ai/standards/cost-budget-test.ai.yaml +96 -0
  11. package/bundled/ai/standards/cross-flow-regression.ai.yaml +61 -0
  12. package/bundled/ai/standards/data-contract.ai.yaml +110 -0
  13. package/bundled/ai/standards/data-migration-testing.ai.yaml +96 -0
  14. package/bundled/ai/standards/data-pipeline.ai.yaml +113 -0
  15. package/bundled/ai/standards/disaster-recovery-drill.ai.yaml +89 -0
  16. package/bundled/ai/standards/flaky-test-management.ai.yaml +89 -0
  17. package/bundled/ai/standards/flow-based-testing.ai.yaml +240 -0
  18. package/bundled/ai/standards/full-coverage-testing.ai.yaml +192 -0
  19. package/bundled/ai/standards/iac-design-principles.ai.yaml +83 -0
  20. package/bundled/ai/standards/incident-response.ai.yaml +107 -0
  21. package/bundled/ai/standards/license-compliance.ai.yaml +106 -0
  22. package/bundled/ai/standards/llm-output-validation.ai.yaml +269 -0
  23. package/bundled/ai/standards/mock-boundary.ai.yaml +250 -0
  24. package/bundled/ai/standards/mutation-testing.ai.yaml +192 -0
  25. package/bundled/ai/standards/pii-classification.ai.yaml +109 -0
  26. package/bundled/ai/standards/policy-as-code-testing.ai.yaml +227 -0
  27. package/bundled/ai/standards/prd-standards.ai.yaml +88 -0
  28. package/bundled/ai/standards/product-metrics-standards.ai.yaml +111 -0
  29. package/bundled/ai/standards/prompt-regression.ai.yaml +94 -0
  30. package/bundled/ai/standards/property-based-testing.ai.yaml +105 -0
  31. package/bundled/ai/standards/release-quality-manifest.ai.yaml +135 -0
  32. package/bundled/ai/standards/release-readiness-gate.ai.yaml +77 -0
  33. package/bundled/ai/standards/replay-test.ai.yaml +111 -0
  34. package/bundled/ai/standards/runbook.ai.yaml +104 -0
  35. package/bundled/ai/standards/sast-advanced.ai.yaml +135 -0
  36. package/bundled/ai/standards/schema-evolution.ai.yaml +111 -0
  37. package/bundled/ai/standards/secret-management-standards.ai.yaml +105 -0
  38. package/bundled/ai/standards/secure-op.ai.yaml +365 -0
  39. package/bundled/ai/standards/security-testing.ai.yaml +171 -0
  40. package/bundled/ai/standards/server-ops-security.ai.yaml +274 -0
  41. package/bundled/ai/standards/slo-sli.ai.yaml +97 -0
  42. package/bundled/ai/standards/smoke-test.ai.yaml +87 -0
  43. package/bundled/ai/standards/supply-chain-attestation.ai.yaml +109 -0
  44. package/bundled/ai/standards/test-completeness-dimensions.ai.yaml +52 -5
  45. package/bundled/ai/standards/testing.ai.yaml +20 -13
  46. package/bundled/ai/standards/user-story-mapping.ai.yaml +108 -0
  47. package/bundled/core/accessibility-standards.md +58 -0
  48. package/bundled/core/adversarial-test.md +212 -0
  49. package/bundled/core/branch-completion.md +4 -0
  50. package/bundled/core/browser-compatibility-standards.md +220 -0
  51. package/bundled/core/chaos-injection-tests.md +116 -0
  52. package/bundled/core/checkin-standards.md +1 -0
  53. package/bundled/core/container-security.md +521 -0
  54. package/bundled/core/contract-testing-standards.md +182 -0
  55. package/bundled/core/cost-budget-test.md +69 -0
  56. package/bundled/core/cross-flow-regression.md +190 -0
  57. package/bundled/core/data-migration-testing.md +110 -0
  58. package/bundled/core/disaster-recovery-drill.md +73 -0
  59. package/bundled/core/flaky-test-management.md +73 -0
  60. package/bundled/core/flow-based-testing.md +275 -0
  61. package/bundled/core/full-coverage-testing.md +183 -0
  62. package/bundled/core/llm-output-validation.md +178 -0
  63. package/bundled/core/mock-boundary.md +100 -0
  64. package/bundled/core/mutation-testing.md +97 -0
  65. package/bundled/core/performance-standards.md +65 -0
  66. package/bundled/core/policy-as-code-testing.md +188 -0
  67. package/bundled/core/prompt-regression.md +72 -0
  68. package/bundled/core/property-based-testing.md +73 -0
  69. package/bundled/core/release-quality-manifest.md +193 -0
  70. package/bundled/core/release-readiness-gate.md +184 -0
  71. package/bundled/core/replay-test.md +86 -0
  72. package/bundled/core/sast-advanced.md +300 -0
  73. package/bundled/core/secure-op.md +314 -0
  74. package/bundled/core/security-testing.md +87 -0
  75. package/bundled/core/server-ops-security.md +493 -0
  76. package/bundled/core/smoke-test.md +65 -0
  77. package/bundled/core/supply-chain-attestation.md +117 -0
  78. package/bundled/locales/zh-CN/CHANGELOG.md +3 -3
  79. package/bundled/locales/zh-CN/README.md +1 -1
  80. package/bundled/locales/zh-CN/skills/ai-instruction-standards/SKILL.md +5 -5
  81. package/bundled/locales/zh-TW/CHANGELOG.md +3 -3
  82. package/bundled/locales/zh-TW/README.md +1 -1
  83. package/bundled/locales/zh-TW/core/browser-compatibility-standards.md +11 -0
  84. package/bundled/locales/zh-TW/core/contract-testing-standards.md +11 -0
  85. package/bundled/locales/zh-TW/core/cross-flow-regression.md +11 -0
  86. package/bundled/locales/zh-TW/core/release-readiness-gate.md +11 -0
  87. package/bundled/locales/zh-TW/skills/ai-instruction-standards/SKILL.md +183 -79
  88. package/bundled/skills/README.md +4 -3
  89. package/bundled/skills/SKILL_NAMING.md +94 -0
  90. package/bundled/skills/ai-instruction-standards/SKILL.md +181 -88
  91. package/bundled/skills/atdd-assistant/SKILL.md +8 -0
  92. package/bundled/skills/bdd-assistant/SKILL.md +7 -0
  93. package/bundled/skills/checkin-assistant/SKILL.md +8 -0
  94. package/bundled/skills/code-review-assistant/SKILL.md +7 -0
  95. package/bundled/skills/journey-test-assistant/SKILL.md +203 -0
  96. package/bundled/skills/orchestrate/SKILL.md +167 -0
  97. package/bundled/skills/plan/SKILL.md +234 -0
  98. package/bundled/skills/pr-automation-assistant/SKILL.md +8 -0
  99. package/bundled/skills/push/SKILL.md +49 -2
  100. package/bundled/skills/{process-automation → skill-builder}/SKILL.md +1 -1
  101. package/bundled/skills/{forward-derivation → spec-derivation}/SKILL.md +1 -1
  102. package/bundled/skills/spec-driven-dev/SKILL.md +7 -0
  103. package/bundled/skills/sweep/SKILL.md +145 -0
  104. package/bundled/skills/tdd-assistant/SKILL.md +7 -0
  105. package/package.json +6 -6
  106. package/src/commands/check.js +43 -0
  107. package/src/commands/flow.js +8 -0
  108. package/src/commands/init.js +2 -1
  109. package/src/commands/start.js +14 -0
  110. package/src/commands/sweep.js +8 -0
  111. package/src/commands/update.js +10 -0
  112. package/src/commands/workflow.js +8 -0
  113. package/standards-registry.json +483 -5
  114. package/bundled/locales/zh-CN/skills/ac-coverage-assistant/SKILL.md +0 -190
  115. package/bundled/locales/zh-CN/skills/forward-derivation/SKILL.md +0 -71
  116. package/bundled/locales/zh-CN/skills/forward-derivation/guide.md +0 -130
  117. package/bundled/locales/zh-CN/skills/methodology-system/SKILL.md +0 -88
  118. package/bundled/locales/zh-CN/skills/methodology-system/create-methodology.md +0 -350
  119. package/bundled/locales/zh-CN/skills/methodology-system/guide.md +0 -131
  120. package/bundled/locales/zh-CN/skills/methodology-system/runtime.md +0 -279
  121. package/bundled/locales/zh-CN/skills/process-automation/SKILL.md +0 -143
  122. package/bundled/locales/zh-TW/skills/ac-coverage-assistant/SKILL.md +0 -195
  123. package/bundled/locales/zh-TW/skills/deploy-assistant/SKILL.md +0 -178
  124. package/bundled/locales/zh-TW/skills/forward-derivation/SKILL.md +0 -69
  125. package/bundled/locales/zh-TW/skills/forward-derivation/guide.md +0 -415
  126. package/bundled/locales/zh-TW/skills/methodology-system/SKILL.md +0 -86
  127. package/bundled/locales/zh-TW/skills/methodology-system/create-methodology.md +0 -350
  128. package/bundled/locales/zh-TW/skills/methodology-system/guide.md +0 -131
  129. package/bundled/locales/zh-TW/skills/methodology-system/runtime.md +0 -279
  130. package/bundled/locales/zh-TW/skills/process-automation/SKILL.md +0 -144
  131. /package/bundled/skills/{ac-coverage-assistant → ac-coverage}/SKILL.md +0 -0
  132. /package/bundled/skills/{methodology-system → dev-methodology}/SKILL.md +0 -0
  133. /package/bundled/skills/{methodology-system → dev-methodology}/create-methodology.md +0 -0
  134. /package/bundled/skills/{methodology-system → dev-methodology}/guide.md +0 -0
  135. /package/bundled/skills/{methodology-system → dev-methodology}/integrated-flow.md +0 -0
  136. /package/bundled/skills/{methodology-system → dev-methodology}/prerequisite-check.md +0 -0
  137. /package/bundled/skills/{methodology-system → dev-methodology}/runtime.md +0 -0
  138. /package/bundled/skills/{forward-derivation → spec-derivation}/guide.md +0 -0
@@ -0,0 +1,104 @@
1
+ # Runbook Standards - AI Optimized
2
+ # Source: XSPEC-063 Wave 3 SRE Pack
3
+
4
+ id: runbook
5
+ title: Runbook Writing Standards
6
+ version: "1.0.0"
7
+ status: Active
8
+ tags: [sre, operations, runbook, incident, oncall]
9
+ summary: |
10
+ Defines how operational runbooks are written, organized, maintained, and
11
+ tested. Covers required sections, writing principles (reproducible,
12
+ unambiguous steps), directory structure, review cadence, and drill
13
+ frequency. A well-written runbook reduces Mean Time To Repair (MTTR) by
14
+ ensuring any on-call engineer can execute recovery steps without requiring
15
+ tribal knowledge.
16
+
17
+ requirements:
18
+ - id: REQ-001
19
+ title: Required Runbook Sections
20
+ description: |
21
+ Every runbook MUST include the following sections in order:
22
+ (1) Overview — alert name, severity, affected services, owner, last
23
+ updated, last drilled date; (2) Symptoms — observable indicators;
24
+ (3) Impact Assessment — user-facing effect and blast radius;
25
+ (4) Diagnostic Steps — ordered steps with copy-pasteable commands;
26
+ (5) Fix Steps — ordered remediation with verification for each step;
27
+ (6) Escalation — specific contacts with role and availability;
28
+ (7) Post-Actions — follow-up tasks, tickets, postmortem triggers.
29
+ level: MUST
30
+ examples:
31
+ - "Overview: Alert=HighErrorRate, Severity=P2, Service=payment-api, Owner=@alice"
32
+ - "Diagnostic: `kubectl get pods -n payments | grep -v Running`"
33
+ - "Escalation: If not resolved in 30min, page @payment-lead (PD: pd-payments)"
34
+
35
+ - id: REQ-002
36
+ title: Reproducible and Unambiguous Steps
37
+ description: |
38
+ Each step in a runbook MUST be reproducible and unambiguous. Steps
39
+ MUST use copy-pasteable commands with no placeholders left undefined.
40
+ Decision points MUST include explicit branch conditions (if X then Y,
41
+ else Z). Every fix step MUST include a verification command confirming
42
+ the fix worked before proceeding. Expected output MUST be shown.
43
+ level: MUST
44
+ examples:
45
+ - "Bad: 'Restart the service' — Good: `systemctl restart payment-api && systemctl status payment-api`"
46
+ - "Branch: If error count > 100/min go to step 5a, else go to step 5b"
47
+ - "Verify: `curl -s https://api/health | jq .status` should return 'ok'"
48
+
49
+ - id: REQ-003
50
+ title: Runbook Naming and Directory Organization
51
+ description: |
52
+ Runbooks MUST use kebab-case names that describe the problem, not the
53
+ solution. Files MUST be organized into typed directories:
54
+ alerts/ for alert-response runbooks, operations/ for standard ops,
55
+ emergency/ for major incident procedures, troubleshooting/ for
56
+ general investigation guides. Each runbook file MUST declare its type
57
+ in the front matter.
58
+ level: MUST
59
+ examples:
60
+ - "Good: alerts/payment-api-high-error-rate.md"
61
+ - "Bad: runbooks/restart-payment-service.md"
62
+ - "Front matter: type: alert_response, alert: HighErrorRateAlert"
63
+
64
+ - id: REQ-004
65
+ title: Review and Drill Cadence
66
+ description: |
67
+ Runbooks MUST be reviewed on schedule based on type: alert-response
68
+ runbooks quarterly, emergency procedures monthly, standard operation
69
+ and troubleshooting guides bi-annually, change procedures after each
70
+ use. Runbooks MUST be drilled: P1 runbooks monthly, P2 quarterly,
71
+ emergency procedures quarterly. Drill records must be appended to the
72
+ runbook or linked from it.
73
+ level: MUST
74
+ examples:
75
+ - "Drill record: 2026-03-15, participants: @alice @bob, result: pass, MTTR: 12min"
76
+ - "Quarterly review: updated diagnostic commands after k8s upgrade"
77
+ - "Post-change update: change-procedure/db-failover.md updated after March 14 drill"
78
+
79
+ - id: REQ-005
80
+ title: Rollback and Fallback Steps
81
+ description: |
82
+ Any runbook describing a change or fix MUST include a clearly labeled
83
+ rollback section describing how to undo the change if the fix fails
84
+ or causes additional issues. The rollback section MUST appear before
85
+ the escalation section and include its own verification steps.
86
+ level: MUST
87
+ examples:
88
+ - "Rollback: `helm rollback payment-api 1 && kubectl rollout status deployment/payment-api`"
89
+ - "Rollback verify: error rate returns below 1% within 3 minutes"
90
+ - "If rollback fails: escalate immediately, do not attempt further fixes"
91
+
92
+ - id: REQ-006
93
+ title: Alert Integration Metadata
94
+ description: |
95
+ Alert-response runbooks SHOULD include a metadata block linking the
96
+ runbook to specific alert rules. This enables automatic runbook
97
+ linking in alerting tools (PagerDuty, Alertmanager). Metadata MUST
98
+ include the alert name, dashboard URL, and Prometheus/logging query
99
+ used to investigate.
100
+ level: SHOULD
101
+ examples:
102
+ - "alert_name: PaymentAPIHighErrorRate5xx"
103
+ - "dashboard: https://grafana/d/payment-api-overview"
104
+ - "query: sum(rate(http_requests_total{status=~'5..'}[5m])) by (service)"
@@ -0,0 +1,135 @@
1
+ # Advanced SAST Standards - AI Optimized
2
+ # Source: XSPEC-161 SAST Advanced
3
+
4
+ id: sast-advanced
5
+ title: Advanced SAST Standards
6
+ version: "1.0.0"
7
+ status: Active
8
+ tags: [sast, codeql, gitleaks, trufflehog, secret-scanning, biome, static-analysis, security, typescript, ci]
9
+ summary: |
10
+ Defines advanced Static Application Security Testing (SAST) practices
11
+ beyond basic dependency auditing. Covers three complementary layers:
12
+ (1) CodeQL semantic analysis for TypeScript/JavaScript — detects injection
13
+ vulnerabilities, path traversal, prototype pollution, and XSS that npm audit
14
+ misses; (2) Secret scanning with gitleaks or TruffleHog — prevents committing
15
+ API keys, tokens, and credentials; (3) Biome-based code quality rules used as
16
+ a security lint layer for projects that adopt Biome instead of ESLint.
17
+ Specifies CI enforcement thresholds: block merge on any CRITICAL or HIGH
18
+ severity finding; 0 High findings is the passing gate.
19
+
20
+ requirements:
21
+ - id: REQ-001
22
+ title: CodeQL Semantic Analysis
23
+ description: |
24
+ Projects using TypeScript or JavaScript MUST run CodeQL semantic analysis
25
+ on every push to the default branch and on every pull request targeting
26
+ the default branch. Additionally, a weekly scheduled scan MUST be
27
+ configured to catch newly published query packs. Use the
28
+ `security-extended` query suite rather than the default suite to include
29
+ injection, path-traversal, prototype-pollution, and XSS queries.
30
+ CodeQL MUST be configured with `github/codeql-action/init@v3` with
31
+ `languages: javascript-typescript` and query filters narrowed to
32
+ `security-extended`. The `autobuild` action MUST be used unless a
33
+ custom build command is required. Results MUST be uploaded to GitHub
34
+ Code Scanning so that SARIF findings appear in the Security tab and
35
+ block PRs when severity >= HIGH.
36
+ level: MUST
37
+ examples:
38
+ - "Workflow trigger: push to main + pull_request targeting main + schedule weekly"
39
+ - "init step: uses: github/codeql-action/init@v3 with languages: javascript-typescript"
40
+ - "query-filters: include tags contain security-extended"
41
+ - "analyze step uploads SARIF; GitHub blocks PR merge when CRITICAL/HIGH found"
42
+ - "Weekly cron: '0 2 * * 1' catches newly published CodeQL query packs"
43
+
44
+ - id: REQ-002
45
+ title: Secret Scanning on Every Push and PR
46
+ description: |
47
+ A secret scanning step MUST run on every push and pull request to detect
48
+ accidentally committed API keys, tokens, private keys, and credentials
49
+ before they reach the repository history. The recommended tool is
50
+ gitleaks (via `gitleaks/gitleaks-action@v2`). Projects MUST maintain a
51
+ `.gitleaks.toml` configuration file in the repository root to declare
52
+ custom patterns for project-specific secret formats and to whitelist
53
+ documented false positives via allowlist rules. The CI step MUST fail
54
+ with a non-zero exit code when any secret is detected, blocking merge.
55
+ Baseline false positives MUST be documented and reviewed quarterly.
56
+ level: MUST
57
+ examples:
58
+ - "CI job: uses gitleaks/gitleaks-action@v2 on push and pull_request events"
59
+ - ".gitleaks.toml defines custom patterns for project-specific tokens"
60
+ - "Allowlist rule added with documented justification for known false positive"
61
+ - "Secret detected → CI fails → developer rotates credential before re-pushing"
62
+
63
+ - id: REQ-003
64
+ title: Biome Security Rules as Lint Gate
65
+ description: |
66
+ Projects using Biome as their linter MUST enable the security-relevant
67
+ linting rules as part of the standard lint pass. Biome's `nursery` and
68
+ `suspicious` rule groups include patterns such as `noConsoleLog` (prevents
69
+ accidental secret logging), `noGlobalEval` (prevents dynamic code execution),
70
+ `noWith` (prevents scope pollution), and `noDebugger` (prevents debug
71
+ breakpoints in production). The `biome check .` command MUST be run in CI
72
+ as a blocking step. Projects MUST NOT use `--allow-errors` to bypass
73
+ security-relevant rule failures. Configuration in `biome.json` MUST set
74
+ `linter.enabled: true` and include the `recommended: true` ruleset plus
75
+ any additional security rules appropriate to the project.
76
+ level: MUST
77
+ examples:
78
+ - "biome.json: linter.enabled true, rules.suspicious.noGlobalEval error"
79
+ - "CI step: `npm run lint` maps to `biome check .`; fails on security rule violations"
80
+ - "noConsoleLog prevents accidental logging of JWT tokens or API keys"
81
+ - "noGlobalEval prevents eval() usage that could enable code injection"
82
+
83
+ - id: REQ-004
84
+ title: CI Quality Gate Thresholds
85
+ description: |
86
+ SAST findings MUST be classified by severity and the following merge-blocking
87
+ thresholds MUST be enforced: CRITICAL findings — block merge immediately,
88
+ no exceptions; HIGH findings — block merge; target is 0 HIGH findings in
89
+ all open PRs; MEDIUM findings — create tracking issue, do not block merge,
90
+ resolve within 30 days; LOW/INFORMATIONAL findings — optional resolution,
91
+ logged for visibility. GitHub Code Scanning branch protection rules MUST
92
+ be configured to require the CodeQL check to pass before merging.
93
+ The `sast` CI job MUST be listed as a required status check in branch
94
+ protection settings.
95
+ level: MUST
96
+ examples:
97
+ - "Branch protection: require CodeQL check + sast job to pass before merge"
98
+ - "CRITICAL finding in CodeQL → PR blocked; developer must fix or accept risk with CISO sign-off"
99
+ - "HIGH finding threshold: 0 HIGH open on main branch at all times"
100
+ - "MEDIUM finding: GitHub issue opened automatically via SARIF annotation; 30-day SLA"
101
+
102
+ - id: REQ-005
103
+ title: What CodeQL Finds That npm audit Misses
104
+ description: |
105
+ Teams MUST understand that npm audit only checks published CVEs in
106
+ dependency manifests (package.json lock file). CodeQL performs semantic
107
+ data-flow analysis on the actual source code and detects:
108
+ (1) Command injection — user-controlled data flowing into child_process.exec
109
+ or child_process.spawn with shell:true; (2) Path traversal — user input
110
+ used in fs.readFile / fs.writeFile without path.resolve + allowlist check;
111
+ (3) Prototype pollution — assignment to obj[userKey] = value where userKey
112
+ is unsanitized; (4) XSS via DOM sinks — user data assigned to innerHTML,
113
+ document.write, or passed to eval; (5) SQL injection via string concatenation
114
+ in ORM raw queries. These vulnerabilities exist in first-party code and are
115
+ invisible to dependency scanners.
116
+ level: SHOULD
117
+ examples:
118
+ - "CodeQL flags: exec(`git log ${userInput}`) as command injection"
119
+ - "CodeQL flags: fs.readFile(path.join(base, req.params.file)) as path traversal"
120
+ - "CodeQL flags: target[req.body.key] = req.body.value as prototype pollution"
121
+ - "npm audit shows 0 vulnerabilities; CodeQL finds path traversal in custom route handler"
122
+
123
+ anti_patterns:
124
+ - "Running only npm audit and considering security 'done'"
125
+ - "Disabling CodeQL on PRs to speed up CI — defeats the purpose of shift-left security"
126
+ - "Adding entire file paths to gitleaks allowlist without reviewing the actual content"
127
+ - "Ignoring MEDIUM CodeQL findings indefinitely without tracking issues"
128
+ - "Using biome check --allow-errors to bypass security lint failures"
129
+ - "Not uploading SARIF results to GitHub Code Scanning (findings invisible in UI)"
130
+
131
+ related_standards:
132
+ - security-standards
133
+ - secret-management-standards
134
+ - checkin-standards
135
+ - container-security
@@ -0,0 +1,111 @@
1
+ # Schema Evolution Standards - AI Optimized
2
+ # Source: XSPEC-068 Wave 3 Data Engineering Pack
3
+
4
+ id: schema-evolution
5
+ title: Schema Evolution Standards
6
+ version: "1.0.0"
7
+ status: Active
8
+ tags: [data-engineering, schema, migration, backward-compatibility, database]
9
+ summary: |
10
+ Defines how database and data store schemas are evolved safely without
11
+ breaking existing consumers. Covers backward-compatible change patterns,
12
+ prohibited breaking changes, expand-contract migration strategy, schema
13
+ versioning, automated compatibility checking in CI/CD, and rollback
14
+ procedures for schema changes. Applicable to relational databases,
15
+ document stores, event schemas (Avro/Protobuf), and API request/response
16
+ schemas.
17
+
18
+ requirements:
19
+ - id: REQ-001
20
+ title: Backward-Compatible Change Patterns
21
+ description: |
22
+ All schema changes MUST be backward-compatible unless a formal
23
+ breaking-change process is followed. Backward-compatible changes
24
+ include: adding new nullable columns/fields with defaults, adding
25
+ new tables/collections, adding new optional message fields, adding
26
+ new enum values (with unknown handling), widening a data type
27
+ (INT → BIGINT), and adding new indexes. These changes MUST be
28
+ deployable without coordinating consumer updates.
29
+ level: MUST
30
+ examples:
31
+ - "Add column: ALTER TABLE users ADD COLUMN middle_name VARCHAR(100) DEFAULT NULL"
32
+ - "Add optional Protobuf field: optional string nickname = 15; — safe, zero default"
33
+ - "Add index: CREATE INDEX CONCURRENTLY idx_orders_user_id ON orders(user_id)"
34
+
35
+ - id: REQ-002
36
+ title: Prohibited Breaking Changes Without Migration Plan
37
+ description: |
38
+ The following schema changes are classified as BREAKING and MUST NOT
39
+ be deployed without a formal expand-contract migration plan and
40
+ consumer coordination: renaming or dropping columns/fields, changing
41
+ data types incompatibly (VARCHAR → INT, widening to narrowing),
42
+ adding NOT NULL constraints to existing columns without defaults,
43
+ changing primary or foreign key definitions, removing enum values,
44
+ and changing field semantics (repurposing a column for different data).
45
+ level: MUST
46
+ examples:
47
+ - "PROHIBITED: ALTER TABLE users DROP COLUMN legacy_id → requires expand-contract"
48
+ - "PROHIBITED: ALTER TABLE orders ALTER COLUMN amount TYPE BIGINT — evaluate consumer impact first"
49
+ - "PROHIBITED: adding NOT NULL to existing column with NULL values in production data"
50
+
51
+ - id: REQ-003
52
+ title: Expand-Contract Migration Strategy
53
+ description: |
54
+ Breaking schema changes MUST use the expand-contract (parallel change)
55
+ pattern: Phase 1 (Expand) — add new structure alongside old; Phase 2
56
+ (Migrate) — backfill data from old to new, update all writers;
57
+ Phase 3 (Contract) — update all readers to use new structure;
58
+ Phase 4 (Cleanup) — remove old structure after all consumers updated.
59
+ Each phase MUST be a separate deployment, verified before proceeding.
60
+ Minimum wait between phases: 1 full deployment cycle.
61
+ level: MUST
62
+ examples:
63
+ - "Rename column email → contact_email: add contact_email, dual-write for 1 sprint, migrate readers, drop email"
64
+ - "Phase gate: 'Phase 2 complete when 0 reads of old column seen in query logs over 7 days'"
65
+ - "Cleanup verified: `SELECT COUNT(*) FROM users WHERE email IS NOT NULL` returns 0 before dropping"
66
+
67
+ - id: REQ-004
68
+ title: Schema Versioning and Registry
69
+ description: |
70
+ Event-driven and API schemas (Avro, Protobuf, JSON Schema) MUST be
71
+ registered in a schema registry with explicit version numbers.
72
+ Schema versions MUST follow semantic versioning: PATCH for backward-
73
+ compatible additions, MINOR for new optional fields, MAJOR for
74
+ breaking changes. Every schema change MUST be reviewed and approved
75
+ before registration. Consumers MUST specify the schema version they
76
+ consume.
77
+ level: MUST
78
+ examples:
79
+ - "Confluent Schema Registry: subject 'order-events-value', version 3 registered"
80
+ - "Schema compatibility: BACKWARD_TRANSITIVE enforced — new schema must be readable by all prior consumers"
81
+ - "Consumer declaration: {schema_id: 'order-events', version: '>=2.0.0 <3.0.0'}"
82
+
83
+ - id: REQ-005
84
+ title: Automated Schema Compatibility Checking in CI
85
+ description: |
86
+ Every PR modifying schema definitions MUST trigger automated
87
+ compatibility checks in CI. For relational schemas, migration scripts
88
+ MUST be run against a production-snapshot database in CI to detect
89
+ errors before merge. For event schemas, compatibility MUST be checked
90
+ against all registered consumer versions. Compatibility failures MUST
91
+ block the PR merge.
92
+ level: MUST
93
+ examples:
94
+ - "CI step: `flyway validate -url=jdbc:postgresql://test-db/snapshots` on every migration PR"
95
+ - "Avro compatibility: `schema-registry-validate --mode BACKWARD_TRANSITIVE new-schema.avsc`"
96
+ - "Failed check message: 'Schema change removes required field order_id — breaks consumer v2.3'"
97
+
98
+ - id: REQ-006
99
+ title: Schema Change Rollback Procedures
100
+ description: |
101
+ Every schema migration script MUST have a corresponding rollback
102
+ (down) migration script. Rollback scripts MUST be tested in CI
103
+ alongside the forward migration. For destructive changes (drops,
104
+ type changes), a data backup MUST be taken and verified before
105
+ execution. The rollback plan MUST be documented in the migration
106
+ PR and referenced in the deployment runbook.
107
+ level: MUST
108
+ examples:
109
+ - "V12__add_user_tier.sql paired with V12__add_user_tier.undo.sql tested in CI"
110
+ - "Pre-migration backup: `pg_dump orders_table > backup-2026-04-30-pre-v12.dump`"
111
+ - "Rollback PR comment: 'Rollback: run V12.undo.sql, takes ~2min, no data loss'"
@@ -0,0 +1,105 @@
1
+ # Secret Management Standards - AI Optimized
2
+ # Source: XSPEC-065 Wave 4 IaC Pack
3
+
4
+ id: secret-management-standards
5
+ title: Secret Management and Credential Hygiene Standards
6
+ version: "1.0.0"
7
+ status: Active
8
+ tags: [secrets, vault, kms, sops, security, rotation, credential-management]
9
+ summary: |
10
+ Defines how teams store, inject, rotate, and audit secrets and credentials
11
+ across development and production environments. Covers three approved secret
12
+ source tiers (Vault dynamic secrets, Cloud KMS, SOPS+Git), rotation policies
13
+ by credential type, automated hardcoded-secret prevention via pre-commit and
14
+ CI scanning, and safe secret injection patterns. Designed to eliminate
15
+ credentials from source code and CI logs while maintaining operational
16
+ practicality across team sizes.
17
+
18
+ requirements:
19
+ - id: REQ-001
20
+ title: Secret Source Three Options
21
+ description: |
22
+ Teams MUST use one of three approved secret source tiers based on
23
+ operational context. (1) HashiCorp Vault dynamic secrets (preferred for
24
+ production and multi-team environments) — secrets are generated on-demand
25
+ with short TTLs; no static credentials stored anywhere. (2) Cloud KMS
26
+ with native secret managers (AWS Secrets Manager / GCP Secret Manager /
27
+ Azure Key Vault) — suitable for cloud-native deployments; secrets fetched
28
+ at runtime via IAM-controlled API calls. (3) SOPS + Git encryption —
29
+ suitable for small teams and GitOps workflows; secrets encrypted with
30
+ age or KMS key before committing; decrypted only in trusted runtime
31
+ environments. Storing unencrypted secrets in any other location (env
32
+ files, wiki, chat) is PROHIBITED.
33
+ level: MUST
34
+ examples:
35
+ - "Vault: app requests DB credentials via Vault agent sidecar with 1h TTL lease"
36
+ - "AWS Secrets Manager: Lambda reads secret ARN from env var; SDK fetches at cold start"
37
+ - "SOPS: `secrets.yaml` encrypted with age key; decrypted in CI via SOPS_AGE_KEY env var"
38
+ - "Prohibited: secrets in `.env` files committed to repo, even private repos"
39
+
40
+ - id: REQ-002
41
+ title: Rotation Policy by Type
42
+ description: |
43
+ All secrets MUST have a defined rotation policy enforced by automated
44
+ tooling or calendar reminders. Minimum rotation frequencies by type:
45
+ Database credentials: every 90 days. API keys (third-party services):
46
+ every 180 days. Signing keys (JWT, code signing): every 365 days.
47
+ One-time tokens and session credentials: revoke immediately after use;
48
+ MUST NOT be reused. TLS certificates: rotate at least 30 days before
49
+ expiry; automate with ACME/Let's Encrypt or cert-manager where possible.
50
+ Rotation events MUST be logged in the audit trail.
51
+ level: MUST
52
+ examples:
53
+ - "DB credentials rotated via Vault dynamic secrets every 90 days automatically"
54
+ - "Stripe API key rotation reminder calendar event set for 180-day interval"
55
+ - "JWT signing key rotated annually; old key retained for 7-day grace period"
56
+ - "CI temporary tokens scoped to single job; revoked by runner post-job"
57
+
58
+ - id: REQ-003
59
+ title: Hardcoded Secret Prevention
60
+ description: |
61
+ Teams MUST implement automated scanning to detect and block hardcoded
62
+ secrets before they reach the repository. Two layers are REQUIRED:
63
+ (1) Pre-commit hook using detect-secrets, gitleaks, or truffleHog —
64
+ scans staged files and blocks commit if patterns are detected.
65
+ (2) CI pipeline scan — rescans all changed files on every PR; blocks
66
+ merge if secrets are found. Minimum detected patterns: AWS access key
67
+ format (AKIA[0-9A-Z]{16}), PEM private key headers (-----BEGIN .* PRIVATE KEY),
68
+ generic API token patterns (api[_-]?key\s*[:=]\s*\S{16,}), and
69
+ connection strings containing passwords.
70
+ level: MUST
71
+ examples:
72
+ - "`.pre-commit-config.yaml` includes `detect-secrets` hook; fails on AWS key pattern"
73
+ - "CI step: `gitleaks detect --source . --exit-code 1` blocks PR merge"
74
+ - "False positive whitelisted via `.secrets.baseline` with documented justification"
75
+ - "Developer receives pre-commit error: 'High confidence secret detected: AWS Access Key'"
76
+
77
+ - id: REQ-004
78
+ title: Secret Injection
79
+ description: |
80
+ Secrets MUST be injected into application processes via environment
81
+ variables or mounted files only. Passing secrets via command-line
82
+ arguments is PROHIBITED (visible in process lists). Passing secrets via
83
+ URL query parameters is PROHIBITED (logged by proxies and servers).
84
+ For environment variable injection, use the platform's native secret
85
+ injection (Kubernetes Secrets, ECS task definition secrets, GitHub
86
+ Actions secrets). For file-based injection, mount secrets as
87
+ read-only volumes with restrictive file permissions (0400 or 0600).
88
+ level: MUST
89
+ examples:
90
+ - "Kubernetes: secret mounted as env var via `secretKeyRef` in pod spec"
91
+ - "Prohibited: `./app --db-password=s3cr3t` (visible in `ps aux`)"
92
+ - "Prohibited: `https://api.example.com?token=abc123` (logged by nginx)"
93
+ - "File injection: secret mounted at `/run/secrets/db-password` with mode 0400"
94
+
95
+ anti_patterns:
96
+ - "Hardcoding credentials directly in source code or configuration files"
97
+ - "Storing secrets in CI/CD environment variables without encryption (plaintext in UI)"
98
+ - "Sharing credentials across multiple environments (dev/staging/prod use same secret)"
99
+ - "Long-lived static credentials without rotation schedules"
100
+ - "Committing .env files containing real secrets to version control"
101
+
102
+ related_standards:
103
+ - iac-design-principles
104
+ - audit-trail
105
+ - pii-classification