Skip to content

About

Cybersecurity awareness chatbot using FastAPI, Hugging Face model APIs, trusted-source web retrieval, citations and MongoDB training state across Slack, Teams and web.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

CyberChatBot — Cybersecurity Awareness Assistant

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.

Repository status

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.

Engineering focus

  • 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.

Quickstart

  1. Create a virtual env and install deps
python -m venv .venv

Linux/macOS

source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt

Windows (PowerShell)

.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
  1. 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
  1. Run the app
uvicorn app.main:app --reload --port 8000

What’s inside

  • 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.

Admin and training

  • Sign up: /training/signup
  • Login: /training/login
  • Admin KPI dashboard: /admin/kpi (set role: "admin" on the user in Mongo)
  • Published dataset loader: load_questions.py (inspect its configuration before running).

Trusted sources

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.

Licensing

This project is released under the MIT License (see LICENSE).

About

Cybersecurity awareness chatbot using FastAPI, Hugging Face model APIs, trusted-source web retrieval, citations and MongoDB training state across Slack, Teams and web.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages