Python · FastAPI · Hugging Face · MongoDB/Motor · Retrieval · Slack/Teams/Web
FastAPI chatbot for Slack, Teams, and web that answers cybersecurity-awareness questions from trusted public authorities and a dynamic training dataset. The response pipeline retrieves from an allowlist of cybersecurity authorities, returns source links, and includes moderation and sensitive-input filters.
This is a portfolio application under development. The current default branch imports app.config.Config, but app/config.py is absent from the published tree. Restore that configuration module before using the quickstart. The README also describes optional dataset-upload and local-document indexing paths that are not included in this checkout. The checked-in response pipeline currently uses live web retrieval; local knowledge-base fallback is disabled.
- API integration across Slack, Teams and web routes.
- MongoDB-backed training state and KPI events.
- Retrieval from allowlisted cybersecurity sources with citations.
- Hugging Face model integration and input/output filtering.
- Create a virtual env and install deps
python -m venv .venvLinux/macOS
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txtWindows (PowerShell)
.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -r requirements.txt- Configure
.env
SLACK_SIGNING_SECRET=...
SLACK_BOT_TOKEN=...
HF_TOKEN=...
HF_MODEL=google/gemma-2-2b-it
MONGO_URI=mongodb://localhost:27017
MONGO_DB_NAME=cyber_training
SESSION_SECRET=change-this-string
ENABLE_LIVE_SEARCH=1
- Run the app
uvicorn app.main:app --reload --port 8000- Slack/Teams/web Q&A with moderation, sensitive-data blocking, prompt-injection safeguards, and trusted-domain live search (CISA, NCSC, NIST, OWASP, etc.).
- Cached site search + HTML extraction with strict allow/deny rules; answers always cite the exact pages used.
- Mongo-backed training with level gating and badges; questions stored in
training_datasets. - KPI events emitted for logins, module attempts, answers, and Q&A activity.
- Sign up:
/training/signup - Login:
/training/login - Admin KPI dashboard:
/admin/kpi(setrole: "admin"on the user in Mongo) - Published dataset loader:
load_questions.py(inspect its configuration before running).
Live search is hard-restricted to:
owasp.org, cisa.gov, nist.gov, ncsc.gov.uk, enisa.europa.eu, cyber.gov.au, pcisecuritystandards.org, cert.govt.nz, publicsafety.gc.ca.
The repository includes keyword-based knowledge-base code, but local document indexing is not enabled in the current response pipeline.
This project is released under the MIT License (see LICENSE).