Skip to content

Commit 6227587

Browse files
author
saiganakato
committed
resolve gitleaks from PATH in PowerShell collector
1 parent 5c86bb4 commit 6227587

5 files changed

Lines changed: 30 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this regulation shelf are documented here.
44

55
The detailed shelf changelog lives in `regulation/shelf/SHELF_CHANGELOG.md`.
66

7+
## [1.2.4] - 2026-06-18
8+
9+
### Fixed
10+
11+
- PowerShell collector now resolves `gitleaks` from `PATH`, including CI-installed `go install` binaries, before declaring the tool unavailable.
12+
713
## [1.2.3] - 2026-06-18
814

915
### Fixed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Status: Active
44

5-
Shelf version: `1.2.3` (`regulation/shelf/SHELF_VERSION.md`)
5+
Shelf version: `1.2.4` (`regulation/shelf/SHELF_VERSION.md`)
66

77
## What This Repository Is
88

regulation/shelf/SHELF_CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Shelf Changelog
22

3+
## 1.2.4 - 2026-06-18
4+
5+
### Fixed
6+
7+
- PowerShell collector now resolves `gitleaks` from `PATH`, including CI-installed `go install` binaries, before declaring the tool unavailable.
8+
39
## 1.2.3 - 2026-06-18
410

511
### Fixed

regulation/shelf/SHELF_VERSION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Status: Active
55
## Current
66

77
```text
8-
1.2.3
8+
1.2.4
99
```
1010

1111
## Meaning

scripts/collect-audit-evidence.ps1

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,22 @@ function Convert-ToGitBashPath {
3434
}
3535

3636
function Resolve-GitleaksCommand {
37+
foreach ($commandName in @("gitleaks", "gitleaks.exe")) {
38+
$command = Get-Command $commandName -ErrorAction SilentlyContinue
39+
if ($command -and $command.Source -and (Test-Path -LiteralPath $command.Source)) {
40+
return $command.Source
41+
}
42+
}
43+
44+
$whereOutput = & where.exe gitleaks 2>$null
45+
if ($LASTEXITCODE -eq 0) {
46+
foreach ($path in $whereOutput) {
47+
if ($path -and (Test-Path -LiteralPath $path)) {
48+
return $path
49+
}
50+
}
51+
}
52+
3753
$candidates = @(
3854
(Join-Path $env:LOCALAPPDATA "Microsoft\WinGet\Packages\Gitleaks.Gitleaks_Microsoft.Winget.Source_8wekyb3d8bbwe\gitleaks.exe"),
3955
(Join-Path $env:USERPROFILE "AppData\Local\Microsoft\WinGet\Packages\Gitleaks.Gitleaks_Microsoft.Winget.Source_8wekyb3d8bbwe\gitleaks.exe"),

0 commit comments

Comments
 (0)