securegit 0.8.5

Zero-trust git replacement with 12 built-in security scanners, LLM redteam bridge, universal undo, durable backups, and a 50-tool MCP server
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
# Git-Based Plugin Update System

## Leveraging Built-in Git Client

SecureGit already includes a full Git client for repository acquisition. This same functionality can manage plugin updates efficiently without additional dependencies.

## Simple Git-Based Plugin Registry

Instead of complex package management, plugins are Git repositories:

```
~/.config/securegit/plugins/
├── gitleaks/              # Git repository
│   ├── .git/
│   ├── plugin.json
│   ├── gitleaks           # Executable wrapper
│   └── README.md
├── trivy-config/          # Git repository
│   ├── .git/
│   ├── plugin.json
│   ├── trivy-config       # Executable wrapper
│   └── README.md
└── semgrep/               # Git repository
    ├── .git/
    ├── plugin.json
    ├── semgrep-wrapper    # Executable wrapper
    └── README.md
```

## Installation as Git Clone

### Install Plugin

```bash
# Install from Git repository
securegit plugin install https://github.com/securegit-plugins/gitleaks.git

# Internally runs:
# git clone https://github.com/securegit-plugins/gitleaks.git ~/.config/securegit/plugins/gitleaks
# chmod +x ~/.config/securegit/plugins/gitleaks/gitleaks
```

**Output:**
```
Installing plugin from https://github.com/securegit-plugins/gitleaks.git

Cloning into '~/.config/securegit/plugins/gitleaks'...
remote: Enumerating objects: 15, done.
remote: Counting objects: 100% (15/15), done.
Receiving objects: 100% (15/15), 12.45 KiB | 2.49 MiB/s, done.

Reading plugin.json...
  Name: gitleaks
  Version: 8.22.0
  Description: Detect hardcoded secrets using gitleaks

Installing dependencies...
  Downloading gitleaks binary v8.22.0... ✓
  Verifying checksum... ✓

✓ Plugin 'gitleaks' installed successfully
  Location: ~/.config/securegit/plugins/gitleaks
  Version: 8.22.0
  Commit: a1b2c3d (2026-01-28)
```

## Update Checking via Git

### Check for Updates

```bash
securegit plugin check-updates
```

**Implementation:**
```rust
for plugin_dir in list_plugin_dirs() {
    // Use built-in git client
    let repo = Repository::open(plugin_dir)?;

    // Fetch from origin
    repo.fetch("origin")?;

    // Get current HEAD
    let local_commit = repo.head()?.peel_to_commit()?;

    // Get remote HEAD
    let remote_commit = repo.find_reference("refs/remotes/origin/HEAD")?
        .peel_to_commit()?;

    if local_commit.id() != remote_commit.id() {
        // Update available!
        let commits_behind = count_commits_behind(repo, local_commit, remote_commit)?;
        println!("Update available: {} commits behind", commits_behind);
    }
}
```

**Output:**
```
Checking for plugin updates...

✓ gitleaks (8.22.0) - Up to date (commit: a1b2c3d)

⚠ trivy-config (0.58.2) - Update available
  Current:  0.58.2 (commit: d4e5f6g, 15 days old)
  Latest:   0.60.0 (commit: h7i8j9k, 2 days old)
  Behind:   12 commits
  Changes:
    • Added Kubernetes 1.30 support (commit: h7i8j9k)
    • Fixed Terraform false positives (commit: g6h7i8j)
    • Performance improvements (commit: f5g6h7i)

🚨 semgrep (1.45.0) - CRITICAL UPDATE REQUIRED
  Current:  1.45.0 (commit: k9l0m1n, 45 days old)
  Latest:   1.52.0 (commit: o2p3q4r, 1 day old)
  Behind:   87 commits
  Security: CVE-2026-1234 fixed in v1.50.0
  Changes:  [Run 'securegit plugin changelog semgrep' for full details]

2 updates available (1 security-critical)
```

## Changelog from Git History

### View Changelog

```bash
# Show changelog between current and latest
securegit plugin changelog semgrep

# Show specific version range
securegit plugin changelog semgrep 1.45.0..1.52.0
```

**Implementation uses git log:**
```rust
// Get commits between versions
let range = format!("{}..{}", current_version, latest_version);
let commits = repo.log(&range)?;

// Parse commit messages
for commit in commits {
    if is_security_commit(&commit) {
        security_fixes.push(parse_commit(&commit));
    } else if is_feature_commit(&commit) {
        features.push(parse_commit(&commit));
    } else if is_fix_commit(&commit) {
        bug_fixes.push(parse_commit(&commit));
    }
}
```

**Output:**
```
Changelog: semgrep 1.45.0 → 1.52.0 (87 commits)

🚨 SECURITY FIXES (2):
  v1.50.0 (2026-01-25) - CVE-2026-1234: Fixed code execution via malicious rules
    Commit: abc1234
    Author: Security Team

  v1.48.0 (2026-01-20) - CVE-2026-1235: Fixed path traversal in rule loading
    Commit: def5678
    Author: Security Team

✨ NEW FEATURES (8):
  v1.52.0 - Added 60 new JavaScript security rules
  v1.51.0 - Introduced parallel scanning (60% faster)
  v1.49.0 - Added Python 3.12 support
  v1.47.0 - New Java Spring Boot rules
  [...]

🐛 BUG FIXES (15):
  v1.52.0 - Fixed false positives in React hooks
  v1.51.0 - Corrected regex matching edge cases
  v1.50.0 - Fixed crash on binary files
  [...]

⚡ PERFORMANCE (3):
  v1.51.0 - 60% faster on large codebases
  v1.49.0 - 35% reduction in memory usage
  v1.46.0 - Optimized rule matching algorithm

Full git log:
  git -C ~/.config/securegit/plugins/semgrep log v1.45.0..v1.52.0
```

## Update via Git Pull

### Update Plugin

```bash
# Update single plugin
securegit plugin update semgrep

# Update all plugins
securegit plugin update --all
```

**Implementation:**
```rust
fn update_plugin(plugin_name: &str) -> Result<()> {
    let plugin_path = get_plugin_path(plugin_name);
    let repo = Repository::open(&plugin_path)?;

    // Read current version from plugin.json
    let current_version = read_plugin_manifest(&plugin_path)?.version;

    // Fetch latest changes
    repo.fetch("origin")?;

    // Check if update needed
    if !has_updates(&repo)? {
        println!("Already up to date");
        return Ok(());
    }

    // Show what will change
    show_changelog(&repo, &current_version)?;

    // Confirm with user
    if !confirm_update()? {
        return Ok(());
    }

    // Pull changes
    repo.pull("origin", "main")?;

    // Re-read plugin.json for new version
    let new_version = read_plugin_manifest(&plugin_path)?.version;

    // Run post-update script if exists
    if plugin_path.join("install.sh").exists() {
        run_install_script(&plugin_path)?;
    }

    println!("✓ Updated {} from {} to {}", plugin_name, current_version, new_version);

    Ok(())
}
```

**Output:**
```
Updating semgrep...

Changes to be applied (87 commits):
  🚨 Security fix: CVE-2026-1234
  ✨ 60 new JavaScript rules
  ⚡ 60% performance improvement

Current: 1.45.0 → Latest: 1.52.0

Proceed with update? [Y/n]: y

Fetching from origin...
Pulling changes...
Running post-update script...
  Downloading semgrep binary v1.52.0... ✓
  Updating rule database... ✓

✓ Successfully updated semgrep to 1.52.0

Test the update:
  securegit scan --plugin semgrep /path/to/test/file
```

## Security Advisory Detection via Git

### Detect Security Commits

Parse commit messages for security keywords:

```rust
fn is_security_commit(commit: &Commit) -> bool {
    let message = commit.message().to_lowercase();

    SECURITY_KEYWORDS.iter().any(|keyword| message.contains(keyword))
}

const SECURITY_KEYWORDS: &[&str] = &[
    "cve-",
    "security",
    "vulnerability",
    "exploit",
    "xss",
    "sql injection",
    "code execution",
    "privilege escalation",
    "dos",
    "denial of service",
];
```

### Parse CVE from Commits

```rust
fn extract_cves(commit: &Commit) -> Vec<String> {
    let message = commit.message();
    let cve_regex = Regex::new(r"CVE-\d{4}-\d{4,}").unwrap();

    cve_regex.find_iter(message)
        .map(|m| m.as_str().to_string())
        .collect()
}
```

**Detection Example:**
```
Commit: abc1234
Author: Security Team <security@semgrep.com>
Date:   2026-01-25

    SECURITY: Fix CVE-2026-1234 code execution vulnerability

    Malicious rule files could execute arbitrary code during parsing.
    This fixes the vulnerability by sandboxing rule evaluation.

    Severity: HIGH
    CVSS: 8.1
    CWE: CWE-94 (Improper Control of Generation of Code)

    All users should upgrade immediately.

🚨 SECURITY ALERT TRIGGERED
  CVE-2026-1234 detected in commit abc1234
  Plugin: semgrep
  Fixed in: v1.50.0
  You are running: v1.45.0 (vulnerable)

  ACTION REQUIRED: Update immediately
```

## Git Tags as Version Markers

### Semantic Versioning via Tags

```bash
# List available versions
securegit plugin versions semgrep
```

**Implementation:**
```rust
fn list_versions(plugin_name: &str) -> Result<Vec<Version>> {
    let repo = open_plugin_repo(plugin_name)?;

    // Get all tags
    let tags = repo.tag_names(None)?;

    // Parse semantic versions
    let mut versions: Vec<Version> = tags
        .iter()
        .filter_map(|tag| tag.and_then(parse_semver))
        .collect();

    // Sort by version
    versions.sort();
    versions.reverse();

    Ok(versions)
}
```

**Output:**
```
Available versions for semgrep:

  v1.52.0 (latest)  2026-01-28  commit: o2p3q4r
  v1.51.0           2026-01-24  commit: n1o2p3q
  v1.50.0           2026-01-25  commit: m0n1o2p  [SECURITY FIX]
  v1.49.0           2026-01-22  commit: l9m0n1o
  v1.48.0           2026-01-20  commit: k8l9m0n  [SECURITY FIX]
  v1.47.0           2026-01-18  commit: j7k8l9m
  v1.46.0           2026-01-15  commit: i6j7k8l
  v1.45.0 (current) 2026-01-14  commit: h5i6j7k
  [...]

Your version (1.45.0) is 7 releases behind.
2 security fixes available in newer versions.
```

### Checkout Specific Version

```bash
# Install/update to specific version
securegit plugin install semgrep --version 1.52.0

# Rollback to previous version
securegit plugin rollback semgrep --to 1.50.0
```

**Implementation:**
```rust
fn checkout_version(plugin_name: &str, version: &str) -> Result<()> {
    let repo = open_plugin_repo(plugin_name)?;

    // Find tag for version
    let tag = format!("v{}", version);
    let reference = repo.find_reference(&format!("refs/tags/{}", tag))?;
    let commit = reference.peel_to_commit()?;

    // Checkout tag
    repo.set_head_detached(commit.id())?;
    repo.checkout_head(Some(CheckoutBuilder::new().force()))?;

    // Update working directory
    repo.reset(commit.as_object(), ResetType::Hard, None)?;

    println!("✓ Checked out {} version {}", plugin_name, version);

    Ok(())
}
```

## Automatic Update Checks

### Git Fetch on Startup

```rust
async fn check_plugin_updates_background() {
    tokio::spawn(async {
        let plugin_dirs = list_plugin_dirs().await?;

        for dir in plugin_dirs {
            if let Ok(repo) = Repository::open(&dir) {
                // Non-blocking git fetch
                let _ = repo.fetch("origin").await;

                // Check if behind
                if let Ok(behind) = commits_behind(&repo).await {
                    if behind > 0 {
                        // Store in update registry
                        mark_update_available(&dir, behind).await;
                    }
                }
            }
        }
    });
}
```

**On startup:**
```
SecureGit v0.1.0

Checking for plugin updates in background...

[After 2 seconds]
ℹ 1 plugin update available (semgrep: 87 commits behind)
  Run 'securegit plugin check-updates' for details
```

## Git-Based Update Notification

### Commit Hook for Notifications

Plugin repositories can include a `.securegit/update-message.txt`:

```
v1.52.0 Release - IMPORTANT UPDATE

🚨 This release includes a critical security fix for CVE-2026-1234

What's New:
• Security: Fixed code execution vulnerability
• Performance: 60% faster scanning
• Features: 60 new JavaScript security rules

Breaking Changes: None

Please update as soon as possible:
  securegit plugin update semgrep

For full changelog:
  https://github.com/semgrep/semgrep/releases/tag/v1.52.0
```

When update detected:
```
⚠ semgrep has an important update available

v1.52.0 Release - IMPORTANT UPDATE

🚨 This release includes a critical security fix for CVE-2026-1234
[...]

Update now: securegit plugin update semgrep
```

## Git Submodules for Dependencies

Plugins can use git submodules for tool binaries:

```
~/.config/securegit/plugins/gitleaks/
├── .git/
├── .gitmodules          # Submodule configuration
├── plugin.json
├── gitleaks             # Wrapper script
├── bin/                 # Git submodule → gitleaks binary repo
│   └── gitleaks
└── README.md
```

**Update pulls submodule automatically:**
```bash
securegit plugin update gitleaks
# Internally runs:
# git pull
# git submodule update --init --recursive
```

## Lightweight Plugin Registry

Central registry is just a Git repository:

```
https://github.com/securegit-plugins/registry
├── plugins/
│   ├── gitleaks.json
│   ├── semgrep.json
│   ├── trivy.json
│   └── [...]
└── README.md
```

**Plugin metadata (gitleaks.json):**
```json
{
  "name": "gitleaks",
  "description": "Detect hardcoded secrets",
  "repository": "https://github.com/securegit-plugins/gitleaks.git",
  "author": "SecureGit Community",
  "tags": ["secrets", "credentials"],
  "verified": true,
  "downloads": 15420,
  "rating": 4.8,
  "latest_version": "8.22.0",
  "security_advisories": []
}
```

**Search registry:**
```bash
securegit plugin search secrets

# Internally:
# git clone https://github.com/securegit-plugins/registry /tmp/registry
# grep -r "secrets" /tmp/registry/plugins/*.json
```

## Benefits of Git-Based Approach

### Advantages

1. **No Additional Dependencies**
   - Reuse existing Git client code
   - No package manager infrastructure needed

2. **Distributed and Resilient**
   - Any Git hosting works (GitHub, GitLab, self-hosted)
   - No central server required
   - Works offline with local clones

3. **Full Version History**
   - Complete changelog via git log
   - Easy rollback to any version
   - Audit trail of all changes

4. **Developer Familiar**
   - Standard Git workflow
   - Known tooling (branches, tags, PRs)
   - Easy contribution model

5. **Security Built-in**
   - Git commit signing
   - Repository verification
   - Cryptographic integrity

6. **Bandwidth Efficient**
   - Delta compression
   - Shallow clones for large repos
   - Incremental fetches

### Implementation Complexity

**Simple Git-based approach:**
- Clone: `git clone <repo> <path>`
- Update check: `git fetch && git status`
- Update: `git pull`
- Changelog: `git log v1..v2`
- Rollback: `git checkout <tag>`

**vs Complex package manager:**
- Dependency resolution
- Package signing infrastructure
- Central registry servers
- Custom download protocols
- Database of package metadata

## Git Hooks for Plugin Lifecycle

Plugins can include git hooks:

```
~/.config/securegit/plugins/semgrep/
├── .git/
│   └── hooks/
│       ├── post-merge       # Run after update
│       └── post-checkout    # Run after version change
├── plugin.json
└── semgrep-wrapper
```

**post-merge hook:**
```bash
#!/bin/bash
# Auto-run after git pull

echo "Post-update tasks for semgrep..."

# Download new binary if version changed
if version_changed; then
    ./install.sh
fi

# Update rule database
./update-rules.sh

echo "✓ semgrep updated successfully"
```

## Complete Update Workflow Example

```bash
# User runs update check
securegit plugin check-updates

# Internal flow:
# 1. For each plugin directory
cd ~/.config/securegit/plugins/semgrep

# 2. Fetch from origin
git fetch origin

# 3. Compare local vs remote
LOCAL=$(git rev-parse HEAD)
REMOTE=$(git rev-parse origin/HEAD)

if [ "$LOCAL" != "$REMOTE" ]; then
    # 4. Count commits behind
    BEHIND=$(git rev-list --count HEAD..origin/HEAD)

    # 5. Check for security commits
    SECURITY=$(git log HEAD..origin/HEAD --grep="CVE-\|security" --oneline)

    # 6. Get latest tag/version
    LATEST=$(git describe --tags origin/HEAD)

    # 7. Display to user
    echo "Update available: $BEHIND commits behind"
    echo "Latest version: $LATEST"
    if [ -n "$SECURITY" ]; then
        echo "🚨 SECURITY UPDATE AVAILABLE"
    fi
fi
```

**User updates:**
```bash
securegit plugin update semgrep

# Internal flow:
# 1. Show changes
git log HEAD..origin/HEAD --oneline

# 2. User confirms
read -p "Proceed? [Y/n] " confirm

# 3. Pull changes
git pull origin main

# 4. Post-merge hook runs automatically
# (downloads new binary, updates rules)

# 5. Verify
./semgrep-wrapper --version
```

## Conclusion

Leveraging SecureGit's existing Git client for plugin management provides a simple, robust, and familiar update system. Developers already understand Git workflows, and the implementation complexity is minimal compared to custom package management.

The Git-based approach enables:
- Easy updates (`git pull`)
- Version history (`git log`)
- Rollbacks (`git checkout`)
- Security advisories (commit messages)
- Distributed hosting (any Git server)

This is developer-friendly, maintenance-friendly, and leverages battle-tested Git infrastructure.