Skip to content
hariom123-devPublic

About

An open-source Zero-Trust gateway for AI coding agents. Intercepts MCP tool calls, freezes execution in memory, and forces manual approval via a React dashboard before allowing the AI to touch your local filesystem.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Warden-AI: Strict-Control AI Harness & Security Gateway

License: MIT Node.js TypeScript React Tailwind CSS Docker

Zero-Trust Reverse Proxy & Real-Time Human-in-the-Loop Gateway for Autonomous AI Coding Agents and Model Context Protocol (MCP) Tool Calls.


πŸ›‘οΈ Why Warden-AI?

Autonomous AI coding agents (such as Cursor, Claude Desktop, and CLI agents) are increasingly equipped with broad write permissions to local filesystems and shell execution environments. When prompt injection attacks, supply-chain vulnerabilities, or agent hallucinations occur, an agent can silently modify critical code, alter .env secrets, or run destructive terminal commands.

Warden-AI acts as an air-gapped security harness between autonomous AI agents and your local environment. It intercepts tool execution requests, freezes the agent's HTTP connection in memory via the Async Hold Pattern, and forces all filesystem mutations and terminal commands through a human-in-the-loop React approval dashboard before any code touches your disk.


πŸ—οΈ Architecture

flowchart LR
    A[Autonomous AI Agent<br/>Cursor / MCP Client] -->|POST /api/mcp/execute| B(Warden-AI Reverse Proxy)
    
    subgraph "Zero-Trust Gateway"
        B -->|Async Promise Hold| C[Pending Requests Map]
        B -->|Insert 'pending'| D[(SQLite Audit Trail<br/>WAL Mode)]
        B -->|WebSocket Broadcast| E[WebSocket Server]
    end
    
    E -->|Real-Time Event| F[React Command Center]
    
    subgraph "Human-in-the-Loop Operator"
        F -->|Inspect Visual Diff| G{Human Decision}
        G -->|Approve| H[Emit 'approved']
        G -->|Reject| I[Emit 'rejected']
    end
    
    H -->|WS Message| E
    I -->|WS Message| E
    
    E -->|Resolve Promise| C
    C -->|HTTP 200 Success| A
    C -->|HTTP 403 Forbidden| A
Loading

✨ Key Features

  • The Async Hold Pattern: Traps incoming agent HTTP tool calls inside unresolved JavaScript promises. Zero polling overhead, sub-millisecond dispatch, and fully transparent to MCP clients.
  • Side-by-Side Payload Diff Inspector: Embedded visual diff engine (react-diff-viewer-continued) highlights proposed additions and deletions before execution.
  • Real-Time Control Plane: Bidirectional WebSocket stream instantly notifies the operator and unblocks waiting CLI processes upon human approval.
  • Immutable SQLite Audit Trail: Every single tool call is cryptographically timestamped and persisted locally in SQLite (audit_logs) with status, agent name, and exact payload parameters.
  • Zero Cloud Dependencies: 100% local execution. No telemetry, no external database dependencies, and no Docker requirement.
  • Newcomer-Proof DevEx & Preflight Healthcheck: Built-in bootloader verifies Git availability, workspace write permissions, Docker daemon health, and validates environment variables via Zod before booting.

πŸ“ Repository Structure

Warden-AI/
β”œβ”€β”€ .env.example                # Canonical environment variable template
β”œβ”€β”€ docker-compose.yml          # One-command orchestration for all services
β”œβ”€β”€ package.json                # Root orchestration & bootstrap scripts
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ Dockerfile              # Multi-stage Node 20 Alpine build
β”‚   β”œβ”€β”€ .dockerignore
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ index.ts           # Express & WebSocket server entrypoint
β”‚   β”‚   β”œβ”€β”€ cli/
β”‚   β”‚   β”‚   └── healthcheck.ts # Preflight bootloader verification suite
β”‚   β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”‚   └── env.ts         # Zod environment schema & path validation
β”‚   β”‚   β”œβ”€β”€ db/
β”‚   β”‚   β”‚   └── client.ts      # SQLite audit trail initialization & queries
β”‚   β”‚   β”œβ”€β”€ proxy/
β”‚   β”‚   β”‚   └── interceptor.ts # Async request holding logic & MCP route
β”‚   β”‚   β”œβ”€β”€ security/
β”‚   β”‚   β”‚   └── honeypot.ts    # Cryptographic decoy honeypots & IDS quarantine
β”‚   β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”‚   └── model-loader.ts# Graceful model loader with terminal feedback
β”‚   β”‚   └── ws/
β”‚   β”‚       └── socket.ts      # WebSocket server & approval dispatcher
β”‚   β”œβ”€β”€ scripts/
β”‚   β”‚   β”œβ”€β”€ test-agent.ts      # Mock autonomous AI agent simulator
β”‚   β”‚   └── test-honeypot-breach.ts # IDS intrusion & session lockout test
β”‚   β”œβ”€β”€ package.json
β”‚   └── tsconfig.json
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ Dockerfile              # Multi-stage Vite build β†’ Nginx serving
β”‚   β”œβ”€β”€ .dockerignore
β”‚   β”œβ”€β”€ nginx.conf              # Nginx reverse proxy for API & WebSocket
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ App.tsx            # Main Zero-Trust Command Center UI
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ RequestCard.tsx# Intercepted action card & decision gates
β”‚   β”‚   β”‚   └── DiffViewer.tsx # Visual payload & code diff inspector
β”‚   β”‚   └── hooks/
β”‚   β”‚       └── useWebSocket.ts# Real-time WebSocket state management
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ vite.config.ts
β”‚   β”œβ”€β”€ tailwind.config.js
β”‚   └── tsconfig.json
└── README.md

πŸš€ Quick Start Guide

Prerequisites

  • Node.js: v18.0.0 or newer
  • Git: Installed and accessible in system $PATH
  • npm or pnpm / yarn

Step 1: Clone the Repository

git clone https://github.com/hariom123-dev/Warden-AI.git
cd Warden-AI

Optional: Copy the environment configuration template:

cp .env.example .env

(If omitted, sane local defaults will be applied automatically.)


Step 2: Start the Backend Gateway (Terminal 1)

cd backend
npm install
npm run bootstrap   # Runs preflight healthcheck (Git, Docker, write access, env)
npm run dev

Server will listen on http://localhost:3001 and mount the WebSocket control stream. Note: npm run dev and npm start automatically run the healthcheck preflight via predev/prestart.


Step 3: Start the React Security Dashboard (Terminal 2)

cd frontend
npm install
npm run dev

Open your browser to http://localhost:5173. The dashboard will display "System Secure: No pending AI actions".


Step 4: Run the Mock Autonomous Agent (Terminal 3)

cd backend
npm run test:agent

Observation:

  1. Terminal 3 pauses and holds: The agent prints STATUS: WAITING FOR HUMAN OPERATOR APPROVAL with an active timer.
  2. Dashboard lights up: The intercepted tool call pops up in the React dashboard with the file path (src/core/auth.ts) and proposed code diff.
  3. Approve or Reject: Click "Approve Action" to unblock the agent with HTTP 200, or "Reject Action" to abort the operation with HTTP 403.

🐳 Docker Deployment (One-Command Setup)

Prerequisites

Launch Everything

git clone https://github.com/hariom123-dev/Warden-AI.git
cd Warden-AI
docker compose up --build
Service URL
Security Dashboard http://localhost:5173
Backend API / WebSocket http://localhost:3001

Stop & Cleanup

# Stop all services
docker compose down

# Stop and remove persisted SQLite data
docker compose down -v

Note: The SQLite audit trail is persisted in a Docker volume (warden-data). Use docker compose down -v to remove it when starting fresh.


πŸ”’ Security & Audit Schema

All requests are logged immutably to audit.db using Write-Ahead Logging (WAL):

CREATE TABLE IF NOT EXISTS audit_logs (
    id TEXT PRIMARY KEY,
    timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
    agent_name TEXT,
    action_type TEXT,
    payload TEXT,
    status TEXT -- 'pending', 'approved', 'rejected'
);

🀝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check out the issues page.


πŸ“„ License

This project is open-source software licensed under the MIT License.

About

An open-source Zero-Trust gateway for AI coding agents. Intercepts MCP tool calls, freezes execution in memory, and forces manual approval via a React dashboard before allowing the AI to touch your local filesystem.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages