GitHub Repository Analysis Tool with Advanced Fake Star Detection
Project description
⭐ StarGuard: Trust Scores for GitHub Repositories
CLI tool to detect fake-star campaigns, dependency hijacks, licence red flags, and other signals of open-source risk.
Inspired by the 4.5 million fake stars study, StarGuard helps CTOs, security teams, and VCs automate open-source due diligence in seconds.
📌 Why StarGuard?
- Fake stars are rampant. Research shows botnets and paid campaigns artificially inflate repo popularity.
- Supply chain attacks are rising. Malicious packages and licence traps easily reach production.
- Manual review doesn’t scale. StarGuard distills key public signals into a trust score — fast, repeatable, and extensible.
🚀 Features
| Category | What StarGuard Checks |
|---|---|
| ⭐ Stars | Burst detection (MAD + heuristics), bot-likeness profiling, Fake Star Index, trust badge generation. |
| 📦 Dependencies | SBOM / manifest parsing across npm, PyPI, Maven, Go, Ruby; flags unpinned, shadow, or non-registry deps. |
| ⚖ Licences | Detects unknown or high-risk licences (GPL/AGPL flags), scans both repo and direct deps. |
| 🛠 Maintainers | Contributor concentration, commit cadence, inactivity warnings. |
| 🧪 Code Signals | Pattern scans for obfuscation, remote exec, crypto-mining, or data exfiltration hints. |
| 📤 Outputs | JSON, Markdown, plaintext reports; PNG star-history plots; shields.io badge embed. |
⚙️ How It Works
- GitHub API/GraphQL – collects stars, forks, issues, traffic stats.
- BurstDetector – sliding window MAD algorithm + rules to catch inorganic star spikes.
- User Profiler – samples stargazers, checks account age, avatar, follower count, repo history.
- Dependency & Licence Parsers – uses API or file-based fallback.
- Scoring Engine – normalises components, applies weighted trust scoring + Fake-Star penalty.
flowchart TD
GH[GitHub API] --> Collectors
Collectors -->|Star, forks, issues| Analyzers
MF[Manifest files] --> Parser
Analyzers --> ScoreCombiner
Parser --> ScoreCombiner
ScoreCombiner -->|Report / Badge / API| Output
🧪 Quick Start
Requirements
- Python ≥ 3.9
- GitHub Personal Access Token (for high-rate limits)
Run
export GITHUB_TOKEN=ghp_xxxxxxxxx
# Full scan with star plot
python starguard.py pytorch/pytorch --format markdown --plot stars.png
# Burst-only fast scan
python starguard.py https://github.com/vercel/next.js --burst-only
🖥 CLI Reference
python starguard.py OWNER/REPO [options]
Options:
-t, --token TEXT GitHub token (or set GITHUB_TOKEN env)
-f, --format [text|json|markdown] Output format (default: text)
-o, --output FILE Write report to file
--plot FILE Save star-history PNG
--no-fake-stars Skip Fake-Star analysis
--burst-only Only run burst detection
-v, --verbose Enable debug logging
🔍 Use-Cases
- CTOs – Gate open-source additions during review.
- Security Teams – Schedule scans, integrate with security reviews.
- VCs – Rapid diligence on "10k stars" developer tools.
- Open-Source Maintainers – Show a StarGuard badge for transparency.
🤝 Contributing
- Fork and branch
- Run
make test - Open a PR with small, focused commits
- Follows Conventional Commits
- Licensed under Apache-2.0
🔒 Security & Privacy
- Only public metadata read (unless token provided)
- No code is executed; only static analysis
- Stores no personal data or credentials
📄 Licence
Apache License 2.0 © 2025 StarGuard contributors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file starguard-0.1.0.tar.gz.
File metadata
- Download URL: starguard-0.1.0.tar.gz
- Upload date:
- Size: 42.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
225fceaa8f63e91d6aa083e8691ca1bbef56d958a615302821ce1de5b6ea7d6b
|
|
| MD5 |
77d89ca60786b7819c195b33a8a9362b
|
|
| BLAKE2b-256 |
a8ea1223402ef49a530994002216058b88dc82e1db87c80da0532763f9474f64
|
Provenance
The following attestation bundles were made for starguard-0.1.0.tar.gz:
Publisher:
publish.yml on m-ahmed-elbeskeri/Starguard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
starguard-0.1.0.tar.gz -
Subject digest:
225fceaa8f63e91d6aa083e8691ca1bbef56d958a615302821ce1de5b6ea7d6b - Sigstore transparency entry: 211435862
- Sigstore integration time:
-
Permalink:
m-ahmed-elbeskeri/Starguard@8ee99b1a45adaedfb5ff8f9f9539f3a5508aab68 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/m-ahmed-elbeskeri
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8ee99b1a45adaedfb5ff8f9f9539f3a5508aab68 -
Trigger Event:
release
-
Statement type:
File details
Details for the file starguard-0.1.0-py3-none-any.whl.
File metadata
- Download URL: starguard-0.1.0-py3-none-any.whl
- Upload date:
- Size: 43.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
224007b7a60a48ed92fe94c527258a3d12056c310df6b904eb6715bda10cb2bd
|
|
| MD5 |
0534b020786bc9f3b8f61c2e352b1953
|
|
| BLAKE2b-256 |
2ca440c5bd88fca5ef0faebdf13614dc7c77fc6409e540a2243fe1831a1eb305
|
Provenance
The following attestation bundles were made for starguard-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on m-ahmed-elbeskeri/Starguard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
starguard-0.1.0-py3-none-any.whl -
Subject digest:
224007b7a60a48ed92fe94c527258a3d12056c310df6b904eb6715bda10cb2bd - Sigstore transparency entry: 211435866
- Sigstore integration time:
-
Permalink:
m-ahmed-elbeskeri/Starguard@8ee99b1a45adaedfb5ff8f9f9539f3a5508aab68 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/m-ahmed-elbeskeri
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8ee99b1a45adaedfb5ff8f9f9539f3a5508aab68 -
Trigger Event:
release
-
Statement type: