GitHub Threat Detector is a self-hosted CLI tool with no cloud dependencies — all you need is Python 3.10+, a running PostgreSQL instance, and a GitHub Personal Access Token. The steps below walk you through cloning the project, wiring up your environment, and producing your first findings report.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/morwn/github-threat-detector/llms.txt
Use this file to discover all available pages before exploring further.
Your GitHub PAT must have the
repo and read:org scopes. The repo scope is required to read events and workflow files from repositories; read:org is required to collect organization membership events that power the member-added-suspicious detector.Clone the repo and install dependencies
Clone the repository and install the Python dependencies into your environment.The dependency set is intentionally minimal:
requirements.txt
httpx handles all GitHub API calls with async-ready connection pooling, psycopg2-binary is the self-contained PostgreSQL driver, click powers the CLI, python-dotenv loads your .env file, and rich renders the terminal report table.Set up environment variables
Copy the example environment file and fill in your credentials.Open
.env in your editor. The file ships with the following defaults:.env.example
GITHUB_TOKEN— your GitHub PAT withrepoandread:orgscopes.DATABASE_URL— a standard PostgreSQL connection string. The database must already exist; the schema is applied automatically byinit-db.GITHUB_REPOS— a comma-separated list ofowner/repotargets used as the default when--reposis not passed on the command line.
Initialize the database schema
Apply the PostgreSQL schema. This creates the
events, workflow_runs, releases, contributors, workflow_files, commits, and findings tables if they do not already exist. The command is idempotent — safe to run more than once.Collect GitHub events
Run the collector against a repository. The flags below enable all data sources, giving the analyzers the richest possible signal.
You can also collect from an entire GitHub organization using
| Flag | Data collected |
|---|---|
| (default) | GitHub Events API (pushes, PRs, forks, member changes…) |
--actions | GitHub Actions workflow run history |
--releases | Repository releases and their publishing actors |
--contributors | Historical contributor list (improves release-actor-anomaly accuracy) |
--workflow-files | Raw workflow YAML (enables ai-workflow-unsafe-input analysis) |
--commits | Commit metadata for default-branch pushes (enables commit-date-gap and null-committer-email) |
--orgs:Run the analyzers
Execute all 15 heuristic analyzers against the collected data. Findings are written to the To run only a specific subset of rules, pass a comma-separated list of rule IDs:
findings table in PostgreSQL.View the report
Display findings in the terminal. Use Example output:Filter by a single repository using Export findings as JSON for integration with SIEM tools or alerting pipelines:You can also filter by time window using
--severity, --repos, --since, and --format to narrow results to exactly what you need.--repos:--since:Next Steps
CLI Reference
Explore every flag and option for
collect, analyze, report, and init-db.Detectors Overview
Understand the logic behind each of the 15 detection rules and how to tune thresholds.