Skip to content

Commit 252993d

Browse files
authored
Merge pull request #53 from Blazity/docs/security-observability-revisions
docs: revise security observability design
2 parents 2269263 + c380cf3 commit 252993d

1 file changed

Lines changed: 26 additions & 41 deletions

File tree

docs/superpowers/specs/2026-04-09-security-observability-design.md

Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
Security observability for the AI workflow system (AWS on-prem).
44

5-
Target deployment: AWS on-prem architecture (Fargate agents, EC2 Nitro server).
5+
Target deployment: AWS on-prem architecture (Fargate agents, EC2 Nitro server). Architecture should be cloud-agnostic via adapters — AWS is first implementation.
6+
7+
All explicit threshold values, file paths, and integration details are preliminary and need to be validated against production data. Review after first month of real usage.
68

79
## Threat Categories
810

@@ -18,7 +20,7 @@ Detect adversarial instructions injected into the LLM context from untrusted sou
1820

1921
**Detection:** Arthur Engine Prompt Injection evaluation (DeBERTa v3 classifier).
2022

21-
**Response:** Critical — kill sandbox, cancel workflow, move ticket to "Security Review" Jira column, Slack alert.
23+
**Response:** Critical — kill sandbox, cancel workflow, Slack alert with details.
2224

2325
### 2. Data Exfiltration & Network Monitoring
2426

@@ -28,14 +30,16 @@ Detect unauthorized outbound communication from agent sandboxes. The primary fea
2830

2931
- Outbound connections — every TCP connection from Fargate agents via VPC Flow Logs on `sg-fargate`
3032
- DNS queries — domain names the agent resolves via VPC DNS query logging
31-
- DNS tunneling — detect data exfiltration via DNS by monitoring for unusually long subdomain labels (>50 chars), high query volume to a single domain (>100 queries/min), and TXT record queries to non-standard domains
3233
- Traffic volume — bytes uploaded per connection via VPC Flow Logs aggregation
33-
- Unauthorized endpoints — connections to IPs/domains outside GitHub + Anthropic API
3434
- Large uploads — unusual outbound data volume (e.g., >10MB to a single IP)
3535

36-
**Detection:** AWS-native — VPC Flow Logs, DNS query logging, CloudWatch metric filters.
36+
No endpoint allowlist — the agent needs unrestricted research access (docs, Stack Overflow, npm registries, etc.). Restricting outbound destinations would degrade research quality. Instead, rely on traffic volume anomaly detection and egress proxy logging to catch exfiltration after the fact.
37+
38+
DNS tunneling detection (subdomain length / query volume heuristics) was evaluated and removed — too spotty to be reliable, a determined attacker would trivially bypass the thresholds. Better to invest in egress proxy with TLS inspection (future).
39+
40+
**Detection:** AWS-native — VPC Flow Logs, DNS query logging, CloudWatch metric filters. Architecture should be cloud-agnostic via an adapter — AWS is first implementation, but GCP (VPC Flow Logs equivalent) and Azure (NSG Flow Logs) will need their own adapters.
3741

38-
**Response:** Unauthorized endpointcritical (kill sandbox). Volume anomaly → medium (flag + alert).
42+
**Response:** Volume anomalymedium (flag + Slack alert). For true prevention (not just detection), the long-term approach is an egress proxy that blocks uploads above a size threshold before the connection completes — killing a sandbox after exfiltration already happened is pointless.
3943

4044
### 3. Secrets & Credential Leakage
4145

@@ -50,7 +54,7 @@ Prevent API keys, tokens, passwords, and connection strings from appearing in ge
5054

5155
**Detection:** Arthur Engine PII Detection (Presidio) + custom regex rules for secret patterns (AWS access keys, GitHub tokens, JWTs, database connection strings, private keys).
5256

53-
**Response:** Critical — no PR created, sandbox killed, ticket to "Security Review", Slack alert with redacted details.
57+
**Response:** Critical — no PR created, sandbox killed, Slack alert with redacted details.
5458

5559
### 4. PII & Sensitive Business Data
5660

@@ -64,25 +68,9 @@ Detect personally identifiable information and confidential business data in inp
6468

6569
**Detection:** Arthur Engine PII Detection (Presidio) for standard PII (names, emails, SSNs, credit cards). Arthur Engine Sensitive Data evaluation (few-shot LLM Judge) for business-specific confidential data — requires custom examples defining what "sensitive" means for the organization.
6670

67-
**Response:** Critical PII (SSN, credit card) → high (block PR). Other PII/sensitive data → medium (PR with `security-review` label + comment).
68-
69-
### 5. Code Safety & Vulnerability Detection
70-
71-
Detect common security vulnerabilities in LLM-generated code.
72-
73-
**Checks:**
74-
75-
- SQL injection patterns in generated database queries
76-
- Command injection via shell commands, exec calls
77-
- XSS vulnerabilities from unsanitized user input rendering
78-
- Insecure dependencies — newly added packages with known CVEs
79-
- Hardcoded secrets (overlaps with threat 3)
80-
81-
**Detection:** Arthur Engine custom rules (keyword + regex) for OWASP Top 10 patterns. Potential future integration with a dedicated SAST tool for deeper analysis.
82-
83-
**Response:** High — block PR creation, move ticket to "Security Review", Slack alert.
71+
**Response:** Critical PII (SSN, credit card) → high (block PR, Slack alert). Other PII/sensitive data → medium (PR with `security-review` label + comment, Slack notification).
8472

85-
### 6. Behavioral Anomalies
73+
### 5. Behavioral Anomalies
8674

8775
Detect unusual agent behavior that may indicate compromise or malfunction.
8876

@@ -108,7 +96,7 @@ Detect unusual agent behavior that may indicate compromise or malfunction.
10896

10997
Thresholds are static at launch. After 30 days of production data, revisit and consider adaptive baselines derived from rolling 7-day percentiles (p95).
11098

111-
**Response:** Low — log only, included in Slack usage report.
99+
**Response:** Token budget exceeded → critical (kill sandbox — circuit breaker for the infinite loop P0 bug that burned 100M+ tokens). Token usage must have a hard ceiling per phase, not a soft alert. All other anomalies → low (log only, included in Slack usage report).
112100

113101
## Pipeline Integration
114102

@@ -131,7 +119,6 @@ Jira Ticket Discovered
131119
| |
132120
| Runtime monitoring: |
133121
| - VPC Flow Logs (network) |
134-
| - DNS query logging |
135122
| - CloudWatch (tool usage) |
136123
| |
137124
| WebFetch interception: |
@@ -158,7 +145,6 @@ Jira Ticket Discovered
158145
+-----------------------------+
159146
| OUTPUT GATE (post-impl) |
160147
| - All output checks |
161-
| - Code safety (OWASP) |
162148
| - Secrets in generated code |
163149
+-------------+---------------+
164150
| pass
@@ -185,7 +171,6 @@ Jira Ticket Discovered
185171
| - Final secrets scan on |
186172
| full PR diff |
187173
| - Final PII check |
188-
| - Code safety (OWASP) |
189174
+-------------+---------------+
190175
| pass
191176
v
@@ -197,7 +182,7 @@ Jira Ticket Discovered
197182

198183
- Input gate — in `agentWorkflow` before `writeAndStartPhase`
199184
- WebFetch interception — hook/proxy inside the agent container
200-
- Runtime monitoring — AWS-native (VPC Flow Logs, DNS logs, CloudWatch)
185+
- Runtime monitoring — cloud-native (VPC Flow Logs, CloudWatch or equivalent)
201186
- Output gate — in `collectPhaseOutput` before returning results
202187
- Pre-push gate — in `pushFromSandbox` before the git push
203188
- Fix-and-retry path — `fixAndRetryPush` in `poll-agent.ts` spawns a lightweight Claude agent to fix push failures. This agent receives untrusted input (the push error) and runs with `--dangerously-skip-permissions`. Its output must pass through the output gate and pre-push gate before the retry push proceeds.
@@ -206,24 +191,24 @@ Jira Ticket Discovered
206191

207192
Four severity tiers with escalation:
208193

209-
| Severity | Triggers | Action |
210-
| -------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
211-
| Critical | Prompt injection detected, secrets in output, unauthorized network connection, data exfiltration | Kill sandbox, cancel workflow, move ticket to "Security Review" column, Slack alert |
212-
| High | PII in generated code (SSN, credit card), OWASP vulnerability patterns, sensitive business data leak | Block PR creation, move ticket to "Security Review", Slack alert |
213-
| Medium | PII in inputs (Jira ticket), mild anomalies in tool usage, elevated token spend | Create PR with `security-review` label + comment describing the finding, Slack notification |
214-
| Low | Minor behavioral anomalies (long duration, unusual output size) | Log only, included in Slack usage report |
194+
| Severity | Triggers | Action |
195+
| -------- | -------- | ------ |
196+
| Critical | Prompt injection detected, secrets in output, data exfiltration (volume anomaly), token budget exceeded | Kill sandbox, cancel workflow, Slack alert |
197+
| High | PII in generated code (SSN, credit card), sensitive business data leak | Block PR creation, Slack alert |
198+
| Medium | PII in inputs (Jira ticket), elevated token spend, unusual tool usage patterns | Create PR with `security-review` label + comment, Slack notification |
199+
| Low | Minor behavioral anomalies (long duration, unusual output size) | Log only, included in Slack usage report |
215200

216201
**Escalation rule:** If the same ticket triggers 2+ medium findings across phases, auto-escalate to high (block PR).
217202

218203
## Observability Streams
219204

220205
Three independent streams unified by Slack alerting:
221206

222-
| Stream | Tool | Scope |
223-
| ------------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------ |
224-
| Content analysis | Arthur Engine | Prompts, responses, generated code — prompt injection, PII, secrets, toxicity, code safety |
225-
| Network monitoring | AWS (VPC Flow Logs, DNS query logging, CloudWatch) | Outbound connections, DNS resolution, traffic volume, unauthorized endpoints |
226-
| Behavioral analysis | Custom Nitro logic | Tool usage patterns, execution duration, output size, retry storms, token usage |
207+
| Stream | Tool | Scope |
208+
| ------ | ---- | ----- |
209+
| Content analysis | Arthur Engine (adapter-based — Arthur is first impl, others possible) | Prompts, responses, generated code — prompt injection, PII, secrets |
210+
| Network monitoring | Cloud-native (AWS: VPC Flow Logs + CloudWatch; GCP/Azure: equivalent) | Outbound connections, traffic volume, egress anomalies |
211+
| Behavioral analysis | Custom Nitro logic | Tool usage patterns, execution duration, output size, retry storms, token budget enforcement |
227212

228213
## WebFetch Strategy
229214

0 commit comments

Comments
 (0)