← 返回
未分类 中文

ClickHouse GitHub Forensics

Query GitHub event data via ClickHouse for supply chain investigations, actor profiling, and anomaly detection. Use when investigating GitHub-based attacks,...
通过ClickHouse查询GitHub事件数据,用于供应链调查、行为者画像和异常检测。适用于调查基于GitHub的攻击场景。
1an0rmus 1an0rmus 来源
未分类 clawhub v1.0.0 1 版本 99779.2 Key: 无需
★ 0
Stars
📥 452
下载
💾 1
安装
1
版本
#forensics#github#latest#security#supply-chain

概述

ClickHouse GitHub Forensics

Query 10+ billion GitHub events for security investigations.

Author: Rufio @ Permiso Security

Use Case: Built during the Trivy supply chain compromise investigation (March 2026)

Quick Start

curl -s "https://play.clickhouse.com/?user=play" \
  --data "SELECT ... FROM github_events WHERE ... FORMAT PrettyCompact"
  • Endpoint: https://play.clickhouse.com/?user=play
  • Table: github_events
  • Auth: None required (public read-only)
  • Freshness: Near real-time (~minutes behind)
  • Volume: 10+ billion events

Key Columns

ColumnTypeUse
-------------------
created_atDateTimeEvent timestamp
event_typeEnumPushEvent, CreateEvent, DeleteEvent, ReleaseEvent, etc.
actor_loginStringGitHub username
repo_nameStringowner/repo format
refStringBranch/tag name (e.g., refs/heads/main, 0.33.0)
ref_typeEnumbranch, tag, repository, none
actionEnumpublished, created, opened, closed, etc.

For full schema (29 columns): see references/schema.md

Common Investigation Patterns

1. Actor Timeline (Who did what, when?)

SELECT created_at, event_type, repo_name, ref, action
FROM github_events 
WHERE actor_login = 'TARGET_ACCOUNT'
AND created_at >= '2026-03-01'
ORDER BY created_at

2. Repo Activity Window (What happened during incident?)

SELECT created_at, event_type, actor_login, ref, ref_type, action
FROM github_events 
WHERE repo_name = 'owner/repo'
AND created_at >= 'START_TIME'
AND created_at <= 'END_TIME'
ORDER BY created_at

3. Anomaly Detection (First-time repo access)

SELECT repo_name,
       countIf(created_at < 'ATTACK_DATE') as before,
       countIf(created_at >= 'ATTACK_DATE') as during
FROM github_events 
WHERE actor_login = 'SUSPECT_ACCOUNT'
AND created_at >= 'LOOKBACK_START'
GROUP BY repo_name
ORDER BY during DESC

4. Tag/Release Tampering

SELECT created_at, event_type, actor_login, ref, ref_type
FROM github_events 
WHERE repo_name = 'owner/repo'
AND event_type IN ('CreateEvent', 'DeleteEvent', 'ReleaseEvent')
AND ref_type = 'tag'
ORDER BY created_at

5. Actor Profile (Is this account legitimate?)

SELECT toStartOfMonth(created_at) as month,
       count() as events,
       uniqExact(repo_name) as unique_repos
FROM github_events 
WHERE actor_login = 'TARGET_ACCOUNT'
GROUP BY month
ORDER BY month

6. Org-Wide Activity (All repos in an org)

SELECT created_at, event_type, actor_login, repo_name, ref
FROM github_events 
WHERE repo_name LIKE 'orgname/%'
AND created_at >= 'START_TIME'
ORDER BY created_at

7. New Accounts During Incident (Potential attacker alts)

SELECT actor_login, min(created_at) as first_ever, count() as events
FROM github_events 
WHERE repo_name LIKE 'orgname/%'
GROUP BY actor_login
HAVING first_ever >= 'INCIDENT_START' AND first_ever <= 'INCIDENT_END'
ORDER BY first_ever

8. Hourly Breakdown (Attack timeline)

SELECT toStartOfHour(created_at) as hour,
       actor_login,
       count() as events,
       groupArray(distinct repo_name) as repos,
       groupArray(distinct event_type) as types
FROM github_events 
WHERE repo_name LIKE 'orgname/%'
AND created_at >= 'START_TIME'
GROUP BY hour, actor_login
ORDER BY hour

Event Types Reference

EventSignificance
---------------------
PushEventCode pushed to branch
CreateEventBranch/tag/repo created
DeleteEventBranch/tag deleted
ReleaseEventRelease published/edited
PullRequestEventPR opened/closed/merged
IssueCommentEventComment on issue
ForkEventRepo forked
WatchEventRepo starred

Tips

  • Output formats: FORMAT PrettyCompact for tables, FORMAT TabSeparated for parsing
  • macOS curl: Use --data not -d for multi-line queries
  • Timestamps: Use UTC, format YYYY-MM-DD HH:MM:SS
  • No payload JSON: Raw event payloads aren't available; use structured columns
  • Bot accounts: Filter with actor_login NOT IN ('github-actions[bot]', 'dependabot[bot]')

Security & Privacy

  • Uses ClickHouse's public playground — all queries sent to play.clickhouse.com
  • Data queried is GitHub's public event stream only
  • No private repo data, credentials, or sensitive information is accessible
  • Use responsibly: GitHub ToS prohibits scraping for spam or harassment

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-31 00:53 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

it-ops-security

Tmux

steipete
通过发送按键和抓取窗格输出,远程控制交互式 CLI 的 tmux 会话。
★ 45 📥 29,427
it-ops-security

OpenClaw Backup

alex3alex
备份与恢复 OpenClaw 数据。适用于创建备份、设置自动备份计划、从备份恢复或管理备份轮转。处理 ~/.openclaw 目录归档并包含适当的排除规则。
★ 90 📥 30,828
it-ops-security

1password

steipete
设置和使用 1Password CLI (op)。适用于:安装 CLI、启用桌面应用集成、登录(单/多账户)、通过 op 读取/注入/运行密钥。
★ 53 📥 31,509