TruffleHog Version
trufflehog 3.96.0
I reproduced this with the official
trufflehog_3.96.0_windows_amd64.tar.gz release artifact after verifying its
published SHA-256 checksum.
Trace Output
The minimized reproduction uses only a synthetic repository. The actionable
redacted parser/clone error is included below. I can provide a full
--log-level=5 Gist if additional trace detail is needed.
Expected Behavior
On Windows, trufflehog git should scan a local repository passed as an RFC
8089 absolute file URI such as file:///E:/temp/trufflehog-uri-repro.
RFC 8089 section E.2 explicitly identifies file:///c:/path/to/file as a
supported DOS/Windows file URI form.
Actual Behavior
The scan fails before scanning because the drive letter is duplicated:
failed to clone file Git repo (file://E:/E:/temp/trufflehog-uri-repro):
fatal: 'E:/E:/temp/trufflehog-uri-repro' does not appear to be a git repository
Changing only the source argument to file://E:/temp/trufflehog-uri-repro
allows the same repository to scan successfully. A raw native Windows path
(E:\temp\trufflehog-uri-repro) is rejected as an unsupported Git URI.
The current normalizeFileURI path parses file:///E:/... with an empty host
and /E:/... as the URL path, then calls filepath.Abs() on that value. On
Windows this expands to E:\E:\..., which is serialized as
file://E:/E:/....
Steps to Reproduce
-
Create E:\temp\trufflehog-uri-repro as a Git repository with a baseline
commit and a second commit containing only benign text.
-
From the parent directory, run:
trufflehog git file:///E:/temp/trufflehog-uri-repro `
--since-commit <baseline-sha> `
--branch HEAD `
--no-update `
--no-color `
--results=verified,unknown `
--fail `
--fail-on-scan-errors
-
Observe the duplicated-drive clone path and exit code 1.
-
Run the same command with
file://E:/temp/trufflehog-uri-repro; it completes successfully.
Environment
- OS: Microsoft Windows 11 Enterprise Insider Preview
- Shell: PowerShell 7.6.4
- TruffleHog: official v3.96.0 Windows AMD64 release
Additional Context
Current main still contains the affected normalization path:
https://github.com/trufflesecurity/trufflehog/blob/6f3c981e7b77f235fd2702dd74af25fc4b72bf11/pkg/sources/git/git.go
A Windows regression test using file:///C:/... or file:///E:/... would
distinguish this case from the relative URI handling fixed by #4614.
References
TruffleHog Version
trufflehog 3.96.0I reproduced this with the official
trufflehog_3.96.0_windows_amd64.tar.gzrelease artifact after verifying itspublished SHA-256 checksum.
Trace Output
The minimized reproduction uses only a synthetic repository. The actionable
redacted parser/clone error is included below. I can provide a full
--log-level=5Gist if additional trace detail is needed.Expected Behavior
On Windows,
trufflehog gitshould scan a local repository passed as an RFC8089 absolute file URI such as
file:///E:/temp/trufflehog-uri-repro.RFC 8089 section E.2 explicitly identifies
file:///c:/path/to/fileas asupported DOS/Windows file URI form.
Actual Behavior
The scan fails before scanning because the drive letter is duplicated:
Changing only the source argument to
file://E:/temp/trufflehog-uri-reproallows the same repository to scan successfully. A raw native Windows path
(
E:\temp\trufflehog-uri-repro) is rejected as an unsupported Git URI.The current
normalizeFileURIpath parsesfile:///E:/...with an empty hostand
/E:/...as the URL path, then callsfilepath.Abs()on that value. OnWindows this expands to
E:\E:\..., which is serialized asfile://E:/E:/....Steps to Reproduce
Create
E:\temp\trufflehog-uri-reproas a Git repository with a baselinecommit and a second commit containing only benign text.
From the parent directory, run:
Observe the duplicated-drive clone path and exit code 1.
Run the same command with
file://E:/temp/trufflehog-uri-repro; it completes successfully.Environment
Additional Context
Current
mainstill contains the affected normalization path:https://github.com/trufflesecurity/trufflehog/blob/6f3c981e7b77f235fd2702dd74af25fc4b72bf11/pkg/sources/git/git.go
A Windows regression test using
file:///C:/...orfile:///E:/...woulddistinguish this case from the relative URI handling fixed by #4614.
References
https://www.rfc-editor.org/rfc/rfc8089.html#appendix-E.2