Push events are the most fundamental unit of repository activity, and anomalies in them are reliable indicators of several different attack classes. A force push toDocumentation 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.
main can silently erase commit history, overwrite a legitimate release tag, or inject backdated commits without a pull request audit trail. Rapid sequential pushes in a short window often indicate scripted automation rather than human activity. Branch deletion targeting well-known branch names is a common step in pivot attacks that disable branch protection to enable direct pushes. An abnormal spike in fork activity can precede coordinated typosquatting or dependency confusion attacks. The four rules in this category cover each of these patterns.
force-push-default
Severity: highRequired data: Events only
What it detects
APushEvent where the forced field is true and the target ref is refs/heads/main or refs/heads/master. Force pushes to the default branch can rewrite history, remove commits from the audit trail, or replace a known-good tree with an attacker-controlled one.
How detection works
The analyzer queries push events filtered on both theforced flag and the ref value. No actor allowlisting is applied — even known maintainers should not be force-pushing to the default branch under normal circumstances.
Finding description
Evidence fields
| Field | Description |
|---|---|
ref | Target branch ref (e.g. refs/heads/main) |
head | The new HEAD commit SHA after the force push |
before | The previous HEAD commit SHA that was overwritten |
created_at | Timestamp of the push |
rapid-sequential-pushes
Severity: mediumRequired data: Events only
What it detects
A non-bot actor who makes 5 or more push events from the same repository within 60 seconds. This pattern is a strong indicator of scripted automation — either a CI pipeline running as a human account, or an attacker using automated tooling to push multiple payloads in rapid succession.Configurable thresholds
Both thresholds are defined inconfig.py and can be adjusted to match your repository’s normal CI patterns:
| Config variable | Default | Description |
|---|---|---|
RAPID_PUSH_WINDOW_SECONDS | 60 | Maximum elapsed time (seconds) between first and last push in the burst |
RAPID_PUSH_MIN_COUNT | 5 | Minimum number of pushes required to trigger |
How detection works
The analyzer groups push events by actor, repository, and minute bucket. It filters for groups where the raw count meetsRAPID_PUSH_MIN_COUNT and the elapsed time between the first and last event in the group falls within RAPID_PUSH_WINDOW_SECONDS. Bot accounts are excluded from consideration.
Finding description
Evidence fields
| Field | Description |
|---|---|
count | Number of pushes in the burst |
first_at | Timestamp of the first push |
last_at | Timestamp of the last push |
delete-branch-protection
Severity: highRequired data: Events only
What it detects
ADeleteEvent of type branch where the deleted branch is one of the well-known protected branch names: main, master, release, develop, or production. Deleting these branches bypasses branch protection rules entirely (the rules are attached to the branch name and are removed when the branch is deleted), enabling direct pushes on any subsequently recreated branch with the same name.
How detection works
The analyzer queries delete events filtered onref_type = 'branch' and a fixed set of protected branch names. Bot accounts are excluded.
Finding description
Evidence fields
| Field | Description |
|---|---|
ref | Name of the deleted branch |
created_at | Timestamp of the delete event |
fork-spike
Severity: mediumRequired data: Events only
What it detects
A day in the past 7 days where the repository received more than 3× its historical daily average number of forks. Abnormal fork spikes can precede coordinated typosquatting campaigns, dependency confusion attacks, or intelligence gathering by a threat actor preparing a targeted supply chain attack.Configurable thresholds
| Config variable | Default | Description |
|---|---|---|
FORK_SPIKE_MULTIPLIER | 3.0 | Multiple of historical average that triggers the rule |
FORK_SPIKE_WINDOW_DAYS | 7 | How many days back to look for spike days |
How detection works
The analyzer computes a per-day fork count and then calculates the mean daily fork rate across all history. Days within the rolling window where the count exceedsavg × FORK_SPIKE_MULTIPLIER are emitted as findings.
Finding description
Evidence fields
| Field | Description |
|---|---|
day | The calendar day of the spike |
count | Number of forks recorded that day |
avg | Historical average daily fork count |