# hugo-kte/insider-threat-ueba architecture

> Architecture diagram of the GitHub repository hugo-kte/insider-threat-ueba, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hugo-kte/insider-threat-ueba
- Repository: https://github.com/hugo-kte/insider-threat-ueba

## Overview

This is a CERT r4.2 insider-threat UEBA analysis CLI. An operator extracts raw logs and answer-key data, builds daily employee behavior features, scores them with five detector approaches, then evaluates analyst review budgets and produces metrics, figures, and a Markdown report. The README documents the feature and detector capabilities; source excerpts establish the main orchestration and data handling. Some subsystem links are based on those README statements because their implementation was not sampled.

Main entry points: [`src/ueba/pipeline.py`](https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/pipeline.py) (Analysis pipeline), [`src/ueba/cli.py`](https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/cli.py) (UEBA CLI), [`src/ueba/extract.py`](https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/extract.py) (Stream extraction), [`src/ueba/features.py`](https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/features.py) (Daily features)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Data ingestion"]
  node_cli["UEBA CLI<br/>[cli.py]"]
  node_extract["Stream extraction<br/>[extract.py]"]
  node_log_store[("Extracted logs<br/>[extract.py]")]
end

subgraph group_analysis["Behavior analysis"]
  node_features["Daily features<br/>[features.py]"]
  node_detectors["Five detectors<br/>[detectors.py]"]
end

subgraph group_assessment["Evaluation"]
  node_groundtruth["Malicious-day labels<br/>[groundtruth.py]"]
  node_pipeline["Analysis pipeline<br/>[pipeline.py]"]
  node_evaluation["Review-budget evaluation<br/>[evaluate.py]"]
end

subgraph group_outputs["Review outputs"]
  node_metrics["Metrics output<br/>[metrics.json]"]
  node_plots["Evaluation figures<br/>[plots.py]"]
  node_report["Markdown report<br/>[report.py]"]
end

node_operator(("Operator"))
node_cert_archive["CERT archive"]
node_answer_archive["Answer archive"]
node_analyst(("Security analyst"))

node_operator -->|"runs"| node_cli
node_cert_archive -->|"streams"| node_extract
node_answer_archive -->|"supplies"| node_cli
node_cli -->|"invokes"| node_extract
node_extract -->|"writes Parquet"| node_log_store
node_log_store -->|"builds from logs"| node_features
node_cli -->|"invokes evaluation"| node_pipeline
node_pipeline -->|"builds or loads"| node_features
node_pipeline -->|"scores features"| node_detectors
node_pipeline -->|"loads labels"| node_groundtruth
node_answer_archive -->|"provides answer files"| node_groundtruth
node_pipeline -->|"evaluates scores"| node_evaluation
node_pipeline -->|"writes"| node_metrics
node_pipeline -->|"generates figures"| node_plots
node_pipeline -->|"renders report"| node_report
node_analyst -.->|"reviews results"| node_metrics
node_analyst -.->|"reads findings"| node_report

click node_cli "https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/cli.py"
click node_extract "https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/extract.py"
click node_log_store "https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/extract.py"
click node_features "https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/features.py"
click node_detectors "https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/detectors.py"
click node_groundtruth "https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/groundtruth.py"
click node_pipeline "https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/pipeline.py"
click node_evaluation "https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/evaluate.py"
click node_metrics "https://github.com/hugo-kte/insider-threat-ueba/blob/main/reports/metrics.json"
click node_plots "https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/plots.py"
click node_report "https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/report.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_extract,node_log_store toneBlue
class node_features,node_detectors toneAmber
class node_groundtruth,node_pipeline,node_evaluation toneMint
class node_metrics,node_plots,node_report toneRose
class node_operator,node_cert_archive,node_answer_archive,node_analyst toneIndigo
```

## Components

### Data ingestion

- [UEBA CLI](https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/cli.py): `src/ueba/cli.py`
- [Stream extraction](https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/extract.py): `src/ueba/extract.py`
- [Extracted logs](https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/extract.py): `src/ueba/extract.py`

### Behavior analysis

- [Daily features](https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/features.py): `src/ueba/features.py`
- [Five detectors](https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/detectors.py): `src/ueba/detectors.py`

### Evaluation

- [Malicious-day labels](https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/groundtruth.py): `src/ueba/groundtruth.py`
- [Analysis pipeline](https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/pipeline.py): `src/ueba/pipeline.py`
- [Review-budget evaluation](https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/evaluate.py): `src/ueba/evaluate.py`

### Review outputs

- [Metrics output](https://github.com/hugo-kte/insider-threat-ueba/blob/main/reports/metrics.json): `reports/metrics.json`
- [Evaluation figures](https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/plots.py): `src/ueba/plots.py`
- [Markdown report](https://github.com/hugo-kte/insider-threat-ueba/blob/main/src/ueba/report.py): `src/ueba/report.py`

### Other components

- **Operator**
- **CERT archive**
- **Answer archive**
- **Security analyst**

## Connections

- Operator → UEBA CLI: runs (evidence: `src/ueba/cli.py`)
- CERT archive → Stream extraction: streams (evidence: `src/ueba/extract.py`)
- Answer archive → UEBA CLI: supplies (evidence: `src/ueba/cli.py`)
- UEBA CLI → Stream extraction: invokes (evidence: `src/ueba/cli.py`)
- Stream extraction → Extracted logs: writes Parquet (evidence: `src/ueba/extract.py`)
- Extracted logs → Daily features: builds from logs (evidence: `src/ueba/features.py`)
- UEBA CLI → Analysis pipeline: invokes evaluation (evidence: `src/ueba/cli.py`)
- Analysis pipeline → Daily features: builds or loads (evidence: `src/ueba/pipeline.py`)
- Analysis pipeline → Five detectors: scores features (evidence: `src/ueba/pipeline.py`)
- Analysis pipeline → Malicious-day labels: loads labels (evidence: `src/ueba/pipeline.py`)
- Answer archive → Malicious-day labels: provides answer files (evidence: `src/ueba/groundtruth.py`)
- Analysis pipeline → Review-budget evaluation: evaluates scores (evidence: `src/ueba/pipeline.py`)
- Analysis pipeline → Metrics output: writes (evidence: `src/ueba/pipeline.py`)
- Analysis pipeline → Evaluation figures: generates figures (evidence: `src/ueba/pipeline.py`)
- Analysis pipeline → Markdown report: renders report (evidence: `src/ueba/pipeline.py`)
- Security analyst → Metrics output: reviews results (evidence: `README.md`)
- Security analyst → Markdown report: reads findings (evidence: `README.md`)
