How rohitkmr27/ai-soc-rag works
AI-SOC is a security operations application combining flow-based intrusion detection, alert management, incident correlation/investigation, and a cybersecurity knowledge base. Analysts submit flow features or CSVs, review persisted alerts and correlated incidents, and can request grounded enrichment or investigation. The frontend routes authenticated users to these workflows and calls the FastAPI API. README documents ingestion, embedding, indexing, and search capabilities beyond the sampled source; their internal wiring is therefore shown only where documented. Some subsystem links rely on README statements rather than inspected implementations.
Main entry points: main.py FastAPI application · api.py Alert endpoints · search.py Knowledge search · App.tsx Web application
Components 28
Analyst interface
- Web application
frontend/src/App.tsx - Auth state
frontend/src/context/AuthContext.tsx - API client
frontend/src/services/api.ts - SOC workflows
frontend/src/pages
API and identity
- FastAPI application
backend/app/main.py - Identity and access
backend/app/auth/dependencies.py - User records
backend/app/auth/models.py - Database sessions
backend/app/database.py
Detection and alerts
- IDS endpoints
backend/app/ids/api.py - Flow prediction
backend/app/ids/prediction.py - IDS model
backend/app/ids/model.py - IDS preparation and training
backend/app/ids - Alert endpoints
backend/app/alerts/api.py - Alert persistence
backend/app/alerts/service.py - Alert records
backend/app/alerts/models.py
Incident investigation
- Incident correlation
backend/app/alerts/correlation.py - Investigation API
backend/app/rag/api.py - Incident investigation
backend/app/rag/incident_investigation.py - Alert enrichment
backend/app/rag/alert_enrichment.py
Knowledge retrieval
- Document ingestion
backend/app/rag/document_loader.py - Embedding and indexing
backend/app/rag/index.py - Text embeddings
backend/app/rag/embeddings.py - Vector store
backend/app/rag/vector_store.py - Knowledge search
backend/app/rag/search.py - RAG generation
backend/app/rag/generator.py - Gemini provider
backend/app/rag/llm.py
Other components
- Analyst
- Google Gemini
Connections 30
- Analyst → Web application: uses
frontend/src/App.tsx - Web application → Auth state: provides auth
frontend/src/App.tsx - Web application → SOC workflows: routes to
frontend/src/App.tsx - Auth state → API client: calls
frontend/src/context/AuthContext.tsx - SOC workflows → API client: requests data
frontend/src/pages/IncidentDetailPage.tsx - API client → FastAPI application: HTTP requests
frontend/src/services/api.ts - FastAPI application → Identity and access: registers routes
backend/app/main.py - FastAPI application → IDS endpoints: registers routes
backend/app/main.py - FastAPI application → Alert endpoints: registers routes
backend/app/main.py - FastAPI application → Investigation API: registers routes
backend/app/main.py - Identity and access → Database sessions: opens session
backend/app/auth/dependencies.py - Identity and access → User records: loads user
backend/app/auth/dependencies.py - IDS endpoints → Flow prediction: predicts flows
backend/app/ids/api.py - Flow prediction → IDS model: loads model
backend/app/ids/prediction.py - IDS preparation and training → IDS model: creates artifact
README.md - Alert endpoints → Flow prediction: runs IDS
backend/app/alerts/api.py - Alert endpoints → Alert persistence: delegates persistence
backend/app/alerts/api.py - Alert persistence → Alert records: creates and reads
backend/app/alerts/service.py - Alert endpoints → Incident correlation: correlates alerts
backend/app/alerts/api.py - Investigation API → Incident investigation: investigates incidents
backend/app/rag/api.py - Alert endpoints → Alert enrichment: enriches alerts
backend/app/alerts/api.py - Document ingestion → Embedding and indexing: provides chunks
README.md - Embedding and indexing → Text embeddings: embeds chunks
README.md - Embedding and indexing → Vector store: stores vectors
README.md - Knowledge search → Vector store: searches vectors
README.md - Incident investigation → Knowledge search: retrieves context
- Alert enrichment → Knowledge search: retrieves context
- RAG generation → Knowledge search: uses search results
- RAG generation → Gemini provider: requests generation
- Gemini provider → Google Gemini: calls provider
backend/app/rag/llm.py