How umarfarookm/hifz-ai-security-firewall works
HIFZ AI is a prompt-injection firewall with a Next.js interface and API. Its main workflow inspects untrusted content through deterministic processing, conditionally escalates ambiguous cases to an investigator, applies policy, and records outcomes. A protected email agent separately checks proposed tool calls with a deterministic guard. The graph preserves the documented review, scenario, dashboard, and evaluation capabilities. Some links rely on the README’s architecture description; unsampled modules are represented only at supported paths.
Main entry points: policy Policy decision · review-store.ts Review queue · scorer.ts Risk scoring · investigate.ts Investigator
Components 27
Web product
- Product UI
apps/web/app - Inspect API
apps/web/app/api/v1/inspect/route.ts - Agent API
apps/web/app/api/v1/agent/run/route.ts - Events API
apps/web/app/api/v1/events/route.ts - Review API
apps/web/app/api/v1/reviews/route.ts - Review decision API
apps/web/app/api/v1/reviews/[id]/decision/route.ts - Scenario API
apps/web/app/api/v1/scenarios/route.ts - Attack scenarios
apps/web/lib/scenarios.ts - Metrics API
apps/web/app/api/v1/metrics/route.ts - Dashboard metrics
apps/web/lib/metrics.ts
Inspection pipeline
- Inspection orchestrator
apps/web/lib/inspect.ts - Content ingestion
packages/firewall-core/src/ingest - Normalization
packages/firewall-core/src/normalize - Attack detection
packages/firewall-core/src/detect/detect.ts - Risk scoring
packages/firewall-core/src/scorer.ts - Policy decision
packages/firewall-core/src/policy
Agent security
- Investigator
packages/agents/src/investigator/investigate.ts - Protected email agent
packages/agents/src/protected-agent/run-protected-agent.ts - Action Guard
packages/agents/src/protected-agent/action-guard.ts - Simulated tools
packages/agents/src/protected-agent/tools.ts
Audit and review
- Audit log
apps/web/lib/audit.ts - Review queue
apps/web/lib/review-store.ts
Evaluation
- Dataset evaluation
packages/eval/src/runner.ts
Other components
- User
- LLM provider
- Supabase
- Reviewer
Connections 28
- User → Product UI: uses
README.md - Product UI → Inspect API: submits content
README.md - Inspect API → Inspection orchestrator: runs inspection
apps/web/app/api/v1/inspect/route.ts - Inspection orchestrator → Content ingestion: ingests
README.md - Content ingestion → Normalization: extracts for
README.md - Normalization → Attack detection: normalizes for
README.md - Attack detection → Risk scoring: signals to
README.md - Risk scoring → Investigator: escalates ambiguous cases
README.md - Investigator → Policy decision: raises verdict for
README.md - Risk scoring → Policy decision: supplies risk to
README.md - Investigator → LLM provider: queries
README.md - Policy decision → Audit log: records decision
README.md - Policy decision → Review queue: queues review
README.md - User → Agent API: requests agent run
README.md - Agent API → Protected email agent: runs
apps/web/app/api/v1/agent/run/route.ts - Protected email agent → Action Guard: checks tool calls
packages/agents/src/protected-agent/run-protected-agent.ts - Action Guard → Simulated tools: authorizes execution
README.md - Action Guard → Review queue: holds for approval
README.md - Protected email agent → Audit log: logs outcomes
README.md - Events API → Audit log: lists events
apps/web/app/api/v1/events/route.ts - Review API → Review queue: lists reviews
apps/web/app/api/v1/reviews/route.ts - Reviewer → Review decision API: decides review
README.md - Review decision API → Review queue: records decision
apps/web/app/api/v1/reviews/[id]/decision/route.ts - User → Scenario API: runs scenarios
README.md - Scenario API → Attack scenarios: loads scenarios
apps/web/app/api/v1/scenarios/route.ts - Metrics API → Dashboard metrics: gets metrics
apps/web/app/api/v1/metrics/route.ts - Metrics API → Supabase: reads data
apps/web/app/api/v1/metrics/route.ts - Dataset evaluation → Supabase: records evaluations