A production-ready security intelligence engine. Query CVE vulnerabilities using natural language, powered by RAG with LangChain and pgvector.
- Semantic Search: Query 330,000+ CVEs using natural language
- Real-time Ingestion: Automated CVE fetching from NVD API
- LangSmith Tracing: Full observability for debugging and evaluation
- Flexible LLM: Powered by Google Gemini
| Component | Technology |
|---|---|
| Frontend | Streamlit |
| Orchestration | LangChain |
| Database | Neon Postgres + pgvector |
| Embeddings | Google Gemini (text-embedding-004) |
| Observability | LangSmith |
- uv (Python package manager)
- Neon account (free Postgres with pgvector)
- LangSmith account (free tracing)
- NVD API Key (free, optional but recommended)
git clone https://github.com/yourusername/SentinelRAG.git
cd SentinelRAG
# Copy environment template
cp .env.example .envEdit .env with your credentials:
# LLM (Google Gemini)
GOOGLE_API_KEY=your-api-key
LLM_MODEL=gemini-1.5-flash
EMBEDDING_MODEL=models/text-embedding-004
EMBEDDING_DIMENSIONS=768
# Database (from Neon dashboard)
NEON_DATABASE_URL=postgresql://user:pass@host.neon.tech/db?sslmode=require
# LangSmith (Settings → Access Tokens)
LANGSMITH_API_KEY=lsv2_pt_xxxxx
LANGSMITH_PROJECT=SentinelRAG-dev
LANGCHAIN_TRACING_V2=true
# NVD API (optional - 10x faster ingestion)
NVD_API_KEY=your-nvd-keyuv syncuv run python -m src.db_setupYou should see:
✅ Connected to Neon Postgres database.
📦 Enabling pgvector extension...
📊 Creating vulnerabilities table...
✅ Database setup complete!
Quick test (last 7 days, ~750 CVEs):
uv run python -m src.cve_ingestion --recent --days 7Full database (all 330k CVEs, ~30 min with API key):
uv run python -m src.cve_ingestion --fulluv run streamlit run app.pyOpen http://localhost:8501 and start querying!
- "What are the most critical vulnerabilities in Apache Log4j?"
- "Show me recent CVEs affecting Windows with remote code execution"
- "Find SQL injection vulnerabilities in web frameworks"
SentinelRAG/
├── app.py # Streamlit UI
├── src/
│ ├── config.py # Environment configuration
│ ├── db_setup.py # Database initialization
│ ├── cve_ingestion.py # NVD CVE fetcher
│ └── rag_chain.py # LangChain RAG pipeline
├── .env.example # Environment template
├── pyproject.toml # Dependencies (uv)
└── GEMINI.md # Project memory & architecture
-
Push to GitHub:
git add . git commit -m "Prepare for deployment" git push origin main
-
Deploy on Streamlit Cloud:
- Go to share.streamlit.io
- Sign in with GitHub
- Click "New app" → Select your repo
- Set main file:
app.py - Click "Deploy"
-
Configure Secrets:
In Streamlit Cloud dashboard → Settings → Secrets, add:
GOOGLE_API_KEY = "your-api-key" LLM_MODEL = "gemini-1.5-flash" EMBEDDING_MODEL = "models/text-embedding-004" EMBEDDING_DIMENSIONS = 768 NEON_DATABASE_URL = "postgresql://user:pass@host.neon.tech/db?sslmode=require" LANGSMITH_API_KEY = "lsv2_pt_xxxxx" LANGSMITH_PROJECT = "SentinelRAG-prod" APP_PASSWORD = "your-secret-password"
-
Reboot the app after adding secrets.
Note: Your Neon database persists across deployments. CVE data only needs to be ingested once.
Set APP_PASSWORD in your secrets to require authentication. Leave empty for open access.
MIT