@@ -6,14 +6,20 @@ This directory contains security hardening scripts for the cagent-action GitHub
66
77This action includes ** built-in security features for all agent executions** :
88
9- 1 . ** Output Scanning** - All agent responses are scanned for leaked secrets:
9+ 1 . ** Authorization Check** - Users are verified for comment-triggered events:
10+ - Only ` OWNER ` , ` MEMBER ` , and ` COLLABORATOR ` roles can trigger via comments (e.g., ` /review ` )
11+ - External contributors (` CONTRIBUTOR ` , ` FIRST_TIME_CONTRIBUTOR ` , ` NONE ` ) are blocked
12+ - Skips for non-comment events (PR triggers, scheduled jobs, workflow_dispatch)
13+ - Comment-triggered actions are the main abuse vector - this protects against cost/spam attacks
14+
15+ 2 . ** Output Scanning** - All agent responses are scanned for leaked secrets:
1016
1117 - API key patterns: ` sk-ant-* ` , ` sk-* ` , ` sk-proj-* `
1218 - GitHub tokens: ` ghp_* ` , ` gho_* ` , ` ghu_* ` , ` ghs_* ` , ` github_pat_* `
1319 - Environment variable names in output
1420 - If secrets detected: workflow fails, security issue created
1521
16- 2 . ** Prompt Sanitization** - User prompts are checked for:
22+ 3 . ** Prompt Sanitization** - User prompts are checked for:
1723 - Prompt injection patterns ("ignore previous instructions", etc.)
1824 - Requests for API keys or environment variables
1925 - Encoded content (base64, hex) that could hide malicious requests
@@ -25,28 +31,35 @@ The action implements a defense-in-depth approach:
2531
2632```
2733┌─────────────────────────────────────────────────────────────┐
28- │ 1. Prompt Sanitization │
34+ │ 1. Authorization Check (check-auth.sh) │
35+ │ ✓ Verify user's author_association role │
36+ │ ✓ Block external contributors by default │
37+ │ ✓ Only OWNER, MEMBER, COLLABORATOR allowed │
38+ └─────────────────────────────────────────────────────────────┘
39+ ↓
40+ ┌─────────────────────────────────────────────────────────────┐
41+ │ 2. Prompt Sanitization │
2942│ ✓ Detect prompt injection attempts │
3043│ ✓ Warn about suspicious patterns │
3144│ ✓ Check for encoded malicious content │
3245└─────────────────────────────────────────────────────────────┘
3346 ↓
3447┌─────────────────────────────────────────────────────────────┐
35- │ 2 . Agent Execution │
48+ │ 3 . Agent Execution │
3649│ ✓ User-provided agent runs in isolated cagent runtime │
3750│ ✓ No direct access to secrets or environment vars │
3851│ ✓ Controlled execution environment │
3952└─────────────────────────────────────────────────────────────┘
4053 ↓
4154┌─────────────────────────────────────────────────────────────┐
42- │ 3 . Output Scanning │
55+ │ 4 . Output Scanning │
4356│ ✓ Scan for leaked API keys (Anthropic, OpenAI, etc.) │
4457│ ✓ Scan for leaked tokens (GitHub PAT, OAuth, etc.) │
4558│ ✓ Block execution if secrets found │
4659└─────────────────────────────────────────────────────────────┘
4760 ↓
4861┌─────────────────────────────────────────────────────────────┐
49- │ 4 . Incident Response │
62+ │ 5 . Incident Response │
5063│ ✓ Create security issue with details │
5164│ ✓ Fail workflow with clear error │
5265│ ✓ Prevent secret exposure in logs │
0 commit comments