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,493 @@
1
+ # 伺服器操作安全標準
2
+
3
+ > **標準 ID**: server-ops-security
4
+ > **版本**: 1.0.0
5
+ > **更新日期**: 2026-05-04
6
+ > **AI 優化格式**: `ai/standards/server-ops-security.ai.yaml`
7
+
8
+ ---
9
+
10
+ ## 1. 概述
11
+
12
+ ### 為什麼 AI 自主運維需要伺服器操作安全?
13
+
14
+ AI 自主運維系統(如 VibeOps)在生產環境中以自動化方式執行高權限操作——部署服務、管理容器、調用外部 API、存取資料庫。這些能力若缺乏適當的基礎設施安全防護,將帶來遠超傳統 Web 應用的風險:
15
+
16
+ - **攻擊面擴大**:AI Agent 持續運行,攻擊者只需一個進入點即可橫向移動
17
+ - **自動化即武器**:被入侵的 AI Agent 可自動執行大規模破壞(刪除資料、外洩機密)
18
+ - **責任追溯困難**:若 AI Agent 以 root 身份運行,事後難以區分系統行為與攻擊者行為
19
+
20
+ 本標準涵蓋六大安全域,與 `secure-op.ai.yaml`(AI Agent 決策安全)形成互補:
21
+ - `secure-op` 管控「AI Agent 決策層的安全性」
22
+ - `server-ops-security` 管控「AI Agent 所在基礎設施的安全性」
23
+
24
+ ---
25
+
26
+ ## 2. 六大安全域
27
+
28
+ ### 2.1 SSH 強化(SSH Hardening)
29
+
30
+ **核心原則**:SSH 服務只允許金鑰認證,禁止密碼登入與 root 直接登入。
31
+
32
+ #### 必要的 `/etc/ssh/sshd_config` 設定
33
+
34
+ ```
35
+ PasswordAuthentication no
36
+ PermitRootLogin no
37
+ PubkeyAuthentication yes
38
+ Port 2222 # 改為非預設 Port
39
+ MaxAuthTries 3
40
+ LoginGraceTime 30
41
+ AllowUsers deploy vibeops # 明確白名單
42
+ ClientAliveInterval 300
43
+ ClientAliveCountMax 2
44
+ ```
45
+
46
+ 套用後重載:
47
+ ```bash
48
+ sudo systemctl reload sshd
49
+ # 驗證設定生效
50
+ sshd -T | grep -E "passwordauthentication|permitrootlogin|port"
51
+ ```
52
+
53
+ #### fail2ban 安裝與設定
54
+
55
+ ```bash
56
+ sudo apt install fail2ban
57
+ ```
58
+
59
+ `/etc/fail2ban/jail.local`:
60
+ ```ini
61
+ [sshd]
62
+ enabled = true
63
+ maxretry = 5
64
+ findtime = 600
65
+ bantime = 3600 # 1 小時,建議生產環境設為 86400(24 小時)
66
+ ```
67
+
68
+ #### 金鑰管理規範
69
+
70
+ | 項目 | 規範 |
71
+ |------|------|
72
+ | 演算法 | Ed25519(禁用 RSA-1024) |
73
+ | 私鑰保護 | 必須設定 passphrase |
74
+ | 輪替週期 | 每年或懷疑洩漏時立即輪替 |
75
+ | 授權金鑰 | `~/.ssh/authorized_keys` 定期審計,刪除離職人員 |
76
+
77
+ **常見陷阱**:
78
+ - 修改 sshd_config 後忘記 reload,設定不生效
79
+ - 將 `AllowUsers` 留空(等同不限制)
80
+ - 用 RSA-2048 金鑰但未停用 RSA-1024 的相容性
81
+
82
+ **ISO 對映**:ISO/IEC 27001:2022 A.8.5(安全認證)、A.8.20(網路安全)
83
+
84
+ ---
85
+
86
+ ### 2.2 主機強化(Host Hardening)
87
+
88
+ **核心原則**:最小化安裝,僅保留必要服務,遵循 CIS Benchmark Level 1。
89
+
90
+ #### 停用不必要的服務
91
+
92
+ ```bash
93
+ # 停用常見不必要服務
94
+ sudo systemctl disable --now avahi-daemon cups bluetooth
95
+ # 確認已停用
96
+ systemctl list-unit-files --state=enabled | grep -E "avahi|cups|bluetooth"
97
+ ```
98
+
99
+ #### 啟用防火牆(UFW)
100
+
101
+ ```bash
102
+ sudo ufw default deny incoming
103
+ sudo ufw default allow outgoing
104
+ sudo ufw allow 2222/tcp # SSH(非預設 Port)
105
+ sudo ufw allow 443/tcp # HTTPS
106
+ sudo ufw enable
107
+ sudo ufw status verbose
108
+ ```
109
+
110
+ #### 啟用 auditd(系統呼叫審計)
111
+
112
+ ```bash
113
+ sudo apt install auditd
114
+ sudo systemctl enable --now auditd
115
+
116
+ # 加入關鍵審計規則 /etc/audit/rules.d/hardening.rules
117
+ -w /etc/passwd -p wa -k identity
118
+ -w /etc/sudoers -p wa -k sudo_changes
119
+ -w /etc/ssh/sshd_config -p wa -k sshd_config
120
+ -a always,exit -F arch=b64 -S execve -k exec_commands
121
+ ```
122
+
123
+ #### sysctl 強化參數
124
+
125
+ `/etc/sysctl.d/99-hardening.conf`:
126
+ ```
127
+ kernel.dmesg_restrict = 1
128
+ kernel.randomize_va_space = 2
129
+ net.ipv4.ip_forward = 0
130
+ net.ipv4.conf.all.accept_redirects = 0
131
+ net.ipv4.conf.all.send_redirects = 0
132
+ net.ipv4.tcp_syncookies = 1
133
+ fs.suid_dumpable = 0
134
+ ```
135
+
136
+ 套用:`sudo sysctl -p /etc/sysctl.d/99-hardening.conf`
137
+
138
+ #### Lynis 合規評分
139
+
140
+ ```bash
141
+ sudo apt install lynis
142
+ sudo lynis audit system
143
+ # 目標:Hardening index >= 75
144
+ ```
145
+
146
+ **常見陷阱**:
147
+ - 安裝 Docker 時自動修改 iptables 規則,繞過 UFW
148
+ - auditd 未設定 `-f 2`(發生審計失敗時停機),在高安全環境應啟用
149
+
150
+ **ISO 對映**:ISO/IEC 27001:2022 A.8.9(組態管理)、NIST SP 800-123
151
+
152
+ ---
153
+
154
+ ### 2.3 特權管理(Privilege Management)
155
+
156
+ **核心原則**:最小特權原則,服務帳號不具 shell 或 sudo 全權。
157
+
158
+ #### AI Agent 服務帳號建立
159
+
160
+ ```bash
161
+ # 建立無 shell 的服務帳號
162
+ sudo useradd -r -s /sbin/nologin -d /opt/vibeops vibeops
163
+ sudo mkdir -p /opt/vibeops
164
+ sudo chown vibeops:vibeops /opt/vibeops
165
+ sudo chmod 750 /opt/vibeops
166
+
167
+ # 驗證:不可切換到此帳號
168
+ sudo -u vibeops /bin/bash # 應拒絕
169
+ ```
170
+
171
+ #### sudo 設定(最小授權)
172
+
173
+ `/etc/sudoers.d/vibeops`:
174
+ ```
175
+ # 允許 vibeops 重啟特定服務(明確命令)
176
+ vibeops ALL=(ALL) NOPASSWD: /bin/systemctl restart vibeops-agent
177
+ # 禁止 NOPASSWD ALL 寫法
178
+ ```
179
+
180
+ 驗證 sudo 設定:`sudo visudo -c`
181
+
182
+ #### PAM 帳號鎖定(pam_faillock)
183
+
184
+ `/etc/security/faillock.conf`:
185
+ ```
186
+ deny = 5
187
+ fail_interval = 300
188
+ unlock_time = 900 # 15 分鐘鎖定
189
+ ```
190
+
191
+ `/etc/pam.d/common-auth` 加入:
192
+ ```
193
+ auth required pam_faillock.so preauth
194
+ auth [default=die] pam_faillock.so authfail
195
+ auth sufficient pam_faillock.so authsucc
196
+ ```
197
+
198
+ #### 季度特權帳號審計
199
+
200
+ ```bash
201
+ # 列出所有有 sudo 權限的帳號
202
+ grep -r "ALL=" /etc/sudoers /etc/sudoers.d/
203
+ # 列出最近 30 天有 sudo 紀錄的使用者
204
+ last | grep -v reboot | awk '{print $1}' | sort -u
205
+ ```
206
+
207
+ **常見陷阱**:
208
+ - `/etc/sudoers.d/` 下檔案不必要地設定 `NOPASSWD ALL`
209
+ - 服務帳號被開發者臨時加入 sudo 後忘記移除
210
+
211
+ **ISO 對映**:ISO/IEC 27001:2022 A.8.2(特權存取權利)、A.8.18
212
+
213
+ ---
214
+
215
+ ### 2.4 堡壘機模式(Bastion Pattern)
216
+
217
+ **核心原則**:生產環境只能透過 Bastion Host 存取,禁止直接 SSH 到 prod 節點。
218
+
219
+ #### 架構設計
220
+
221
+ ```
222
+ 管理者
223
+ │ SSH + MFA
224
+
225
+ Bastion Host(獨立 VM,對外唯一 SSH 入口)
226
+ │ SSH(金鑰)
227
+
228
+ Prod 節點(僅接受來自 Bastion 的 SSH)
229
+ ```
230
+
231
+ #### Prod 節點防火牆規則
232
+
233
+ ```bash
234
+ # 僅允許來自 Bastion IP 的 SSH
235
+ BASTION_IP="10.0.1.5"
236
+ sudo iptables -A INPUT -p tcp --dport 22 -s $BASTION_IP -j ACCEPT
237
+ sudo iptables -A INPUT -p tcp --dport 22 -j DROP
238
+ # 持久化
239
+ sudo apt install iptables-persistent
240
+ sudo netfilter-persistent save
241
+ ```
242
+
243
+ #### Bastion 上的 MFA 設定(TOTP)
244
+
245
+ ```bash
246
+ sudo apt install libpam-google-authenticator
247
+ # 每位使用者執行
248
+ google-authenticator -t -d -f -r 3 -R 30 -w 3
249
+ ```
250
+
251
+ `/etc/pam.d/sshd` 加入:
252
+ ```
253
+ auth required pam_google_authenticator.so
254
+ ```
255
+
256
+ `/etc/ssh/sshd_config` 設定:
257
+ ```
258
+ AuthenticationMethods publickey,keyboard-interactive
259
+ ```
260
+
261
+ #### Session 記錄
262
+
263
+ **方案一:script + tmux**
264
+ ```bash
265
+ # 自動記錄所有 session
266
+ cat >> /etc/profile.d/session-recording.sh << 'EOF'
267
+ if [ -n "$SSH_TTY" ]; then
268
+ SESSION_LOG="/var/log/sessions/$(date +%Y%m%d-%H%M%S)-$(whoami).log"
269
+ mkdir -p /var/log/sessions
270
+ script -q -a "$SESSION_LOG"
271
+ fi
272
+ EOF
273
+ ```
274
+
275
+ **方案二:Teleport(企業環境推薦)**
276
+ - 提供完整的 session 錄製、playback 與審計查詢
277
+
278
+ **常見陷阱**:
279
+ - Staging 環境未要求 Bastion,開發者習慣後在 Prod 也直連
280
+ - Bastion 本身未定期更新,成為攻擊跳板
281
+
282
+ **ISO 對映**:ISO/IEC 27001:2022 A.8.3(資訊存取限制)、NIST SP 800-207(零信任架構)
283
+
284
+ ---
285
+
286
+ ### 2.5 Patch 管理(Patch Management)
287
+
288
+ **核心原則**:定期更新系統與套件,CVE 修補有明確 SLA。
289
+
290
+ #### CVE 修補 SLA
291
+
292
+ | 嚴重等級 | SLA | 逾期處理 |
293
+ |---------|-----|---------|
294
+ | Critical | 24 小時內修補或隔離 | 立即下線 / 網路隔離 |
295
+ | High | 72 小時內修補 | 記錄豁免申請(max 7 天) |
296
+ | Medium | 7 天內修補 | Backlog + 追蹤 |
297
+ | Low | 下次維護視窗(≤ 30 天) | 定期維護週期 |
298
+
299
+ #### Ubuntu/Debian 自動安全更新
300
+
301
+ ```bash
302
+ sudo apt install unattended-upgrades
303
+ sudo dpkg-reconfigure --priority=low unattended-upgrades
304
+ ```
305
+
306
+ `/etc/apt/apt.conf.d/50unattended-upgrades`:
307
+ ```
308
+ Unattended-Upgrade::Allowed-Origins {
309
+ "${distro_id}:${distro_codename}-security";
310
+ };
311
+ Unattended-Upgrade::AutoFixInterruptedDpkg "true";
312
+ Unattended-Upgrade::Remove-Unused-Packages "true";
313
+ Unattended-Upgrade::Automatic-Reboot "false"; # 維護視窗手動重啟
314
+ ```
315
+
316
+ #### 容器映像掃描(Trivy)
317
+
318
+ ```bash
319
+ # 每次 build 後執行
320
+ trivy image --severity HIGH,CRITICAL myapp:latest
321
+
322
+ # CI 整合(阻擋 HIGH/CRITICAL)
323
+ trivy image --exit-code 1 --severity HIGH,CRITICAL myapp:latest
324
+ ```
325
+
326
+ #### AI Agent 容器映像更新規範
327
+
328
+ - 使用官方 base image(`ubuntu:22.04-minimal`、`gcr.io/distroless/nodejs`)
329
+ - 每 30 天(最多 90 天)重新 build,即使無程式碼變更
330
+ - Guardian OPA Sidecar 映像遵循相同 SLA
331
+
332
+ ```bash
333
+ # 查看映像建立日期
334
+ docker inspect <image> | jq '.[0].Created'
335
+ # 超過 90 天的映像應強制更新
336
+ ```
337
+
338
+ **常見陷阱**:
339
+ - 以為 `unattended-upgrades` 包含所有更新(實際上預設只包含 security)
340
+ - 未將 Critical CVE SLA 觸發器整合到告警系統
341
+
342
+ **ISO 對映**:ISO/IEC 27001:2022 A.8.8(技術漏洞管理)
343
+
344
+ ---
345
+
346
+ ### 2.6 網路隔離(Network Isolation)
347
+
348
+ **核心原則**:服務間網路最小化,AI Agent 出站流量使用明確白名單。
349
+
350
+ #### 防火牆分層設計
351
+
352
+ ```
353
+ Internet
354
+
355
+ Load Balancer / API Gateway(唯一對外入口)
356
+
357
+ Internal VPC / Overlay Network
358
+
359
+ ┌──────────────────────────────────────┐
360
+ │ VibeOps Agent │ Database │ Monitoring │
361
+ │ (port: 3000) │ (port: 5432)│ (port: 9090) │
362
+ └──────────────────────────────────────┘
363
+ 所有節點均不直接對外
364
+ ```
365
+
366
+ #### AI Agent 出站白名單設定
367
+
368
+ `/etc/vibeops/outbound-allowlist.conf`(範例):
369
+ ```
370
+ # VibeOps Agent 出站流量白名單
371
+ ALLOW api.openai.com:443 # OpenAI API
372
+ ALLOW registry.npmjs.org:443 # npm registry
373
+ ALLOW api.github.com:443 # GitHub API
374
+ ALLOW telemetry.asiaostrich.com:443 # 遙測上傳
375
+ # 預設拒絕所有其他出站
376
+ DENY *:*
377
+ ```
378
+
379
+ 使用 iptables 實作出站白名單:
380
+ ```bash
381
+ # 允許 DNS
382
+ sudo iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
383
+ # 允許白名單 IP(事先解析域名)
384
+ sudo iptables -A OUTPUT -d <api.openai.com_IP> -p tcp --dport 443 -j ACCEPT
385
+ # 預設拒絕所有出站
386
+ sudo iptables -A OUTPUT -j DROP
387
+ ```
388
+
389
+ #### 資料庫與監控端口保護
390
+
391
+ ```bash
392
+ # 確認資料庫端口未對外
393
+ sudo iptables -A INPUT -p tcp --dport 5432 -s 10.0.0.0/8 -j ACCEPT
394
+ sudo iptables -A INPUT -p tcp --dport 5432 -j DROP
395
+
396
+ # Prometheus / Grafana 僅內網
397
+ sudo iptables -A INPUT -p tcp --dport 9090 -s 10.0.0.0/8 -j ACCEPT
398
+ sudo iptables -A INPUT -p tcp --dport 9090 -j DROP
399
+ sudo iptables -A INPUT -p tcp --dport 3000 -s 10.0.0.0/8 -j ACCEPT
400
+ sudo iptables -A INPUT -p tcp --dport 3000 -j DROP
401
+ ```
402
+
403
+ **常見陷阱**:
404
+ - Docker 網路模式 `--net=host` 繞過所有 iptables 規則
405
+ - Prometheus exporter 監聽 `0.0.0.0` 而非 `127.0.0.1`
406
+
407
+ **ISO 對映**:ISO/IEC 27001:2022 A.8.20(網路安全)、A.8.22(Web 過濾)
408
+
409
+ ---
410
+
411
+ ## 3. AI Agent 環境特殊考量
412
+
413
+ ### Guardian 整合
414
+
415
+ Guardian OPA Sidecar(XSPEC-146/147)作為 AI Agent 的決策閘道,其所在主機必須滿足本標準的全部要求:
416
+
417
+ | Guardian 元件 | 對應安全域 |
418
+ |--------------|----------|
419
+ | OPA Sidecar 容器 | 2.5 Patch Management(映像需定期更新) |
420
+ | Guardian 服務帳號 | 2.3 Privilege Management(non-root, no shell) |
421
+ | Guardian API 端口 | 2.6 Network Isolation(僅允許 Agent 存取) |
422
+ | Guardian 審計日誌 | 2.2 Host Hardening(auditd 監控寫入) |
423
+
424
+ ### 服務帳號矩陣
425
+
426
+ | 服務 | Unix 帳號 | Shell | Sudo | 說明 |
427
+ |------|----------|-------|------|------|
428
+ | VibeOps Agent | `vibeops` | /sbin/nologin | 限定指令 | 主要 AI 執行帳號 |
429
+ | Guardian OPA | `guardian` | /sbin/nologin | 無 | OPA 決策引擎 |
430
+ | Prometheus | `prometheus` | /sbin/nologin | 無 | 監控收集 |
431
+ | 部署腳本 | `deployer` | /bin/bash | 限定指令 | CI/CD 用途 |
432
+
433
+ ### 出站白名單文件模板
434
+
435
+ 每個 AI Agent 部署必須隨附出站白名單文件,記錄:
436
+
437
+ ```
438
+ 端點: api.openai.com:443
439
+ 用途: 大型語言模型 API 呼叫
440
+ 負責人: VibeOps 核心團隊
441
+ 最後審查: 2026-05-04
442
+ ```
443
+
444
+ ---
445
+
446
+ ## 4. 標準對映表
447
+
448
+ | 安全域 | ISO/IEC 27001:2022 | NIST | CIS |
449
+ |-------|-------------------|------|-----|
450
+ | SSH 強化 | A.8.5, A.8.20 | SP 800-52 | Benchmark 5.x |
451
+ | 主機強化 | A.8.9 | SP 800-123 | Benchmark Level 1 |
452
+ | 特權管理 | A.8.2, A.8.18 | SP 800-53 AC-6 | Benchmark 5.1-5.4 |
453
+ | 堡壘機模式 | A.8.3 | SP 800-207 (ZTA) | - |
454
+ | Patch 管理 | A.8.8 | SP 800-40 | - |
455
+ | 網路隔離 | A.8.20, A.8.22 | SP 800-41 | Benchmark 3.x |
456
+
457
+ ---
458
+
459
+ ## 5. 部署前快速 Checklist
460
+
461
+ ### 通用(所有環境)
462
+
463
+ - [ ] `PasswordAuthentication no` 已設定並生效
464
+ - [ ] `PermitRootLogin no` 已設定並生效
465
+ - [ ] SSH Port 已改為非 22
466
+ - [ ] fail2ban 已啟用,jailtime >= 1 小時
467
+ - [ ] UFW / iptables 防火牆已啟用,預設 deny inbound
468
+ - [ ] unattended-upgrades(security)已啟用
469
+ - [ ] auditd 已啟用並有基本規則
470
+ - [ ] AI Agent 服務帳號:non-root, /sbin/nologin
471
+ - [ ] 無 `NOPASSWD ALL` 的 sudo 設定
472
+
473
+ ### 生產環境額外項目
474
+
475
+ - [ ] Bastion Host 已部署
476
+ - [ ] Bastion 上 MFA 已強制(TOTP 或 YubiKey)
477
+ - [ ] Prod 節點防火牆只允許來自 Bastion 的 SSH
478
+ - [ ] Session 記錄已啟用
479
+ - [ ] 所有 Critical CVE 已修補
480
+ - [ ] AI Agent 出站白名單已設定並文件化
481
+ - [ ] DB/監控端口(5432, 3306, 6379, 9090, 3000)未對外暴露
482
+ - [ ] Guardian OPA Sidecar 映像在 90 天有效期內
483
+ - [ ] Lynis 評分 >= 75
484
+
485
+ ---
486
+
487
+ ## 相關標準
488
+
489
+ - `secure-op.ai.yaml` — AI Agent 決策層安全(Veto pipeline、SOBR 評分、HITL 機制)
490
+ - `security-standards.ai.yaml` — 應用層安全架構
491
+ - `security-testing.ai.yaml` — SAST、DAST、相依套件審計
492
+ - `secret-management-standards.ai.yaml` — 機密管理與憑證衛生
493
+ - `container-image-standards.ai.yaml` — 容器映像安全基準
@@ -0,0 +1,65 @@
1
+ # Smoke Test Standards
2
+
3
+ ## Overview
4
+
5
+ Smoke tests are the first line of defence after deployment. They answer one question: "Is the system basically working?" in under 30 seconds. If smoke tests pass, you have high confidence that the deployment succeeded. If they fail, roll back immediately — do not investigate in production.
6
+
7
+ ## What to Test
8
+
9
+ | ✅ Smoke Test | ❌ Not Smoke Test |
10
+ |--------------|-----------------|
11
+ | Server starts and binds to port | Business logic correctness |
12
+ | Health endpoint returns 200 | Edge case handling |
13
+ | Core API route returns a response | Performance benchmarks |
14
+ | Database connection is alive | Full integration scenarios |
15
+
16
+ ## Implementation
17
+
18
+ ### Shell Script (installer/smoke.sh)
19
+
20
+ ```bash
21
+ #!/usr/bin/env bash
22
+ # SPDX-License-Identifier: AGPL-3.0-only
23
+ set -euo pipefail
24
+
25
+ BASE_URL="${VIBEOPS_URL:-http://localhost:3000}"
26
+ TIMEOUT=5
27
+
28
+ check() {
29
+ local path="$1"
30
+ local expected="${2:-200}"
31
+ local status
32
+ status=$(curl -s -o /dev/null -w "%{http_code}" --max-time "$TIMEOUT" "${BASE_URL}${path}")
33
+ if [[ "$status" != "$expected" ]]; then
34
+ echo "FAIL: ${path} → HTTP ${status} (expected ${expected})"
35
+ exit 1
36
+ fi
37
+ echo "OK: ${path} → HTTP ${status}"
38
+ }
39
+
40
+ echo "=== VibeOps Smoke Test ==="
41
+ check "/health"
42
+ check "/api/status"
43
+ echo "=== PASS ==="
44
+ ```
45
+
46
+ ### npm Script
47
+
48
+ ```json
49
+ { "smoke": "bash installer/smoke.sh" }
50
+ ```
51
+
52
+ ### CI Integration (post-deploy step)
53
+
54
+ ```yaml
55
+ - name: Smoke test
56
+ run: npm run smoke
57
+ env:
58
+ VIBEOPS_URL: http://localhost:3000
59
+ ```
60
+
61
+ ## Related Standards
62
+
63
+ - [Testing Standards](testing.md) — overall test pyramid
64
+ - [Deployment Standards](deployment-standards.md) — deployment pipeline
65
+ - [Performance Standards](performance-standards.md) — latency SLOs
@@ -0,0 +1,117 @@
1
+ # Supply Chain Attestation Standards
2
+
3
+ ## Overview
4
+
5
+ Software supply chain attacks (e.g. SolarWinds, Log4Shell propagation) exploit the gap between what was intended to be shipped and what was actually shipped. SBOM + SLSA provenance closes this gap by creating a verifiable chain from source commit to deployed artefact.
6
+
7
+ ## SBOM (Software Bill of Materials)
8
+
9
+ CycloneDX JSON format is the recommended SBOM standard (also supported by SPDX).
10
+
11
+ ### Generation
12
+
13
+ ```bash
14
+ # Install CycloneDX npm plugin
15
+ npm install -g @cyclonedx/cyclonedx-npm
16
+
17
+ # Generate from package-lock.json (NOT package.json)
18
+ cyclonedx-npm --output-format JSON \
19
+ --output-file sbom.cdx.json \
20
+ --package-lock-only
21
+ ```
22
+
23
+ ### Verification
24
+
25
+ ```bash
26
+ # Count components
27
+ jq '.components | length' sbom.cdx.json
28
+
29
+ # Check for GPL licences
30
+ jq '.components[] | select(.licenses[].license.id | test("GPL"))' sbom.cdx.json
31
+ ```
32
+
33
+ ## SLSA Provenance
34
+
35
+ [SLSA (Supply chain Levels for Software Artefacts)](https://slsa.dev) defines four levels:
36
+
37
+ | Level | Requirements |
38
+ |-------|-------------|
39
+ | L1 | Provenance exists, self-signed |
40
+ | L2 | Provenance hosted, signed by hosted build service (GitHub Actions OIDC) |
41
+ | L3 | Provenance from hardened, fully isolated build platform |
42
+ | L4 | Two-party review + hermetic builds |
43
+
44
+ **Recommended minimum: SLSA L1** for internal releases, **L2** for public releases.
45
+
46
+ ### SLSA L1 Provenance (GitHub Actions)
47
+
48
+ ```yaml
49
+ - name: Generate SLSA L1 provenance
50
+ run: |
51
+ IMAGE_DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' "vibeops:commercial-${VERSION}" 2>/dev/null || echo "N/A")
52
+ cat > provenance.json << PROVEOF
53
+ {
54
+ "_type": "https://in-toto.io/Statement/v0.1",
55
+ "predicateType": "https://slsa.dev/provenance/v0.2",
56
+ "subject": [{"name": "vibeops-commercial-${VERSION}", "digest": {"sha256": "$(sha256sum vibeops-commercial-${VERSION}.tar.gz | cut -d' ' -f1)"}}],
57
+ "predicate": {
58
+ "buildType": "https://github.com/Attestations/GitHubActionsWorkflow@v1",
59
+ "builder": {"id": "https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"},
60
+ "invocation": {
61
+ "configSource": {
62
+ "uri": "git+https://github.com/${GITHUB_REPOSITORY}",
63
+ "digest": {"sha1": "${GITHUB_SHA}"},
64
+ "entryPoint": ".github/workflows/release-commercial.yml"
65
+ }
66
+ },
67
+ "metadata": {
68
+ "buildInvocationId": "${GITHUB_RUN_ID}/${GITHUB_RUN_ATTEMPT}",
69
+ "buildStartedOn": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
70
+ "completeness": {"environment": false, "materials": true, "parameters": false}
71
+ }
72
+ }
73
+ }
74
+ PROVEOF
75
+ ```
76
+
77
+ ### Cosign Signing
78
+
79
+ ```yaml
80
+ - name: Sign SBOM and provenance
81
+ run: |
82
+ cosign sign-blob --key env://COSIGN_PRIVATE_KEY --yes sbom.cdx.json > sbom.cdx.json.sig
83
+ cosign sign-blob --key env://COSIGN_PRIVATE_KEY --yes provenance.json > provenance.json.sig
84
+ env:
85
+ COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
86
+ COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
87
+ ```
88
+
89
+ ### Verification (by end-user)
90
+
91
+ ```bash
92
+ # Verify SBOM signature
93
+ cosign verify-blob --key cosign.pub --signature sbom.cdx.json.sig sbom.cdx.json
94
+
95
+ # Verify provenance signature
96
+ cosign verify-blob --key cosign.pub --signature provenance.json.sig provenance.json
97
+ ```
98
+
99
+ ## Release Bundle Structure
100
+
101
+ ```
102
+ vibeops-commercial-v1.3.0/
103
+ ├── vibeops-commercial-v1.3.0.docker.tar.gz # Primary artefact
104
+ ├── sbom.cdx.json # CycloneDX SBOM
105
+ ├── sbom.cdx.json.sig # cosign signature
106
+ ├── provenance.json # SLSA L1 provenance
107
+ ├── provenance.json.sig # cosign signature
108
+ ├── checksums.txt # SHA-256 of all artefacts
109
+ ├── checksums.txt.sig # cosign signature
110
+ └── install.sh / docker-compose.yml / ...
111
+ ```
112
+
113
+ ## Related Standards
114
+
115
+ - [Supply Chain Security Standards](supply-chain-security-standards.md) — dependency audit policies
116
+ - [Container Security Standards](container-security.md) — image hardening
117
+ - [Advanced SAST Standards](sast-advanced.md) — static analysis
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  source: ../../CHANGELOG.md
3
- source_version: 5.4.0
4
- translation_version: 5.4.0
5
- last_synced: 2026-04-27
3
+ source_version: 5.6.0
4
+ translation_version: 5.6.0
5
+ last_synced: 2026-05-06
6
6
  status: current
7
7
  ---
8
8
 
@@ -14,7 +14,7 @@ status: current
14
14
 
15
15
  > **语言**: [English](../../README.md) | [繁體中文](../zh-TW/README.md) | 简体中文
16
16
 
17
- **版本**: 5.4.0 | **发布日期**: 2026-04-13 | **授权**: [双重授权](../../LICENSE) (CC BY 4.0 + MIT)
17
+ **版本**: 5.6.0 | **发布日期**: 2026-04-13 | **授权**: [双重授权](../../LICENSE) (CC BY 4.0 + MIT)
18
18
 
19
19
  语言无关、框架无关的软件项目文档标准。通过 AI 原生工作流,确保不同技术栈之间的一致性、质量和可维护性。
20
20