Current goal: a faithful Python port of GForge — a minimal installer for secure global Git hooks, with the same detection engine.
- Command entry point (
gforgeconsole script) — Done - Detect Git, platform, shell, and home directory — Done
- Create a GForge-owned hooks directory — Done
- Install the pre-commit secret firewall — Done
- Configure global
core.hooksPath— Done verify,update, anduninstallcommands — Done- Tests for repeated runs and safe uninstall — Done
gforge install
gforge verify
gforge update
gforge uninstall- Re-running install must be safe.
- Verify must be read-only.
- Uninstall must remove only GForge-owned files/config.
- Git config changes must be backed up or clearly reversible.
- Hooks must avoid exposing secrets in logs.
- The scanner must fail closed: if it cannot run, the commit is blocked.
The pre-commit hook delegates to a self-contained Python scanner
(src/gforge/scanner.py, installed as ~/.gforge/hooks/gforge_scan.py):
.envcross-reference (values from git-ignored.envfiles matched verbatim).- Provider rules (AWS, GitHub, Google, Slack, Stripe, npm, PyPI, private keys, JWTs, …).
- Generic credential keyword=value detection (catches
DB_PASS=…). - Shannon-entropy detection for unnamed secrets (skips SHAs/UUIDs/lockfiles/paths).
- Secret-file rules (
.env,id_rsa,*.p12, keystores, …; templates allowed). - Allowlist via
.gforgeignoreand inlinegforge:allow. - Optional gitleaks pass merged in when the binary is present.
- Redacted output (never prints matched values).
| Upstream module | Python module | State |
|---|---|---|
src/cli.js |
src/gforge/cli.py |
Done |
src/environment.js |
src/gforge/environment.py |
Done |
src/git-config.js |
src/gforge/git_config.py |
Done |
src/hooks.js |
src/gforge/hooks.py |
Done |
src/installer.js |
src/gforge/installer.py |
Done |
src/metadata.js |
src/gforge/metadata.py |
Done |
src/npm-update.js |
src/gforge/pypi_update.py |
Done (pip/PyPI) |
src/scanner.js |
src/gforge/scanner.py |
Done |
src/verify.js |
src/gforge/verify.py |
Done |
scripts/postinstall.js |
— | Not portable; replaced by explicit gforge install |
- Publish to PyPI and validate
pipx install gforgeend to end. - Add CI across macOS / Linux / Windows and Python 3.9–3.13. Done (GitHub Actions).
- Track upstream releases and carry detection changes across in both directions.
- Consider: configurable rule packs, per-org shared allowlists, secret history scan.