gitrupt 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. gitrupt-0.2.0/.gitrupt.yml +74 -0
  2. gitrupt-0.2.0/CHANGELOG.md +73 -0
  3. gitrupt-0.2.0/CONTRIBUTING.md +76 -0
  4. gitrupt-0.2.0/MANIFEST.in +13 -0
  5. {gitrupt-0.1.0/src/gitrupt.egg-info → gitrupt-0.2.0}/PKG-INFO +16 -6
  6. {gitrupt-0.1.0 → gitrupt-0.2.0}/README.md +9 -0
  7. gitrupt-0.2.0/SECURITY.md +56 -0
  8. gitrupt-0.2.0/docs/architecture.md +800 -0
  9. gitrupt-0.2.0/docs/ci-setup.md +152 -0
  10. gitrupt-0.2.0/docs/implementation-plan.md +278 -0
  11. gitrupt-0.2.0/docs/plan.md +1204 -0
  12. gitrupt-0.2.0/docs/roadmap.md +647 -0
  13. gitrupt-0.2.0/docs/templates/docker/Dockerfile.gitrupt +14 -0
  14. gitrupt-0.2.0/docs/templates/github-actions/gitrupt-for-self.yml +71 -0
  15. gitrupt-0.2.0/docs/templates/github-actions/gitrupt.yml +71 -0
  16. gitrupt-0.2.0/docs/templates/gitlab-ci/gitrupt.yml +29 -0
  17. {gitrupt-0.1.0 → gitrupt-0.2.0}/pyproject.toml +16 -6
  18. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/__init__.py +1 -1
  19. gitrupt-0.2.0/src/gitrupt/__main__.py +6 -0
  20. gitrupt-0.2.0/src/gitrupt/ci.py +164 -0
  21. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/cli.py +198 -0
  22. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanner.py +28 -27
  23. {gitrupt-0.1.0 → gitrupt-0.2.0/src/gitrupt.egg-info}/PKG-INFO +16 -6
  24. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt.egg-info/SOURCES.txt +16 -0
  25. {gitrupt-0.1.0 → gitrupt-0.2.0}/LICENSE +0 -0
  26. {gitrupt-0.1.0 → gitrupt-0.2.0}/setup.cfg +0 -0
  27. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/config.py +0 -0
  28. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/git.py +0 -0
  29. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/hooks/__init__.py +0 -0
  30. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/hooks/install.py +0 -0
  31. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/hooks/pre_commit.py +0 -0
  32. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/hooks/pre_push.py +0 -0
  33. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/models.py +0 -0
  34. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/policy.py +0 -0
  35. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/reporting.py +0 -0
  36. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/risk.py +0 -0
  37. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/__init__.py +0 -0
  38. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/adapters.py +0 -0
  39. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/base.py +0 -0
  40. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/binaries.py +0 -0
  41. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/code_rules/__init__.py +0 -0
  42. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/code_rules/base.py +0 -0
  43. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/code_rules/go.py +0 -0
  44. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/code_rules/javascript.py +0 -0
  45. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/code_rules/php.py +0 -0
  46. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/code_rules/powershell.py +0 -0
  47. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/code_rules/python.py +0 -0
  48. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/code_rules/ruby.py +0 -0
  49. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/code_rules/rust.py +0 -0
  50. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/code_rules/shell.py +0 -0
  51. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/dependencies.py +0 -0
  52. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/ecosystems/__init__.py +0 -0
  53. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/ecosystems/base.py +0 -0
  54. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/ecosystems/node.py +0 -0
  55. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/ecosystems/python.py +0 -0
  56. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/entropy.py +0 -0
  57. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/forbidden_files.py +0 -0
  58. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/malware.py +0 -0
  59. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/osv_client.py +0 -0
  60. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/registry.py +0 -0
  61. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/secret_rules.py +0 -0
  62. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/secrets.py +0 -0
  63. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/suspicious_code.py +0 -0
  64. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/yara_loader.py +0 -0
  65. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt/scanners/yara_rules_builtin.py +0 -0
  66. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt.egg-info/dependency_links.txt +0 -0
  67. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt.egg-info/entry_points.txt +0 -0
  68. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt.egg-info/requires.txt +0 -0
  69. {gitrupt-0.1.0 → gitrupt-0.2.0}/src/gitrupt.egg-info/top_level.txt +0 -0
@@ -0,0 +1,74 @@
1
+ version: 1
2
+
3
+ # Gitrupt self-protection configuration
4
+ # This repository is protected by Gitrupt
5
+
6
+ mode: strict
7
+
8
+ scan:
9
+ secrets: true
10
+ threats: true
11
+ suspicious_code: false
12
+ dependencies: false
13
+
14
+ rules:
15
+ forbidden_paths:
16
+ - ".env"
17
+ - ".env.*"
18
+ - "*.pem"
19
+ - "*.key"
20
+ - "*.p12"
21
+ - "*.pfx"
22
+ - "credentials.json"
23
+ - "service-account.json"
24
+ - "*.secret"
25
+ forbidden_extensions:
26
+ - ".scr"
27
+ - ".exe"
28
+ max_file_size_mb: 50.0
29
+
30
+ allow:
31
+ paths:
32
+ - ".env.example"
33
+ - "tests/fixtures/**"
34
+ - "docs/**"
35
+
36
+ suppressions:
37
+ rules: []
38
+ files: []
39
+ paths: []
40
+
41
+ entropy:
42
+ enabled: true
43
+ threshold: 4.5
44
+ min_length: 20
45
+
46
+ suspicious_code:
47
+ min_confidence: 0.6
48
+ languages:
49
+ - python
50
+ - javascript
51
+ - shell
52
+ - powershell
53
+ - php
54
+ - ruby
55
+ - go
56
+
57
+ malware:
58
+ use_yara: true
59
+ max_file_size_mb: 50.0
60
+ custom_yara_dirs: []
61
+
62
+ dependencies:
63
+ ecosystems:
64
+ - python
65
+ - node
66
+ offline: false
67
+ timeout_seconds: 10.0
68
+ cache_ttl_hours: 24
69
+
70
+ policy:
71
+ low: allow
72
+ medium: warn
73
+ high: block
74
+ critical: block
@@ -0,0 +1,73 @@
1
+ # Changelog
2
+
3
+ All notable changes to Gitrupt will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ---
9
+
10
+ ## [Unreleased]
11
+
12
+ ---
13
+
14
+ ## [0.2.0] - 2026-09-16
15
+
16
+ ### Added
17
+
18
+ - **`gitrupt ci` command** — scans a diff range (`--base <ref> --head <ref>`) instead of the index. Designed for GitHub Actions, GitLab CI, and any runner that can call a Python CLI. Closes the `git commit --no-verify` and `git push --no-verify` bypass gap.
19
+ - **`--base-sha` and `--head-sha` flags** on `gitrupt ci` — accepts a resolved SHA directly, useful when the CI runner already knows the exact commit.
20
+ - **`--format json` and `--format sarif`** on `gitrupt ci` — SARIF 2.1.0 output uploads to GitHub's Security tab; JSON output feeds custom dashboards.
21
+ - **`--output <file>`** on `gitrupt ci` — writes findings to a file for CI artifacts.
22
+ - **GitHub Actions workflow template** — `docs/templates/github-actions/gitrupt.yml`. Copy to `.github/workflows/gitrupt.yml`.
23
+ - **GitLab CI template** — `docs/templates/gitlab-ci/gitrupt.yml`. Copy to `.gitlab-ci.yml`.
24
+ - **Generic Dockerfile runner** — `docs/templates/docker/Dockerfile.gitrupt` for any CI that supports containers.
25
+ - **`docs/ci-setup.md`** — full setup guide including branch protection, CODEOWNERS, and supply-chain hardening notes.
26
+ - **Unit tests for `gitrupt ci`** — covers clean diff, blocked diff, `.env` blocking, new-branch (empty-tree) scans.
27
+
28
+ ### Fixed
29
+
30
+ - **Pre-push hook** now passes `text_provider` and `byte_provider` to `build_scanners()`, so pre-push scans read file content from the outgoing commit instead of the index. Previously the hook failed open due to a signature mismatch.
31
+ - **Binary detection** only runs on files that look like real binaries. `*.py` and `*.md` files containing strings like `UPX0` in rule definitions or docs no longer trip the packer-signature check.
32
+ - **Entropy allowlist** now covers identifier-shaped strings (`SCREAMING_SNAKE_CASE`, `identifier=identifier` assignments, trailing punctuation) to reduce false positives on source code.
33
+ - **Twilio API key rule** no longer requires a context word — the `SK` + 32 hex shape is specific enough on its own.
34
+
35
+ ### Security
36
+
37
+ - CI enforcement is **server-side** and cannot be bypassed by local flags, hook deletion, or `gitrupt uninstall`.
38
+ - SARIF findings persist in the GitHub Security tab as an audit trail.
39
+ - Templates use `fetch-depth: 0` so the full base..head range is available.
40
+ - `docs/ci-setup.md` documents SHA-pinning actions and CODEOWNERS to prevent guardrail tampering.
41
+
42
+ ---
43
+
44
+ ## [0.1.0] - 2026-09-09
45
+
46
+ ### Added
47
+
48
+ - Initial MVP release
49
+ - Python package with `pyproject.toml`
50
+ - CLI with `init`, `scan`, `status`, `config`, `uninstall` commands
51
+ - Git repository detection and staged-file discovery
52
+ - Forbidden file scanner with default rules (`.env`, `*.pem`, `*.key`, etc.)
53
+ - Secret scanner with native patterns:
54
+ - AWS access keys
55
+ - GitHub personal access tokens and fine-grained tokens
56
+ - Generic API keys (high-entropy)
57
+ - Private keys (RSA, EC, OpenSSH, PGP)
58
+ - Database connection URLs with embedded passwords
59
+ - JWT tokens
60
+ - Generic bearer tokens
61
+ - Risk engine with severity scoring (LOW/MEDIUM/HIGH/CRITICAL)
62
+ - Policy engine reading `.gitrupt.yml` configuration
63
+ - Terminal reporter with colored output and redacted secrets
64
+ - Pre-commit hook installer (preserves existing hooks)
65
+ - Unit tests and integration tests
66
+ - Documentation (README, SECURITY, CONTRIBUTING, architecture, roadmap, plan)
67
+
68
+ ### Security
69
+
70
+ - Secrets are never logged in full — always redacted
71
+ - No repository content leaves the machine by default
72
+ - All Git operations use subprocess argument arrays (no shell interpolation)
73
+ - Existing Git hooks are preserved and chained, never overwritten
@@ -0,0 +1,76 @@
1
+ # Contributing to Gitrupt
2
+
3
+ Thank you for your interest in contributing to Gitrupt!
4
+
5
+ ## Development Setup
6
+
7
+ ```bash
8
+ git clone https://github.com/gitrupt/gitrupt
9
+ cd gitrupt
10
+
11
+ python -m venv .venv
12
+ # Windows
13
+ .venv\Scripts\Activate.ps1
14
+ # Linux/macOS
15
+ source .venv/bin/activate
16
+
17
+ pip install -e ".[dev]"
18
+ ```
19
+
20
+ ## Running Tests
21
+
22
+ ```bash
23
+ pytest
24
+ pytest tests/unit/
25
+ pytest tests/integration/
26
+ pytest --cov=gitrupt tests/
27
+ ```
28
+
29
+ ## Code Style
30
+
31
+ We use `ruff` for linting and formatting:
32
+
33
+ ```bash
34
+ ruff check src/ tests/
35
+ ruff format src/ tests/
36
+ ```
37
+
38
+ ## Type Checking
39
+
40
+ ```bash
41
+ mypy src/gitrupt/
42
+ ```
43
+
44
+ ## Pull Request Guidelines
45
+
46
+ 1. Fork the repository
47
+ 2. Create a feature branch: `git checkout -b feat/my-feature`
48
+ 3. Write tests for your changes
49
+ 4. Ensure all tests pass
50
+ 5. Ensure `ruff` and `mypy` pass
51
+ 6. Submit a pull request with a clear description
52
+
53
+ ## Commit Convention
54
+
55
+ Use conventional commits:
56
+
57
+ ```
58
+ feat: add new scanner
59
+ fix: correct secret redaction
60
+ docs: update README
61
+ test: add integration tests
62
+ chore: update dependencies
63
+ ```
64
+
65
+ ## Security
66
+
67
+ If you find a security vulnerability, please see [SECURITY.md](SECURITY.md) before opening a public issue.
68
+
69
+ ## Areas for Contribution
70
+
71
+ - Additional secret patterns
72
+ - New scanner integrations (Gitleaks, Semgrep, ClamAV)
73
+ - Performance improvements
74
+ - Platform-specific testing (Windows, Linux, macOS)
75
+ - Documentation improvements
76
+ - VS Code extension (Phase 9)
@@ -0,0 +1,13 @@
1
+ include README.md
2
+ include CHANGELOG.md
3
+ include LICENSE
4
+ include SECURITY.md
5
+ include CONTRIBUTING.md
6
+ include .gitrupt.yml
7
+
8
+ recursive-include docs *.md *.yml *.yaml *.txt Dockerfile.*
9
+
10
+ recursive-exclude tests *
11
+ recursive-exclude * __pycache__
12
+ recursive-exclude * *.py[co]
13
+ recursive-exclude * .DS_Store
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitrupt
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: A local Git security firewall for secrets, suspicious code, malware heuristics, and dependency vulnerability checks
5
5
  License: MIT License
6
6
 
@@ -26,11 +26,12 @@ License: MIT License
26
26
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
27
  SOFTWARE.
28
28
 
29
- Project-URL: Homepage, https://github.com/gitrupt/gitrupt
30
- Project-URL: Repository, https://github.com/gitrupt/gitrupt
31
- Project-URL: Issues, https://github.com/gitrupt/gitrupt/issues
32
- Project-URL: Documentation, https://github.com/gitrupt/gitrupt/blob/main/docs/architecture.md
33
- Keywords: git,security,secrets,pre-commit,pre-push,malware,suspicious-code,dependency-scanning,firewall
29
+ Project-URL: Homepage, https://github.com/MuhammadFakharKhan/gitrupt
30
+ Project-URL: Repository, https://github.com/MuhammadFakharKhan/gitrupt
31
+ Project-URL: Issues, https://github.com/MuhammadFakharKhan/gitrupt/issues
32
+ Project-URL: Documentation, https://github.com/MuhammadFakharKhan/gitrupt/blob/main/docs/architecture.md
33
+ Project-URL: Changelog, https://github.com/MuhammadFakharKhan/gitrupt/blob/main/CHANGELOG.md
34
+ Keywords: git,security,secrets,pre-commit,pre-push,malware,suspicious-code,dependency-scanning,firewall,ci-cd,sarif,github-actions
34
35
  Classifier: Development Status :: 3 - Alpha
35
36
  Classifier: Environment :: Console
36
37
  Classifier: Intended Audience :: Developers
@@ -294,6 +295,15 @@ If a hook already exists, Gitrupt preserves it and wraps it so your original beh
294
295
 
295
296
  ---
296
297
 
298
+ ## CI/CD Enforcement
299
+
300
+ Local hooks are advisory — `git commit --no-verify` skips them. To enforce Gitrupt on every PR and every push, run it in CI.
301
+
302
+ ```bash
303
+ gitrupt ci --base origin/main --head HEAD --format sarif --output gitrupt.sarif
304
+
305
+
306
+
297
307
  ## Privacy
298
308
 
299
309
  By default, Gitrupt runs locally. Repository content stays on the machine unless you explicitly enable networked checks.
@@ -231,6 +231,15 @@ If a hook already exists, Gitrupt preserves it and wraps it so your original beh
231
231
 
232
232
  ---
233
233
 
234
+ ## CI/CD Enforcement
235
+
236
+ Local hooks are advisory — `git commit --no-verify` skips them. To enforce Gitrupt on every PR and every push, run it in CI.
237
+
238
+ ```bash
239
+ gitrupt ci --base origin/main --head HEAD --format sarif --output gitrupt.sarif
240
+
241
+
242
+
234
243
  ## Privacy
235
244
 
236
245
  By default, Gitrupt runs locally. Repository content stays on the machine unless you explicitly enable networked checks.
@@ -0,0 +1,56 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ |---------|-----------|
7
+ | 0.1.x | ✅ Current |
8
+
9
+ ## Reporting a Vulnerability
10
+
11
+ **Please do not open a public GitHub issue for security vulnerabilities.**
12
+
13
+ To report a security issue:
14
+
15
+ 1. Email the maintainers directly (see project contacts)
16
+ 2. Or use GitHub's private vulnerability reporting if available
17
+
18
+ Include:
19
+ - Description of the vulnerability
20
+ - Steps to reproduce
21
+ - Potential impact
22
+ - Any suggested fix (optional)
23
+
24
+ You will receive a response within 72 hours.
25
+
26
+ ## Security Design Principles
27
+
28
+ Gitrupt follows these principles:
29
+
30
+ 1. **Fail closed** — critical findings block commits by default
31
+ 2. **No secret exposure** — detected secrets are always redacted in reports
32
+ 3. **Local by default** — repository content stays on the machine unless explicit networked checks are enabled
33
+ 4. **Opt-in network** — dependency OSV and external integrations are opt-in or intentionally gated
34
+ 5. **No execution** — Gitrupt never executes files it is analyzing
35
+ 6. **Deterministic policy** — security decisions are rule-based, not probabilistic
36
+ 7. **Hook safety** — existing Git hooks are preserved and never silently overwritten
37
+
38
+ ## Scope
39
+
40
+ Gitrupt is a **local security firewall** for Git repositories. It protects against:
41
+
42
+ - Accidental secret commits
43
+ - Prohibited file patterns and unsafe file extensions
44
+ - High-entropy secret material and credential-like values
45
+ - Suspicious code in added lines across common languages
46
+ - Malware-style binary indicators and optional YARA matches
47
+ - Known vulnerable dependencies via OSV lookups when enabled
48
+ - Push-time leaks when the pre-push hook is installed
49
+
50
+ Gitrupt does **not** claim to:
51
+
52
+ - Detect all malware or all malicious code patterns
53
+ - Guarantee security if `git commit --no-verify` or `git push --no-verify` is used
54
+ - Prevent determined attackers with repository access
55
+
56
+ For organizational security, combine Gitrupt with CI/CD enforcement and developer policy controls.