Architecture: Security model for Agents, Skills, and Tasks
Status: Draft
Last updated: 2026-05-25
Audience: Engineers + security reviewers. Threat model + mitigations for the new Agent/Skill/Task surface. Pre-empts the bot review loop (Sonar, Snyk, CodeRabbit) finding what's already considered.
This doc complements
agents-skills-tasks.md,agent-prompt-assembly.md, andagent-tools-catalog.md. When the implementation lands, reference the relevant section here in PR descriptions so reviewers can check coverage.
1. Threats covered
| Threat | Impact | Where the surface is | Mitigation section |
|---|---|---|---|
| T1: Prompt injection from KB | Agent obeys malicious instructions from KB document | getKbDocument tool; system-message injection of KB content | §3 |
| T2: Prompt injection from Task body | Agent obeys task description with hidden instructions | Task body / chat input → prompt assembly | §4 |
T3: Path traversal in editAgentFile/commitToRepo | Agent writes outside its scope subtree | Tool args: name, path | §5 |
| T4: Secret leakage in chat/description | API keys end up in task_chat_messages body | POST /tasks/:id/chat, POST /tasks | §6 |
| T5: Tool ACL bypass | Agent invokes tool not gated by its permissions | AgentToolService.resolveAllowedTools + per-tool gates | §7 |
| T6: DDoS via chat-triggered runs | Spam mentions trigger 100s of Trigger.dev runs | task_chat_messages insert → mention parser → run dispatch | §8 |
| T7: Cross-tenant data leak via Agent context | Tenant A's Agent reads Tenant B's data | getActivity, getMissionState, getKbDocument | §9 |
| T8: Privilege escalation via sub-agent creation | Child Agent gets perms parent doesn't have | createSubAgent tool | §10 |
| T9: Cost-abuse from runaway tool loop | Agent calls searchWeb 1000× in one run | Tool loop, AI provider, budget | §11 |
| T10: Stale-state from concurrent file edits | UI save races with Agent's editAgentFile | Both go through AgentFileService | §12 |
| T11: Audit-log tampering | Agent edits its own activity rows | Tool surface — none allowed today | §13 |
| T12: Replay of internal RPC | Worker → API /internal/trigger/remote/call replayed | Existing x-trigger-secret channel | §14 |