We are entering the era of Autonomous AI Agents. These agents are given access to production databases, cloud infrastructure, and GitHub repositories to "do work" for us.
However, the current security paradigm is broken: Agents are given permanent, over-privileged API keys. If an agent gets hit with a prompt injection attack or hallucinates, it can delete a repository, push bad code, or drop a database β in milliseconds β before a human can stop it.
VaultSudo acts as a middleware interception layer between an AI agent and its tools, modeled after the Unix sudo command.
| Principle | How It Works |
|---|---|
| Zero-Trust by Default | Agents get permanent READ access β investigate bugs, read docs, analyze data. Zero friction. |
| Step-Up Authentication | The millisecond an agent attempts a WRITE action (e.g., merge_pull_request, drop_table), VaultSudo blocks the request. |
| Action Intent Auth | A push notification (Out-of-Band CIBA) shows the human the exact "Action Intent Diff" β what the agent wants to do, in plain English. |
| Sudo Sessions | If approved, VaultSudo mints a short-lived (5-minute), scope-bound token for that specific action only. |
Asset: video.gif β Full end-to-end walkthrough: Read access β Write request intercepted β Human approval β Prompt injection attack blocked.
- Cybersecurity Dashboard β Dark-themed glassmorphism UI with real-time agent monitoring
- Agent Terminal β Chat with the agent. Watch it execute reads and hit the sudo wall on writes
- Permission Scopes Panel β Live R/W badge visualization with pulsing amber on write attempts
- Step-Up Auth Banner β Full Action Intent Diff with approve/deny controls
- Prompt Injection Demo β Built-in attack button demonstrating VaultSudo blocking
delete_repo - Immutable Audit Trail β Every tool call, approval, and denial logged with action intent hashes
- Mock Mode β Zero-config demo environment β no API keys, no database, full security logic
graph TB
subgraph Dashboard["VaultSudo Dashboard (Next.js 16)"]
AT["Agent Terminal<br/>(Chat + Tool Results)"]
SP["Permission Scopes Panel<br/>(R/W Badges)"]
AuditUI["Audit Trail<br/>(Immutable Log Viewer)"]
Banner["Step-Up Auth Banner<br/>(Action Intent Diff + Approve/Deny)"]
AT --> Banner
SP --> Banner
AuditUI --> Banner
end
subgraph API["API Routes"]
R1["POST /api/agent"]
R2["GET /api/audit"]
R3["POST /api/demo/attack"]
R4["POST /api/webhook/ciba"]
end
subgraph Gate["VaultSudo Gate (vault-sudo.ts)"]
G1["1. Classify Scope"]
G2["2. Dangerous Action Block"]
G3["3. Sudo Session Check"]
G4["4. Gate Result"]
G1 --> G2 --> G3 --> G4
end
subgraph Session["Session Manager (session.ts)"]
S1["Agent Sessions"]
S2["Sudo Sessions"]
S3["Pending Actions"]
S4["Audit Log"]
end
Banner --> API
API --> Gate
Gate --> Session
flowchart LR
subgraph Read["β
Read Path β Zero Friction"]
RA["'Investigate CI'"] --> RB["classifyScope()"] --> RC["'read'"] --> RD["allowed β
"] --> RE["execute β audit"]
end
subgraph Write["π Write Path β Gated"]
WA["'Revert commit'"] --> WB["classifyScope()"] --> WC["'write'"] --> WD["no sudo β blocked π"]
WD --> WE["Step-Up Banner"] --> WF["Human approves"] --> WG["CIBA webhook"] --> WH["mintSudoSession(5min)"]
end
subgraph Attack["π« Attack Path β Unconditional Block"]
AA["'Delete the repo'"] --> AB["DANGEROUS_ACTIONS"] --> AC["blocked π«"]
end
π Full architecture diagrams β docs/ARCHITECTURE.md
VaultSudo implements a 4-layer security model where each layer is independent β compromising one layer cannot bypass another:
| Layer | Mechanism | Key Property |
|---|---|---|
| Layer 1: Scope Classification | Every tool mapped to read or write. Unknown tools default to write. |
Fail-closed β hallucinated tools can't bypass |
| Layer 2: Dangerous Action Blocklist | delete_repo, force_push, delete_branch β checked before session eval |
Unconditional β no session can override |
| Layer 3: Sudo Session Validation | Glob pattern matching + TTL expiry + approved_actions[] list |
Scope-bound β can't reuse for different actions |
| Layer 4: Immutable Audit Trail | Every gate evaluation logged with action intent hashes | Tamper-evident β SOC2/ISO 27001 ready |
| Vector | Defense |
|---|---|
| Prompt Injection | Dangerous Action Blocklist (unconditional) |
| Indirect Prompt Injection | Dangerous Action Blocklist + Scope Classification |
| Privilege Escalation | Unknown tools β write scope + __blocked__/unknown pattern |
| Session Hijacking | approved_actions[] list enforcement |
| Temporal Abuse | TTL expiry (default 10min, recommended 5min) |
| Tool Invention | Unknown tools fail-closed to write |
| Standard | VaultSudo Feature |
|---|---|
| SOC 2 (CC6.1) | Immutable audit trail with action intent hashes |
| SOC 2 (CC6.3) | Scope-bound, time-limited authorization tokens |
| ISO 27001 (A.9.2) | Least privilege via read/write scope classification |
| OWASP AI Security | Prompt injection defense via dangerous action blocklist |
| NIST AI RMF | Human-in-the-loop approval for consequential actions |
π Full security model β docs/SECURITY_MODEL.md
git clone https://github.com/edycutjong/vaultsudo.git
cd vaultsudo
npm install
cp .env.example .env.local # NEXT_PUBLIC_USE_MOCK=true is already set
npm run devOpen http://localhost:3000 and follow the demo scenes below.
| Step | Action | What Happens |
|---|---|---|
| 1 | Click "Safe Read β No Auth Needed" | Agent reads CI + commits autonomously. All green. |
| 2 | Click "Write Blocked β Step-Up Auth Required" | Agent tries revert_commit β VaultSudo blocks β Step-Up Banner appears |
| 3 | Click "Approve" on the banner | Sudo Session minted (5min, scope-bound) |
| 4 | Click "π΄ Prompt Injection Attack" | Agent hijacked β tries delete_repo β BLOCKED instantly |
π Full demo script with voiceover cues β docs/DEMO_SCRIPT.md
| Variable | Required | Default | Description |
|---|---|---|---|
NEXT_PUBLIC_USE_MOCK |
Yes | true |
Enable mock mode |
OPENAI_API_KEY |
If mock=false | β | LLM API key |
AUTH0_* |
If mock=false | β | Auth0 CIBA configuration |
NEXT_PUBLIC_SUPABASE_URL |
If mock=false | β | Supabase project URL |
SUPABASE_SERVICE_ROLE_KEY |
If mock=false | β | Supabase service role key |
π Full deployment guide β docs/DEPLOYMENT.md
Handles user messages, tool call simulation, and VaultSudo gating.
# Read operation (allowed)
curl -X POST http://localhost:3000/api/agent \
-H "Content-Type: application/json" \
-d '{"message": "Investigate the failing CI pipeline"}'
# Write operation (blocked β step-up auth)
curl -X POST http://localhost:3000/api/agent \
-H "Content-Type: application/json" \
-d '{"message": "Revert the bad commit"}'curl http://localhost:3000/api/audit?limit=10curl -X POST http://localhost:3000/api/demo/attack \
-H "Content-Type: application/json" \
-d '{"sessionId": "session-id"}'curl -X POST http://localhost:3000/api/webhook/ciba \
-H "Content-Type: application/json" \
-d '{"sessionId": "session-id", "action_id": "act_...", "approved": true}'π Full API reference with types β docs/API_REFERENCE.md
src/
βββ agent/
β βββ vault-sudo.ts # π Core middleware (scope, gate, session matching)
β βββ session.ts # πΎ In-memory session + audit store
β βββ tools.ts # π Tool definitions (read + write)
β βββ system-prompt.ts # π€ Agent system prompt
βββ app/
β βββ page.tsx # π₯ Main dashboard page
β βββ layout.tsx # π Root layout + fonts
β βββ globals.css # π¨ Design system (cybersec theme)
β βββ api/
β βββ agent/route.ts # POST β Agent message handler
β βββ audit/route.ts # GET β Audit trail retrieval
β βββ demo/attack/route.ts # POST β Attack simulation
β βββ webhook/ciba/route.ts # POST β CIBA approval callback
βββ components/
β βββ agent-terminal.tsx # π» Terminal UI (messages + interaction)
β βββ scope-panel.tsx # π Permission scope visualization
β βββ audit-trail.tsx # π Audit log viewer
β βββ step-up-banner.tsx # β‘ Step-up auth overlay (approve/deny)
β βββ attack-button.tsx # π Prompt injection demo trigger
βββ lib/
βββ types.ts # π TypeScript type definitions
| Phase | Milestone | Status |
|---|---|---|
| Phase 1 | Hackathon MVP β full security model with mock data | β Complete |
| Phase 2 | Supabase audit trail, Auth0 CIBA, persistent sessions, real LLM agent | π Q2 2026 |
| Phase 3 | Multi-tenant, policy engine, advanced session management, alerting | π Q3 2026 |
| Phase 4 | @vaultsudo/middleware npm package, multi-agent support, 3rd-party integrations |
π Q4 2026 |
π Full roadmap with technical details β docs/ROADMAP.md
| Layer | Technology | Role |
|---|---|---|
| Frontend | Next.js 16 (App Router) | SSR, API routes, React 19 |
| Styling | Tailwind CSS v4 | Utility-first styling |
| Animation | Framer Motion 12 | Step-up banner, terminal animations |
| Auth (planned) | Auth0 CIBA | Out-of-band push authentication |
| Agent (planned) | Vercel AI SDK | LLM orchestration |
| Database (planned) | Supabase (PostgreSQL + RLS) | Immutable audit trail |
| Testing | Vitest | Unit and coverage testing |
| Document | Description |
|---|---|
| Architecture | System design, request flows, core components |
| Security Model | Threat model, 4-layer defense, CIBA, compliance |
| API Reference | All endpoints, types, examples |
| Demo Script | Scene-by-scene Loom recording guide |
| Deployment | Setup, environment variables, Docker, production |
| Roadmap | Phase 1β4 product evolution |
Built for:
- HackVision 2026
- Auth0 "Authorized to Act"
MIT β see LICENSE file.






