* Start Files Source
* Keep cmd the same for now
* Get tests to pass
* s.MaxTargetMegaBytes -> s.MaxFileSize
* Tweak some log messages & use q semgroup for files
* Just call yield inside the semgroup
* Refactor a check and revert some log lines
* Move mg && misc tuning
* Add `make profile`
(Benchmark results are only added if tools are installed)
Example output:
```
========================================================================
generating profile data
------------------------------------------------------------------------
- mode: dir
benchmark:
tool: hyperfine
path: profile/1748019612/dir/benchmark.json
results:
mean: 1.12852930166
stddev: 0.12163775966037399
median: 1.07242928416
user: 3.9699382799999996
system: 0.04382341999999999
min: 1.03207673016
max: 1.3913475181600001
profile:
- mode: cpu
path: profile/1748019612/dir/cpu.pprof
view: go tool pprof -http=localhost: ./gitleaks profile/1748019612/dir/cpu.pprof
- mode: mem
path: profile/1748019612/dir/mem.pprof
view: go tool pprof -http=localhost: ./gitleaks profile/1748019612/dir/mem.pprof
- mode: trace
path: profile/1748019612/dir/trace.out
view: go tool trace profile/1748019612/dir/trace.out
- mode: git
...snip...
```
* Archive support for File based sources
* Move Git to Source interface
* Scan archives in git
* Misc linter fixes
* Exclude certain diffs: --diff-filter=tuxdb
* Add git archives tests
* Log error instead of fatal
* Fix spacing in test config
* Refine source comments/wording
* Make MB conversions more readable
* Format cmd
* Adjust DetectSource logging
* MiB -> MB in logs
* Add testdata/repos/archives/dotGit/refs/.gitkeep
Without it the refs folder gets deleted and the
and then it isn't detected as a git repo ¯\_(ツ)_/¯
So then the test starts scanning the whole gitleaks
repo instead :D
* Handle finding links for archives
* Working on archive depth
* Fixes from failfast test
* cmd max-archive-depth
* added comments, fixed warnings
* removed test print
* Update README.md
* Set archive depth for DetectFiles
* Tweak logs & pass max archive for readers
* Pass ctx to Fragments
* Add make lint target and address some issues
* Fix compat issue
* Report path in fragment errors
* Apply PR suggestions & misc changes
- Update blobReader.Close() to discard the buffer
- Misc logger issues & uses
- Tweak .golangci.yaml to default to none
- Discard remaining blobReader data on close
- Undo a De Morgan's Law suggestion (and disable QF1001)
* Add http mode for diagnostics
gitleaks --diagnostics=http ...
-----
From the net/http/pprof docs:
Use the pprof tool to look at the heap profile:
```
go tool pprof http://localhost:6060/debug/pprof/heap
```
Or to look at a 30-second CPU profile:
```
go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30
```
Or to look at the goroutine blocking profile, after calling runtime.SetBlockProfileRate in your program:
```
go tool pprof http://localhost:6060/debug/pprof/block
```
Or to look at the holders of contended mutexes, after calling runtime.SetMutexProfileFraction in your program:
```
go tool pprof http://localhost:6060/debug/pprof/mutex
```
(For more info see https://pkg.go.dev/net/http/pprof)
---------
Co-authored-by: Alex Layne <alayne@redhat.com>
This commit introduces an optional value for the --redact flag, allowing
users to specify the extent of redaction for secrets. The valid range of
values is from 0 (no redaction) to 100 (full redaction).
If no value is provided, the default redaction value is set to 100,
resulting in complete redaction by replacing the secret with the term
'REDACTED'. This preserves the original behavior of the --redact flag.
Co-authored-by: Zachary Rice <zachary.rice@trufflesec.com>
* fix: ignore baseline if path was not relative in source
Signed-off-by: Raffael Sahli <raffael.sahli@doodle.com>
* test: ignore test secret
---------
Signed-off-by: Raffael Sahli <raffael.sahli@doodle.com>
* add --max-target-megabytes : maximum size for a file/blob to be scanned
* add --max-target-megabytes : maximum size for a file/blob to be scanned
* add --max-target-megabytes : maximum size for a file/blob to be scanned
* adjust readme comment
* fix on prem
* silence warning about unchecked errors
* go-fmt change to add newline
* Zerolog requires you to always call .Msg()
When logging with zerolog, you need to always end with .Msg(), even if
you just pass an empty string.
If you read the README on https://github.com/rs/zerolog, they write:
> It is very important to note that when using the zerolog
> chaining API, as shown above (log.Info().Msg("hello world"), the
> chain must have either the Msg or Msgf method call. If you
> forget to add either of these, the log will not occur and there
> is no compile time error to alert you of this.
* Create empty slice without literal
* Fix variable / package name collision with literal
instead of having a variable named "config", which collides with the
package name "config", just pass a literal config.Config{} struct to the
function
* Replace call to deprecated ioutil.ReadAll()
Use io.ReadAll() instead
* Check error when closing jsonFile
Make it a warning and log error
* Add baseline
* Update doc, add error, move baseline to detect namespace, ignore findings instead of reactively filter them out
* Update detect/detect.go
Co-authored-by: Zachary Rice <zricezrice@gmail.com>
* Update IsNew function (no check on tags - omit finger print check)
* Update README.md
Co-authored-by: Zachary Rice <zricezrice@gmail.com>
* Update examples in readme to make it ensure it's clear that a baseline is indeed a gitleaks report
* Fix test - updated tags doesn't make a finding new
* Add missing err assignment
* Allow scanner to continue without baseline if file is malformed
* Fix typo in comment
* Fix control flow err. (Real life testing)
* Fix wording
* Auto-ignore baseline path