How tensenuziiii/shadow_guard_ai works
ShadowGuard is an AI security gateway: a user submits a request, an agent proposes tool actions, and a policy interceptor evaluates and either blocks, stages for human approval, or executes them. The product also offers approval and trust-management APIs, simulated database impact, audit/event visibility, integrations, and an operations dashboard. Edges follow the shown chat, agent, interceptor, and startup wiring; other documented-by-code subsystems are included where their paths are clear, but unsampled internals are not assumed to call one another.
Main entry points: interceptor.py Tool interceptor · main.py Application runtime · chat.py Chat API · database.py Security database
Components 25
User experience
- Security dashboard
frontend/src/App.jsx
Request gateway
- Chat API
backend/app/api/chat.py - AI tool agent
backend/app/agent.py - MCP server
backend/app/mcp_server.py - Application runtime
backend/app/main.py - API schemas
backend/app/schemas.py
Security controls
- Tool interceptor
backend/app/security/interceptor.py - Action classification
backend/app/security/action_classifier.py - Intent guard
backend/app/security/intent_guard.py - Tool trust registry
backend/app/security/registry.py - SQL risk analysis
backend/app/security/risk_engine.py - Session taint
backend/app/security/taint.py - Response guard
backend/app/security/response_guard.py - Safe responses
backend/app/security/response_synthesizer.py - Impact simulation
backend/app/security/shadow_state.py
Approvals and observability
- Approval API
backend/app/api/approvals.py - Approval manager
backend/app/security/approvals.py - Audit logging
backend/app/security/audit.py - Security events
backend/app/api/events.py - Integration settings
backend/app/api/integrations.py
Runtime state
- Runtime configuration
backend/app/config.py - Security database
backend/app/database.py
Other components
- Operator
- External tools
- AI model provider
Connections 36
- Operator → Security dashboard: uses
- Security dashboard → Chat API: submits requests
- Chat API → AI tool agent: runs request
backend/app/api/chat.py - AI tool agent → AI model provider: queries
- AI tool agent → Tool interceptor: dispatches tools
backend/app/agent.py - Tool interceptor → Action classification: classifies action
backend/app/security/interceptor.py - Tool interceptor → Intent guard: checks intent
backend/app/security/interceptor.py - Tool interceptor → Tool trust registry: evaluates trust
backend/app/security/interceptor.py - Tool interceptor → SQL risk analysis: checks SQL
backend/app/security/interceptor.py - Tool interceptor → Session taint: checks taint
backend/app/security/interceptor.py - Tool interceptor → Response guard: guards output
backend/app/security/interceptor.py - Tool interceptor → Safe responses: synthesizes result
backend/app/security/interceptor.py - Tool interceptor → Approval manager: stages actions
backend/app/security/interceptor.py - Tool interceptor → Impact simulation: simulates impact
backend/app/security/interceptor.py - Tool interceptor → Audit logging: records decisions
backend/app/security/interceptor.py - Tool interceptor → External tools: executes allowed actions
- Chat API → Approval manager: attaches context
backend/app/api/chat.py - Approval API → Approval manager: decides approvals
backend/app/api/approvals.py - Application runtime → Chat API: registers routes
backend/app/main.py - Application runtime → Approval API: registers routes
backend/app/main.py - Application runtime → Security events: registers routes
backend/app/main.py - Application runtime → Integration settings: registers routes
backend/app/main.py - Application runtime → Tool interceptor: configures gateway
backend/app/main.py - Application runtime → MCP server: initializes server
backend/app/main.py - Application runtime → Security database: initializes stores
backend/app/main.py - Application runtime → Tool trust registry: initializes registry
backend/app/main.py - Application runtime → Session taint: initializes taint engine
backend/app/main.py - Application runtime → Audit logging: initializes logger
backend/app/main.py - Approval manager → Security database: reads and writes
backend/app/security/approvals.py - Tool trust registry → Security database: reads and writes
backend/app/security/registry.py - Audit logging → Security database: persists events
backend/app/security/audit.py - Impact simulation → SQL risk analysis: analyzes SQL
backend/app/security/shadow_state.py - Runtime configuration → Security database: sets store paths
backend/app/database.py - Chat API → API schemas: validates payload
backend/app/api/chat.py - Security dashboard → Security events: views activity
- Security dashboard → Approval API: reviews actions