Files
Agentswarm/.github/workflows/ci.yml
T
Songhaoz666andClaude Opus 4.8 727737dd9b 安全边界强制点:可验证边界 FROZEN v1 + 契约测试(Refs #19)
issue #19 要求「secret 仅 ref/不落明文;workspace/tool/MCP/tenant 沙箱强制;边界可验证 + 测试」。
本仓**已强制**的三类边界此前散落、缺统一验证;本 PR 把它们合为一套可验证测试并冻结文档。

测试:scripts/test-security-boundary.py(hermetic,19 断言)覆盖本仓强制边界:
- secret:billing_context.secret_ref 非 azkv:// 入口拒绝;明文 password/access_token 等字段
  在任意层级拒绝;非 azkv 的 *_ref 拒绝(validate_create_request / _reject_plaintext_secrets)。
- 脱敏:明文凭据 → [redacted];azkv secret_ref 透传(HM 对客户端再脱敏)(_redact_sensitive)。
- workspace:绝对路径 / `..` 逃逸 / 空路径拒绝,合法相对路径落在 workspace 根内
  (task_executor._resolve_workspace_path)。
- 沙箱 fail-closed:未确认隔离时 assert_isolated 抛 SandboxIsolationError,确认后放行。

文档:docs/integration/security-boundary.md → FROZEN v1:§9 覆盖表标注「✅✔ 已实现+测试」
三类强制边界;其余按规则 #9 据实标 ⏸「本次不做」并给理由——tool/MCP 权限引擎(无工具层可治理)、
allowed_paths 按 grant 强制(待资源授权链)、Pod 强化沙箱(Infra)、租户隔离(有意不引入,
按 user/channelId 归因)。CI 新增该测试步。

影响范围:仅 agent_swarm(新增测试 + 文档冻结 + CI)。无运行时逻辑改动;不改 Manager↔Swarm
契约、计费、审批链、密钥处理(仅为既有强制点补可验证测试)。

Refs #19

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 18:11:25 +08:00

129 lines
4.2 KiB
YAML

name: CI
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
jobs:
guardrails:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Defense in depth: fail if secrets or heavy/generated dirs were ever committed.
- name: Block secrets & node_modules
run: |
if git ls-files | grep -E '(^|/)\.env($|\.)|(^|/)secrets/|\.pem$|\.key$|\.p12$|\.pfx$|(^|/)id_rsa$|(^|/)id_ed25519$'; then
echo "::error::Secret-like files are tracked — remove them and rotate any exposed credential."; exit 1
fi
if git ls-files | grep -E '(^|/)node_modules/'; then
echo "::error::node_modules is tracked — it must be gitignored."; exit 1
fi
- name: Required standards files present
run: |
for f in CLAUDE.md PROJECT_STANDARD.md README.md; do
test -f "$f" || { echo "::error::Missing required file: $f"; exit 1; }
done
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r orchestrator/requirements.txt -r agent/requirements.txt
# Hermetic: in-memory store, planner forced offline by the tests — no model key needed.
- name: Manager contract test
env: { REDIS_FAKE: "1" }
run: python scripts/test-runtime-contract.py
- name: Workflow mechanism smoke test
env: { REDIS_FAKE: "1" }
run: python scripts/test-merge-smoke.py
- name: End-to-end workflow test
env: { REDIS_FAKE: "1" }
run: python scripts/test-workflow-e2e.py
- name: Manager event-contract test
env: { REDIS_FAKE: "1" }
run: python scripts/test-contract-events.py
- name: Benchmark metric formulas (v2.1)
env: { REDIS_FAKE: "1" }
run: python scripts/test-benchmark-metrics.py
- name: Benchmark collector
env: { REDIS_FAKE: "1" }
run: python scripts/test-benchmark-collector.py
- name: Baseline comparison
env: { REDIS_FAKE: "1" }
run: python scripts/test-baseline-comparison.py
- name: Code sandbox (in-pod test runner)
run: python scripts/test-sandbox.py
- name: Security boundary enforcement (secret/workspace/sandbox) (#19)
env: { REDIS_FAKE: "1" }
run: python scripts/test-security-boundary.py
- name: Quality instrumentation (Group B)
env: { REDIS_FAKE: "1" }
run: python scripts/test-quality.py
- name: Decision-engine pheromone library (τ)
env: { REDIS_FAKE: "1" }
run: python scripts/test-decision-engine.py
- name: Dispatch scoring formulas
env: { REDIS_FAKE: "1" }
run: python scripts/test-dispatch-score.py
# --- decentralized swarm flow (the only flow; primitives are unconditional) ---
- name: Swarm seeder (#6)
run: python scripts/test-swarm-seed.py
- name: Swarm self-selection dispatch
env: { REDIS_FAKE: "1" }
run: python scripts/test-swarm-dispatch.py
- name: Swarm autonomous task generation (#7)
env: { REDIS_FAKE: "1", AGENT_PROPOSAL_BUDGET: "3" }
run: python scripts/test-swarm-autonomous.py
- name: Swarm task competition (#8)
env: { REDIS_FAKE: "1" }
run: python scripts/test-swarm-competition.py
- name: Swarm cross-review (#11)
env: { REDIS_FAKE: "1" }
run: python scripts/test-swarm-cross-review.py
- name: Swarm convergence (#12)
env: { REDIS_FAKE: "1" }
run: python scripts/test-swarm-convergence.py
- name: Swarm health guard
env: { REDIS_FAKE: "1" }
run: python scripts/test-swarm-guard.py
# Pure-module unit tests for the swarm primitives (formulas/policies, infra-free).
- name: Swarm primitive modules (unit)
env: { REDIS_FAKE: "1" }
run: |
python scripts/test-autonomous-tasks.py
python scripts/test-task-competition.py
python scripts/test-cross-review.py
python scripts/test-convergence.py