aws-samples / aws-samples/sample-autonomous-cloud-coding-agents
feat(security): emergency session containment runbook and APIs
- Dominant language
- TypeScript
- Stars
- 143
- Forks
- 46
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 20
Description
**Context:** ROADMAP.md → Credentials and authorization → Emergency session containment
**Related:** #209 (per-session IAM), #249 (credentials), behavioral circuit breaker draft
---
## Component
API or orchestration
## Describe the feature
Documented operator runbook and platform APIs to contain an active or compromised agent session: cancel the task, terminate the compute session, and revoke short-lived credentials (assumed SessionRole, GitHub App token, Token Vault grants where applicable). Emit a `containment` audit event for incident response.
## Use case
When an operator detects exfiltration, policy bypass attempts, or a tripped circuit breaker, they need a single coordinated containment action—not separate manual steps across Lambda, AgentCore, IAM, and GitHub. Incident response requires predictable, auditable kill switches.
## Proposed solution
1. `POST /tasks/{id}/contain` (operator-only) orchestrating: task cancel → compute termination → credential revocation best-effort.
2. Pair with runbook in `docs/guides/` covering AWS console fallbacks.
3. Wire `containment` event to `TaskEventsTable` and optional SNS/EventBridge (see lifecycle events draft).
4. Integration tests for happy path and partial-failure (e.g. compute already terminal).
5. CLI: `bgagent contain [--reason "..."]`.
## Other information
- Pairs with **Behavioral circuit breaker** (automated containment) and **Per-repo GitHub credentials** (#50, #249).
- Distinct from stranded-task reconciler (scheduled cleanup vs operator-initiated emergency).
- Design context: `docs/design/SECURITY.md`, `docs/design/ORCHESTRATOR.md`.
- [ ] This might be a breaking change
Contributor guide
Research direction
Start with the Credentials and authorization section of ROADMAP.md, then read docs/design/SECURITY.md and docs/design/ORCHESTRATOR.md; the issue does not identify implementation files or existing tests. Done means the containment API and CLI coordinate cancellation, compute termination, best-effort credential revocation, and audit events, with the docs/guides runbook and happy-path and partial-failure integration tests covering the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, github, typescript
- Domain
- api, backend, cli, cloud, documentation, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100