ace-git-secrets 0.13.0

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 (49) hide show
  1. checksums.yaml +7 -0
  2. data/.ace-defaults/git-secrets/config.yml +63 -0
  3. data/.ace-defaults/git-secrets/gitleaks.toml +14 -0
  4. data/.ace-defaults/nav/protocols/guide-sources/ace-git-secrets.yml +10 -0
  5. data/.ace-defaults/nav/protocols/wfi-sources/ace-git-secrets.yml +19 -0
  6. data/CHANGELOG.md +298 -0
  7. data/LICENSE +21 -0
  8. data/README.md +40 -0
  9. data/Rakefile +16 -0
  10. data/docs/demo/ace-git-secrets-getting-started.gif +0 -0
  11. data/docs/demo/ace-git-secrets-getting-started.tape.yml +38 -0
  12. data/docs/demo/fixtures/README.md +3 -0
  13. data/docs/demo/fixtures/sample.txt +1 -0
  14. data/docs/getting-started.md +109 -0
  15. data/docs/handbook.md +43 -0
  16. data/docs/usage.md +301 -0
  17. data/exe/ace-git-secrets +19 -0
  18. data/handbook/agents/security-audit.ag.md +237 -0
  19. data/handbook/guides/security/ruby.md +27 -0
  20. data/handbook/guides/security/rust.md +51 -0
  21. data/handbook/guides/security/typescript.md +33 -0
  22. data/handbook/guides/security.g.md +155 -0
  23. data/handbook/skills/as-git-security-audit/SKILL.md +29 -0
  24. data/handbook/skills/as-git-token-remediation/SKILL.md +21 -0
  25. data/handbook/workflow-instructions/git/security-audit.wf.md +247 -0
  26. data/handbook/workflow-instructions/git/token-remediation.wf.md +294 -0
  27. data/lib/ace/git/secrets/atoms/gitleaks_runner.rb +244 -0
  28. data/lib/ace/git/secrets/atoms/service_api_client.rb +188 -0
  29. data/lib/ace/git/secrets/cli/commands/check_release.rb +41 -0
  30. data/lib/ace/git/secrets/cli/commands/revoke.rb +44 -0
  31. data/lib/ace/git/secrets/cli/commands/rewrite.rb +46 -0
  32. data/lib/ace/git/secrets/cli/commands/scan.rb +51 -0
  33. data/lib/ace/git/secrets/cli.rb +75 -0
  34. data/lib/ace/git/secrets/commands/check_release_command.rb +48 -0
  35. data/lib/ace/git/secrets/commands/revoke_command.rb +199 -0
  36. data/lib/ace/git/secrets/commands/rewrite_command.rb +147 -0
  37. data/lib/ace/git/secrets/commands/scan_command.rb +113 -0
  38. data/lib/ace/git/secrets/models/detected_token.rb +129 -0
  39. data/lib/ace/git/secrets/models/revocation_result.rb +119 -0
  40. data/lib/ace/git/secrets/models/scan_report.rb +402 -0
  41. data/lib/ace/git/secrets/molecules/git_rewriter.rb +199 -0
  42. data/lib/ace/git/secrets/molecules/history_scanner.rb +155 -0
  43. data/lib/ace/git/secrets/molecules/token_revoker.rb +100 -0
  44. data/lib/ace/git/secrets/organisms/history_cleaner.rb +201 -0
  45. data/lib/ace/git/secrets/organisms/release_gate.rb +133 -0
  46. data/lib/ace/git/secrets/organisms/security_auditor.rb +220 -0
  47. data/lib/ace/git/secrets/version.rb +9 -0
  48. data/lib/ace/git/secrets.rb +168 -0
  49. metadata +227 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 42f92fe3039656ea5e9d23913cbf2293c56f52926d6058c72c00f17de01aa75c
4
+ data.tar.gz: 898f5d444459ef601d59e5d3ec83fc06e17e90e2f995c4af567f98444d3d99b9
5
+ SHA512:
6
+ metadata.gz: 0fe1d2d6b8f689c1f0a6e4239bed7a8978c6eccaf82d477a3cf97f147c02324b639d6731cf372755a1a4dbd5299cdb932647924b719ca214a3a2bf77d4b9a250
7
+ data.tar.gz: 8fdbb1ced752669af8931b294ca7d1b8b56cb1597cc0026fdae1b55055d2c35ef78646e289a9bca7c01a4bef80aed75bd399e78eacc4aadb293274e7932cebbb
@@ -0,0 +1,63 @@
1
+ # ace-git-secrets configuration
2
+ # Place in .ace/git-secrets/config.yml to customize
3
+ # ADR-022: This file is the single source of truth for defaults
4
+ #
5
+ # IMPORTANT: gitleaks is required for token detection
6
+ # Install with: brew install gitleaks
7
+
8
+ # Gitleaks configuration
9
+ # ace-git-secrets uses gitleaks for all token detection.
10
+ # The config is resolved via cascade:
11
+ # 1. .ace/git-secrets/gitleaks.toml (user override)
12
+ # 2. .ace-defaults/git-secrets/gitleaks.toml (gem default)
13
+ # To customize gitleaks rules, copy the gem default to .ace/git-secrets/gitleaks.toml
14
+ # and modify as needed. The file path is resolved automatically.
15
+ # Note: This is NOT a config option - gitleaks.toml must be a separate file.
16
+
17
+ # Default file exclusions (files that NEVER contain secrets)
18
+ # Only excludes files that cannot contain real secrets
19
+ # Test fixtures/cassettes are NOT excluded - use token-based whitelisting instead
20
+ exclusions:
21
+ # Lock files (contain integrity hashes, not secrets)
22
+ - "**/package-lock.json"
23
+ - "**/yarn.lock"
24
+ - "**/pnpm-lock.yaml"
25
+ - "**/Gemfile.lock"
26
+ - "**/composer.lock"
27
+ - "**/Cargo.lock"
28
+ - "**/poetry.lock"
29
+ - "**/Pipfile.lock"
30
+ - "**/go.sum"
31
+ # Minified files (generated code)
32
+ - "**/*.min.js"
33
+ - "**/*.min.css"
34
+ # Build outputs (generated, not source)
35
+ - "**/dist/**"
36
+ - "**/build/**"
37
+ - "**/node_modules/**"
38
+ - "**/vendor/**"
39
+ - "**/.bundle/**"
40
+
41
+ # Whitelist patterns (will not be flagged)
42
+ # Use specific token values, not file paths (more secure)
43
+ whitelist: []
44
+ # whitelist:
45
+ # - pattern: 'ghp_example_for_docs'
46
+ # reason: Documentation example
47
+ # - pattern: 'sk_test_fake123'
48
+ # reason: Test fixture token
49
+
50
+ # Output settings
51
+ output:
52
+ format: table # Verbose output format: table, json, yaml
53
+ mask_tokens: true # Always mask token values in output
54
+ directory: .ace-local/git-secrets # Directory for report files
55
+
56
+ # GitHub Enterprise support (optional)
57
+ # Uncomment and set your GitHub Enterprise API URL for token revocation
58
+ # github:
59
+ # api_url: https://github.mycompany.com/api/v3
60
+
61
+ # API request settings (optional)
62
+ # Custom User-Agent header for API requests (useful for corporate environments)
63
+ # user_agent: "my-company/1.0"
@@ -0,0 +1,14 @@
1
+ # Default gitleaks configuration for ace-git-secrets
2
+ # ADR-022: This file provides default gitleaks rules
3
+ # Place custom rules in .ace/git-secrets/gitleaks.toml to override
4
+
5
+ # Extend gitleaks default rules
6
+ [extend]
7
+ useDefault = true
8
+
9
+ # Add organization-wide custom rules here
10
+ # Example:
11
+ # [[rules]]
12
+ # id = "internal-api-key"
13
+ # description = "Internal API Key"
14
+ # regex = '''INTERNAL_[A-Za-z0-9]{32}'''
@@ -0,0 +1,10 @@
1
+ ---
2
+ # Guide Sources Protocol Configuration for ace-git-secrets gem
3
+ name: ace-git-secrets
4
+ type: gem
5
+ description: Guides from ace-git-secrets gem
6
+ priority: 10
7
+ config:
8
+ relative_path: handbook/guides
9
+ pattern: "*.g.md"
10
+ enabled: true
@@ -0,0 +1,19 @@
1
+ ---
2
+ # WFI Sources Protocol Configuration for ace-git-secrets gem
3
+ # This enables workflow discovery from the installed ace-git-secrets gem
4
+
5
+ name: ace-git-secrets
6
+ type: gem
7
+ description: Git secrets workflow instructions from ace-git-secrets gem
8
+ priority: 10
9
+
10
+ # Configuration for workflow discovery within the gem
11
+ config:
12
+ # Relative path within the gem (default: handbook/workflow-instructions)
13
+ relative_path: handbook/workflow-instructions
14
+
15
+ # Pattern for finding workflow files (default: *.wf.md)
16
+ pattern: "*.wf.md"
17
+
18
+ # Enable discovery
19
+ enabled: true
data/CHANGELOG.md ADDED
@@ -0,0 +1,298 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project 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
+ ## [Unreleased]
9
+
10
+ ## [0.13.0] - 2026-03-23
11
+
12
+ ### Added
13
+ - Arch Linux install instructions for `gitleaks` and `git-filter-repo` in getting-started guide.
14
+
15
+ ### Changed
16
+ - Aligned gemspec summary with README tagline.
17
+ - Moved Installation from README to Getting Started guide as a proper section.
18
+ - Clarified agent workflow references in Use Cases (removed raw `/as-` prefix).
19
+ - Fixed broken relative links in `handbook/guides/security/rust.md` and `handbook/guides/security/typescript.md`.
20
+ - Redesigned getting-started demo tape: sandbox with scan, history rewrite, and verify-clean flow.
21
+ - Re-recorded getting-started demo GIF from new tape.
22
+
23
+ ## [0.12.2] - 2026-03-23
24
+
25
+ ### Changed
26
+ - Refreshed package README layout with quick links, use-case flow, and standardized section ordering to match the current ACE package pattern.
27
+
28
+ ## [0.12.1] - 2026-03-22
29
+
30
+ ### Technical
31
+ - Replaced HTML-sensitive placeholder paths in getting-started examples with a concrete saved-report example.
32
+
33
+ ## [0.12.0] - 2026-03-22
34
+
35
+ ### Changed
36
+ - Reworked package documentation with a landing-page README, tutorial getting-started guide, refreshed usage reference, handbook catalog, demo assets, and aligned gem metadata messaging.
37
+
38
+ ### Fixed
39
+ - Corrected remediation examples to reuse the saved JSON report path under `.ace-local/git-secrets/sessions/`.
40
+ - Clarified that JSON reports are reusable for `revoke` and `rewrite-history`, while Markdown reports are for human-readable review.
41
+ - Included `docs/**/*` in gem packaging so linked documentation ships with the gem.
42
+
43
+ ## [0.11.0] - 2026-03-18
44
+
45
+ ### Changed
46
+ - Expanded `TS-SECRETS-001` E2E coverage with a new `check-release` gate test case and synchronized scenario runner/verifier manifests to 8-goal execution.
47
+
48
+ ### Technical
49
+ - Added task-level E2E lifecycle artifacts (`e2e-review.md`, `e2e-change-plan.md`) documenting coverage analysis and rewrite decisions for `8qe.t.h5e.5`.
50
+
51
+ ## [0.10.1] - 2026-03-18
52
+
53
+ ### Changed
54
+ - Migrated CLI namespace from `Ace::Core::CLI::*` to `Ace::Support::Cli::*` (ace-support-cli is now the canonical home for CLI infrastructure).
55
+
56
+
57
+ ## [0.10.0] - 2026-03-18
58
+
59
+ ### Changed
60
+ - Removed legacy backward-compatibility behavior as part of the 0.10 cleanup release.
61
+
62
+
63
+ ## [0.9.3] - 2026-03-15
64
+
65
+ ### Changed
66
+ - Migrated CLI framework from dry-cli to ace-support-cli
67
+
68
+ ## [0.9.2] - 2026-03-13
69
+
70
+ ### Changed
71
+ - Updated canonical git security skills to explicitly run bundled workflows in the current project and execute them end-to-end.
72
+
73
+ ## [0.9.1] - 2026-03-12
74
+
75
+ ### Changed
76
+ - Updated README remediation guidance to load the token-remediation workflow through `ace-bundle`.
77
+
78
+ ## [0.9.0] - 2026-03-10
79
+
80
+ ### Added
81
+ - Added the canonical handbook-owned security audit skill for git secret scanning workflows.
82
+
83
+
84
+ ## [0.8.3] - 2026-03-04
85
+
86
+ ### Fixed
87
+ - Usage docs and token-remediation workflow corrected to short-name path convention (`.ace-local/git-secrets/` not `.ace-local/ace-git-secrets/`)
88
+
89
+ ## [0.8.2] - 2026-03-04
90
+
91
+ ### Fixed
92
+ - Reverted Gitleaks temporary workspace handling to Ruby temp primitives (`Tempfile`/`Dir.mktmpdir`) instead of project-local temporary workspaces.
93
+
94
+ ## [0.8.1] - 2026-03-04
95
+
96
+ ### Fixed
97
+ - README and usage docs updated to short-name path convention (`.ace-local/git-secrets` not `.ace-local/ace-git-secrets`)
98
+
99
+ ## [0.8.0] - 2026-03-04
100
+
101
+ ### Changed
102
+ - Default session/report directory migrated from `.cache/ace-git-secrets/sessions` to `.ace-local/git-secrets/sessions`
103
+ - Gitleaks workspace now uses `Ace::Support::Items::Atoms::TmpWorkspace` for deterministic `.ace-local/tmp` paths
104
+
105
+ ## [0.7.11] - 2026-02-24
106
+
107
+ ### Technical
108
+ - Correct TS-SECRETS-001 E2E runner config path references to `.ace/git-secrets/config.yml` and document whitelist file-rule setup for fixture exclusions.
109
+
110
+ ## [0.7.10] - 2026-02-23
111
+
112
+ ### Technical
113
+ - Updated internal dependency version constraints to current releases
114
+
115
+ ## [0.7.9] - 2026-02-22
116
+
117
+ ### Changed
118
+ - Migrate top-level CLI help to the standard multi-command help pattern with explicit `help`, `--help`, and `-h` commands.
119
+
120
+ ### Technical
121
+ - Remove custom default-routing (`CLI.start`, `KNOWN_COMMANDS`, `DEFAULT_COMMAND`) from CLI registry.
122
+ - Move config preloading and no-args help handling to `exe/ace-git-secrets` before dry-cli dispatch.
123
+ - Update CLI command tests to assert executable-equivalent dry-cli dispatch behavior.
124
+
125
+ ## [0.7.7] - 2026-02-19
126
+
127
+ ### Technical
128
+ - Namespace security workflow instructions into git/ subdirectory
129
+
130
+ ## [0.7.6] - 2026-02-11
131
+
132
+ ### Technical
133
+ - Remove legacy MT-SECRETS-002 E2E test file (functionality covered by TS-SECRETS-002)
134
+
135
+ ## [0.7.5] - 2026-02-11
136
+
137
+ ### Added
138
+ - E2E tests for scan, rewrite, and configuration workflows
139
+ - Full workflow and config cascade E2E tests
140
+
141
+ ### Fixed
142
+ - Ensure proper exit codes for scan, revoke, rewrite commands (CLI wrappers now
143
+ raise Error with correct exit_code instead of returning 0)
144
+ - Move broken-report fixture out of .cache to avoid gitignore
145
+ - Resolve non-zero exit code for --help flag
146
+
147
+ ### Changed
148
+ - Migrate E2E tests to per-TC directory format
149
+
150
+ ## [0.7.4] - 2026-01-31
151
+
152
+ ### Fixed
153
+ - Optimize slow tests by stubbing subprocess calls
154
+ - Convert clean_working_directory? tests from real git calls to stubbed Open3.capture2
155
+ - Remove flaky test_available_returns_true_when_git_filter_repo_installed
156
+ - Suite time improved from ~1.4s to ~1.1s (~23% faster)
157
+
158
+ ## [0.7.3] - 2026-01-31
159
+
160
+ ### Performance
161
+ - Moved git integration tests to E2E test suite
162
+ - Tests now run via `/ace:run-e2e-test ace-git-secrets MT-SECRETS-001`
163
+ - Added HistoryScanner unit tests with mocked gitleaks
164
+ - Test execution time reduced from 4.5s to ~1.8s (60% reduction)
165
+
166
+ ## [0.7.2] - 2026-01-16
167
+
168
+ ### Changed
169
+ - Rename context: to bundle: keys in configuration files
170
+
171
+ ## [0.7.1] - 2026-01-15
172
+
173
+ ### Changed
174
+ - Migrate CLI commands to Hanami pattern
175
+ - Move commands from `commands/` to `cli/commands/`
176
+ - Update namespace from `Commands::*` to `CLI::Commands::*`
177
+ - Business logic command classes (`*Command`) remain in `commands/`
178
+
179
+ ## [0.7.0] - 2026-01-07
180
+
181
+ ### Changed
182
+ - **BREAKING**: Migrated CLI framework from Thor to dry-cli (task 179.09)
183
+ - Replaced `thor` dependency with `dry-cli ~> 1.0`
184
+ - Created dry-cli command wrappers (Scan, Rewrite, Revoke, CheckRelease)
185
+ - Maintained complete command parity and user-facing behavior
186
+
187
+ ## [0.6.0] - 2026-01-07
188
+
189
+ ### Changed
190
+ - **BREAKING**: Scan report filenames changed from 14-character timestamps to 6-character Base36 compact IDs
191
+ - Example: `20251129-143000-report.json` → `i50jj3-report.json`
192
+ - Reports now stored in `sessions/` subdirectory: `.cache/ace-git-secrets/sessions/`
193
+ - Migrate to Base36 compact IDs for session and file naming (via ace-timestamp)
194
+
195
+ ### Added
196
+ - Dependency on ace-timestamp for compact ID generation
197
+ - Organized report storage with `sessions/` subdirectory
198
+
199
+ ## [0.5.0] - 2026-01-05
200
+
201
+ ### Added
202
+ - Thor CLI migration with standardized command structure
203
+ - ConfigSummary display for effective configuration with sensitive key filtering
204
+ - Comprehensive CLI help documentation across all commands
205
+ - --help support for all subcommands
206
+ - exit_on_failure and version mapping standardization
207
+
208
+ ### Changed
209
+ - Adopted Ace::Core::CLI::Base for standardized options (--quiet, --verbose, --debug)
210
+ - Migrated from OptionParser to Thor framework
211
+ - Added method_missing for default subcommand support
212
+
213
+ ## [0.4.0] - 2026-01-03
214
+
215
+ ### Changed
216
+ - **BREAKING**: Minimum Ruby version raised to 3.3.0 (was 3.1.0)
217
+ - Standardized gemspec file patterns with deterministic Dir.glob
218
+ - Added MIT LICENSE file
219
+
220
+ ## [0.3.1] - 2025-12-30
221
+
222
+ ### Changed
223
+
224
+ - Replace ace-support-core dependency with ace-config for configuration cascade
225
+ - Migrate from Ace::Core to Ace::Config.create() API
226
+ - Migrate from `resolve_for` to `resolve_namespace` for cleaner config loading
227
+
228
+ ## [0.3.0] - 2025-12-30
229
+
230
+ ### Changed
231
+
232
+ * Rename `.ace.example/` to `.ace-defaults/` for gem defaults directory
233
+
234
+
235
+ ## [0.2.0] - 2025-12-22
236
+
237
+ ### Added
238
+
239
+ - Raw token persistence in scan results for remediation workflow
240
+ - Thread-safe blob caching for improved performance
241
+ - ADR-023 documenting security model decisions
242
+ - Enhanced audit logging for compliance tracking
243
+ - Configurable user-agent header for API client
244
+ - Configurable binary file extensions via `binary_extensions` parameter
245
+ - `--quiet` flag for CI-friendly minimal output
246
+
247
+ ### Changed
248
+
249
+ - **BREAKING**: Gitleaks is now required for scanning (removed internal Ruby pattern detection fallback)
250
+ - Simplified architecture by delegating all pattern matching to gitleaks
251
+ - Use `Ace::Core::Atoms::DeepMerger` from ace-support-core instead of local deep_merge
252
+ - Improved error messages for gitleaks validation and missing patterns files
253
+ - Log batch fallback reason when git cat-file --batch fails
254
+
255
+ ### Removed
256
+
257
+ - Internal Ruby pattern detection (TokenPatternMatcher) - now delegates entirely to gitleaks
258
+ - GitBlobReader complex blob parsing - simplified to use gitleaks output
259
+ - ThreadSafeBlobCache - no longer needed without internal pattern matching
260
+
261
+ ### Fixed
262
+
263
+ - Repository path validation in GitRewriter to prevent operations on invalid paths
264
+
265
+ ## [0.1.0] - 2025-12-20
266
+
267
+ ### Added
268
+
269
+ - Initial release of ace-git-secrets gem
270
+ - `ace-git-secrets scan` - Scan Git history for authentication tokens
271
+ - Supports GitHub PATs (classic, OAuth, App, fine-grained)
272
+ - Supports LLM API keys (Anthropic, OpenAI)
273
+ - Supports AWS credentials (Access Key, Session Token)
274
+ - Uses gitleaks when available, falls back to Ruby patterns
275
+ - Output formats: table, JSON, YAML
276
+ - `ace-git-secrets rewrite-history` - Remove tokens from Git history
277
+ - Uses git-filter-repo for safe history rewriting
278
+ - Dry-run mode for preview
279
+ - Automatic backup creation
280
+ - Confirmation required for destructive operations
281
+ - `ace-git-secrets revoke` - Revoke tokens via provider APIs
282
+ - GitHub token revocation via Credential Revocation API
283
+ - Instructions for manual revocation (Anthropic, OpenAI, AWS)
284
+ - `ace-git-secrets check-release` - Pre-release security gate
285
+ - CI-friendly exit codes (0=pass, 1=fail)
286
+ - Strict mode for medium confidence matches
287
+ - Models: DetectedToken, RevocationResult, ScanReport
288
+ - Atoms: TokenPatternMatcher, GitleaksRunner, GitBlobReader, ServiceApiClient
289
+ - Molecules: HistoryScanner, GitRewriter, TokenRevoker
290
+ - Organisms: SecurityAuditor, HistoryCleaner, ReleaseGate
291
+ - Configuration via ace-core config cascade (.ace/git-secrets/config.yml)
292
+ - ATOM architecture following ACE gem standards
293
+
294
+
295
+ ## [0.7.8] - 2026-02-22
296
+
297
+ ### Fixed
298
+ - Standardized quiet, verbose, debug option descriptions to canonical strings
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Michal Czyz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ <div align="center">
2
+ <h1> ACE - Git Secrets </h1>
3
+
4
+ Scan, revoke, and remove leaked credentials from Git history before they cause damage.
5
+
6
+ <img src="https://raw.githubusercontent.com/cs3b/ace/main/docs/brand/AgenticCodingEnvironment.Logo.XS.jpg" alt="ACE Logo" width="480">
7
+ <br><br>
8
+
9
+ <a href="https://rubygems.org/gems/ace-git-secrets"><img alt="Gem Version" src="https://img.shields.io/gem/v/ace-git-secrets.svg" /></a>
10
+ <a href="https://www.ruby-lang.org"><img alt="Ruby" src="https://img.shields.io/badge/Ruby-3.2+-CC342D?logo=ruby" /></a>
11
+ <a href="https://opensource.org/licenses/MIT"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-blue.svg" /></a>
12
+
13
+ </div>
14
+
15
+ > Works with: Claude Code, Codex CLI, OpenCode, Gemini CLI, pi-agent, and more.
16
+
17
+ [Getting Started](docs/getting-started.md) | [Usage Guide](docs/usage.md) | [Handbook - Skills, Agents, Templates](docs/handbook.md)
18
+
19
+ ![ace-git-secrets demo](docs/demo/ace-git-secrets-getting-started.gif)
20
+
21
+ `ace-git-secrets` gives developers and coding agents a focused remediation loop for leaked credentials: detect exposure with gitleaks-backed scanning, revoke impacted tokens by provider, and safely clean repository history with dry-run-first safeguards.
22
+
23
+ ## How It Works
24
+
25
+ 1. Scan commits with gitleaks-backed detection and capture a reusable saved report for remediation workflows.
26
+ 2. Revoke high-confidence findings from the saved scan report using provider-aware revocation flows.
27
+ 3. Preview history rewrites with `--dry-run`, execute cleanup when ready, then gate releases with `check-release`.
28
+
29
+ ## Use Cases
30
+
31
+ **Detect leaked credentials in Git history** - run [`ace-git-secrets`](docs/usage.md) to scan commits and capture a reusable JSON report for remediation. Use the `as-git-security-audit` agent workflow for a guided audit.
32
+
33
+ **Revoke exposed tokens by provider** - use the `as-git-token-remediation` workflow to revoke high-confidence findings from the saved scan report for GitHub PATs and other supported token classes before any history rewrites.
34
+
35
+ **Clean history safely with dry-run-first safeguards** - preview rewrite changes with [`ace-git-secrets rewrite-history --dry-run`](docs/usage.md), execute cleanup when ready, then block release pipelines if secrets are still present.
36
+
37
+ **Coordinate with git workflow tools** - pair with [ace-bundle](../ace-bundle) for loading remediation workflows, [ace-git](../ace-git) for repository context before cleanup, and [ace-git-commit](../ace-git-commit) for follow-up commits after remediation work.
38
+
39
+ ---
40
+ [Getting Started](docs/getting-started.md) | [Usage Guide](docs/usage.md) | [Handbook - Skills, Agents, Templates](docs/handbook.md) | Part of [ACE](https://github.com/cs3b/ace)
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ # ADR-021 compliant Rake::TestTask setup
7
+ Rake::TestTask.new(:test) do |t|
8
+ t.libs << "test" << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
+ end
11
+
12
+ # CI compatibility alias (ADR-021)
13
+ task spec: :test
14
+
15
+ # Default task
16
+ task default: :test
@@ -0,0 +1,38 @@
1
+ ---
2
+ description: Show ace-git-secrets detecting and removing a leaked token
3
+ tags:
4
+ - ace-git-secrets
5
+ - docs
6
+ - security
7
+ settings:
8
+ font_size: 16
9
+ width: 960
10
+ height: 540
11
+ format: gif
12
+ setup:
13
+ - sandbox
14
+ - git-init
15
+ - run: printf 'GITHUB_TOKEN=ghp_123456789012345678901234567890123456\n' > .env && git add .env && git commit -qm "add config with token"
16
+ scenes:
17
+ - name: Scan for leaked credentials
18
+ commands:
19
+ - type: ace-git-secrets scan
20
+ sleep: 6s
21
+ - name: Commit scan output before rewrite
22
+ commands:
23
+ - type: git add -A && git commit -qm 'save scan report'
24
+ sleep: 3s
25
+ - name: Rewrite history to remove the token
26
+ commands:
27
+ - type: clear
28
+ sleep: 1s
29
+ - type: ace-git-secrets rewrite-history --force
30
+ sleep: 6s
31
+ - name: Verify clean history
32
+ commands:
33
+ - type: clear
34
+ sleep: 1s
35
+ - type: ace-git-secrets scan
36
+ sleep: 6s
37
+ teardown:
38
+ - cleanup
@@ -0,0 +1,3 @@
1
+ # Demo fixtures for ace-git-secrets
2
+
3
+ Seed data used by YAML demo setup.
@@ -0,0 +1 @@
1
+ sample fixture content
@@ -0,0 +1,109 @@
1
+ ---
2
+ doc-type: user
3
+ title: Getting Started with ace-git-secrets
4
+ purpose: Tutorial for first-run ace-git-secrets workflows
5
+ ace-docs:
6
+ last-updated: 2026-03-22
7
+ last-checked: 2026-03-22
8
+ ---
9
+
10
+ # Getting Started with ace-git-secrets
11
+
12
+ Use `ace-git-secrets` when you need to find leaked credentials, revoke them quickly, and remove them from Git history.
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ gem install ace-git-secrets
18
+ ```
19
+
20
+ Install the required scanner and optional history-rewrite tool:
21
+
22
+ ```bash
23
+ # macOS
24
+ brew install gitleaks # required scanner
25
+ brew install git-filter-repo # optional, for history rewriting
26
+
27
+ # Arch Linux
28
+ pacman -S gitleaks # required scanner
29
+ pacman -S git-filter-repo # optional, for history rewriting
30
+ ```
31
+
32
+ Requires Ruby 3.2+ and `gitleaks` on your `PATH`.
33
+
34
+ ## 1. Run your first scan
35
+
36
+ Start with the default scan:
37
+
38
+ ```bash
39
+ ace-git-secrets scan
40
+ ```
41
+
42
+ The command prints a summary to stdout and saves a reusable JSON report under `.ace-local/git-secrets/sessions/`. Keep
43
+ the exact path printed by the command because both `revoke` and `rewrite-history` can reuse it.
44
+
45
+ ## 2. Read the report
46
+
47
+ The saved JSON report includes token type, confidence, commit, file path, and raw token values needed for follow-up
48
+ actions. When you want a shareable report for humans, run:
49
+
50
+ ```bash
51
+ ace-git-secrets scan --report-format markdown
52
+ ```
53
+
54
+ Use `--confidence high` when you want a narrower review, or `--since "30 days ago"` to limit large-repository scans.
55
+
56
+ ## 3. Revoke exposed tokens
57
+
58
+ After a scan, revoke from the saved JSON report so you operate on the exact findings you reviewed:
59
+
60
+ ```bash
61
+ ace-git-secrets revoke --scan-file .ace-local/git-secrets/sessions/abc123-report.json
62
+ ```
63
+
64
+ Use `--service github` to narrow revocation to one provider, or `--token` when you already know the exact credential to
65
+ invalidate.
66
+
67
+ ## 4. Preview history cleanup
68
+
69
+ Always dry-run history rewriting first:
70
+
71
+ ```bash
72
+ ace-git-secrets rewrite-history --dry-run --scan-file .ace-local/git-secrets/sessions/abc123-report.json
73
+ ```
74
+
75
+ When the preview looks correct, run the real rewrite with the same scan file:
76
+
77
+ ```bash
78
+ ace-git-secrets rewrite-history --scan-file .ace-local/git-secrets/sessions/abc123-report.json
79
+ ```
80
+
81
+ `rewrite-history` creates backups by default and prompts before destructive changes unless you pass `--force`.
82
+
83
+ ## 5. Add a CI/CD gate
84
+
85
+ Use the release gate to block publishes when secrets are still present:
86
+
87
+ ```bash
88
+ ace-git-secrets check-release --strict
89
+ ```
90
+
91
+ This is the simplest command to drop into release workflows or pre-publish checks.
92
+
93
+ ## Common Commands
94
+
95
+ | Goal | Command |
96
+ |------|---------|
97
+ | Scan the full repository history | `ace-git-secrets scan` |
98
+ | Save a Markdown report | `ace-git-secrets scan --report-format markdown` |
99
+ | Scan recent history only | `ace-git-secrets scan --since "30 days ago"` |
100
+ | Revoke tokens from a saved report | `ace-git-secrets revoke --scan-file .ace-local/git-secrets/sessions/abc123-report.json` |
101
+ | Preview cleanup | `ace-git-secrets rewrite-history --dry-run --scan-file .ace-local/git-secrets/sessions/abc123-report.json` |
102
+ | Block a release on findings | `ace-git-secrets check-release --strict` |
103
+
104
+ ## What to try next
105
+
106
+ - Add whitelist rules in `.ace/git-secrets/config.yml` for known documentation examples or test fixtures
107
+ - Load `ace-bundle wfi://git/security-audit` for a guided audit workflow
108
+ - Load `ace-bundle wfi://git/token-remediation` for full scan, revoke, and rewrite guidance
109
+ - Read [CLI Usage Reference](usage.md) for every option and output mode