Skip to content

Commit 51cf00b

Browse files
feat: add AGT governance artifacts (policy, allowlist, CI workflow)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 63d08d5 commit 51cf00b

3 files changed

Lines changed: 179 additions & 0 deletions

File tree

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Governance Check
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
governance:
12+
name: Governance validation
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Check required governance files
18+
run: |
19+
STATUS="pass"
20+
for file in AGENTS.md SECURITY.md mcp-allowlist.yaml governance/policy.yaml; do
21+
if [ -f "$file" ]; then
22+
echo "✅ $file"
23+
else
24+
echo "❌ $file missing"
25+
STATUS="fail"
26+
fi
27+
done
28+
for file in .github/copilot-instructions.md; do
29+
if [ -f "$file" ]; then
30+
echo "✅ $file"
31+
else
32+
echo "⚠️ $file missing (recommended)"
33+
fi
34+
done
35+
if [ "$STATUS" = "fail" ]; then
36+
echo "::warning::Required governance files are missing"
37+
fi
38+
39+
- name: Validate MCP allowlist
40+
run: |
41+
python3 -c "
42+
import yaml, sys
43+
with open('mcp-allowlist.yaml') as f:
44+
data = yaml.safe_load(f)
45+
known = data.get('known', [])
46+
blocked = data.get('blocked', [])
47+
mode = data.get('enforcement', 'warn')
48+
print(f'Enforcement: {mode}')
49+
print(f'Known servers: {len(known)}')
50+
print(f'Blocked servers: {len(blocked)}')
51+
overlap = set(known) & set(blocked)
52+
if overlap:
53+
print(f'::error::Servers in both known and blocked: {overlap}')
54+
sys.exit(1)
55+
print('✅ MCP allowlist is valid')
56+
"
57+
58+
- name: Validate governance policy
59+
run: |
60+
python3 -c "
61+
import yaml
62+
with open('governance/policy.yaml') as f:
63+
data = yaml.safe_load(f)
64+
mode = data.get('kernel', {}).get('mode', 'unset')
65+
rings = data.get('rings', {})
66+
blocked = data.get('blocked_patterns', [])
67+
print(f'Policy mode: {mode}')
68+
print(f'Rings defined: {len(rings)}')
69+
print(f'Blocked patterns: {len(blocked)}')
70+
print('✅ Governance policy is valid')
71+
"
72+
73+
- name: Check for hardcoded secrets
74+
run: |
75+
PATTERNS='(AKIA[0-9A-Z]{16}|sk-[a-zA-Z0-9]{48}|ghp_[a-zA-Z0-9]{36}|-----BEGIN (RSA |EC )?PRIVATE KEY-----)'
76+
if grep -rPn "$PATTERNS" --include="*.py" --include="*.yaml" --include="*.yml" --include="*.json" --exclude-dir=.git --exclude-dir=__pycache__ --exclude-dir=.pytest_cache . 2>/dev/null; then
77+
echo "::error::Potential hardcoded secrets detected"
78+
exit 1
79+
else
80+
echo "✅ No hardcoded secrets detected"
81+
fi
82+
83+
- name: AGT toolkit verify (optional)
84+
continue-on-error: true
85+
run: |
86+
pip install "agent-governance-toolkit[full]>=3.0.0" --quiet 2>/dev/null || { echo "AGT not installable — skipping"; exit 0; }
87+
agent-governance verify --json || echo "::warning::AGT governance verify reported issues"
88+
89+
- name: AGT integrity check (optional)
90+
continue-on-error: true
91+
run: |
92+
which agent-governance >/dev/null 2>&1 || exit 0
93+
agent-governance integrity --verify . || echo "::warning::Integrity check reported changes"

governance/policy.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Awesome Copilot Governance Policy (YAML)
2+
# =========================================
3+
# Loaded by the PolicyEngine at startup. Defines rules that apply
4+
# to all agents operating in the awesome-copilot context.
5+
#
6+
# This file is enforceable via AGT's PolicyEvaluator when
7+
# agent-governance-toolkit is installed.
8+
9+
kernel:
10+
mode: strict # strict | permissive | audit
11+
12+
# Default limits for any agent session
13+
limits:
14+
max_tokens_per_task: 8000
15+
max_tool_calls_per_task: 25
16+
max_session_duration_minutes: 60
17+
18+
# Blocked patterns — actions matching these are denied
19+
blocked_patterns:
20+
- "rm -rf /"
21+
- "DROP TABLE"
22+
- "DELETE FROM"
23+
- "os.system("
24+
- "eval("
25+
- "exec("
26+
- "pickle.load"
27+
- "subprocess.run.*shell=True"
28+
29+
# Ring-based permissions
30+
rings:
31+
0: # Kernel — requires attestation
32+
requires_attestation: true
33+
capabilities:
34+
- infra_create
35+
- infra_delete
36+
- iam_modify
37+
- secret_read
38+
1: # Trusted
39+
capabilities:
40+
- file_write_user
41+
- tool_call
42+
- code_execute
43+
- network_egress_restricted
44+
2: # Standard
45+
capabilities:
46+
- file_read
47+
- tool_call
48+
- code_execute
49+
- repo_read
50+
3: # Sandbox — read only
51+
capabilities:
52+
- file_read
53+
- repo_read
54+
rate_limit: 10/min
55+
timeout_seconds: 5
56+
57+
# Approval workflows
58+
approval:
59+
destructive_actions:
60+
- "delete_*"
61+
- "write_production_*"
62+
- "infra_*"
63+
min_approvals: 1
64+
timeout_minutes: 30
65+
66+
# Observability requirements
67+
audit:
68+
log_all_decisions: true
69+
log_format: jsonl
70+
retention_days: 90

mcp-allowlist.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# MCP Server Allowlist for Awesome Copilot
2+
# ========================================
3+
#
4+
# Enforcement mode:
5+
# warn — unknown servers produce a warning (non-blocking)
6+
# block — unknown servers produce a violation (blocks execution)
7+
enforcement: warn
8+
9+
# Known MCP servers used by awesome-copilot agents and skills.
10+
known:
11+
- github # GitHub API access for PR/commit/issue data
12+
- fetch # Web fetch for documentation references
13+
14+
# Servers that are explicitly blocked.
15+
blocked:
16+
- evil-server

0 commit comments

Comments
 (0)