Documentation Index
Fetch the complete documentation index at: https://docs.socfortress.co/llms.txt
Use this file to discover all available pages before exploring further.
Data Flows (AI Agent Quick Trace)
This file is for fast debugging and change planning. Each flow includes the key files and the minimum execution path.1) Startup + Initialization
Entry:backend/copilot.py->@app.on_event("startup")
- FastAPI app starts (
backend/copilot.py). - DB bootstrap/migration path runs (
backend/app/db/db_setup.py):create_database_if_not_exists(prod)create_copilot_user_if_not_exists(prod)apply_migrations
- Object storage buckets are ensured (
backend/app/data_store/data_store_setup.py:create_buckets). - Seed/reference data runs:
- connectors (
add_connectors->backend/app/db/db_populate.py) - roles
- available integrations/network connectors
- connectors (
- Admin + scheduler users ensured.
- APScheduler initialized and started (
backend/app/schedulers/scheduler.py).
2) Auth Request Flow
Primary token endpoint:POST /api/auth/tokeninbackend/app/auth/routes/auth.py
- Frontend sign-in form submits credentials (
frontend/src/components/auth/SignIn.vue). - API wrapper sends form-data to
/auth/token(frontend/src/api/endpoints/auth.ts). - Backend authenticates user (
AuthHandler.authenticate_userinbackend/app/auth/utils.py). - JWT is created with role scope(s) (
encode_tokeninbackend/app/auth/utils.py). - Frontend stores token in auth store (
frontend/src/stores/auth.ts). - Axios interceptor adds
Authorization: Bearer <token>on later calls (frontend/src/api/httpClient.ts). - Protected backend routes validate token/scope via
AuthHandler.get_current_userorrequire_any_scope.
3) Scheduler Job Execution
Core scheduler files:backend/app/schedulers/scheduler.pybackend/app/schedulers/routes/scheduler.py
- Startup calls
init_scheduler. initialize_job_metadataensures known jobs exist in DB (JobMetadata).schedule_enabled_jobsloads enabled jobs and registers interval triggers.- At run-time APScheduler calls mapped functions (
get_function_by_name). - Example job
invoke_alert_creation_collect:- runs alert auto-create route logic (
backend/app/schedulers/services/invoke_alert_creation.py) - updates
JobMetadata.last_success.
- runs alert auto-create route logic (
- Manual operations (
/api/scheduler/...) can run/pause/update/delete jobs.
4) Connector Verify + Use
Verify dispatch path:POST /api/connectors/verify/{id}->backend/app/connectors/routes.py- dispatch map in
backend/app/connectors/services.py:get_connector_service
- Frontend calls verify (
frontend/src/api/endpoints/connectors.ts). - Backend fetches connector row by ID, builds response model.
- Connector name is mapped to a service class in
service_map. - Service class calls connector-specific verifier in
backend/app/connectors/<service>/utils/universal.py. - DB updates
connector_verified+connector_last_updated.
- Feature route/service calls a connector client factory in
utils/universal.py. - Factory pulls credentials via
get_connector_info_from_db(backend/app/connectors/utils.py). - Downstream API requests run with those connector settings.
5) Alert -> Case
Alert creation and case linking paths:- Auto/manual alert creation routes:
backend/app/incidents/routes/incident_alert.py - Case creation routes:
backend/app/incidents/routes/db_operations.py - Case creation service:
backend/app/incidents/services/db_operations.py
- Alert is ingested/created (
/incident_alert/create/manualor/incident_alert/create/auto). - Analyst (or workflow) calls
/incident_management/case/from-alert. - Backend creates
Caseusing alert fields (create_case_from_alert). - Backend creates join record in
CaseAlertLink(create_case_alert_link). - Case now references the originating alert for SOC workflows and reporting.
6) Artifact Upload to MinIO
Two common paths:- Generic upload:
/api/agent_data_store/upload(backend/app/data_store/data_store_routes.py) - Velociraptor collection upload:
backend/app/connectors/velociraptor/services/artifacts.py
- Collection job runs and gets
flow_id. fetch_file_from_filestoredownloads zipped results locally.upload_agent_artifact_fileuploads file to MinIO bucketvelociraptor-artifactswith keyagent_id/flow_id/file.zip(backend/app/data_store/data_store_operations.py).- Metadata is stored in
AgentDataStoretable. - UI/API can list/download/delete via
backend/app/data_store/data_store_routes.py.
