* 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>
* Add initial percent decoding support
* Refactor multi encoding support
* Add detect tests to confirm positions
* Avoid a few extra passes during decoding
* Do multiple passes for finding encodings re
* Fix issue with overlapping encodings when doing separate passes
* Ensure keywords are downcased
* Update tests
* Remove unnecessary code
* Add msg to test expectation
* Update the keywords as we iterate through them
* Remove unnecessary to lower
---------
Co-authored-by: Craig Smith <5344211-craigmsmith@users.noreply.gitlab.com>
* Reimplement the ability to override built-in rules
PR #1524 broke the ability to specify a `[[rules]]` with the same ID as
a built-in rule in order to extend the default configuration.
This PR restores this ability, but merges the provided configuration
with the default rule instead of overwriting the default rule wholesale.
* Add tests
* Append keywords and tags
* Support base64 decoding during scans
rh-pre-commit.version: 2.3.1
rh-pre-commit.check-secrets: ENABLED
* Add failing tests for the case when the match starts outside the decoded value
* Align locations for overlapping, encoded matches
rh-pre-commit.version: 2.3.1
rh-pre-commit.check-secrets: ENABLED
* Add --max-decode-depth flag and update README help output
rh-pre-commit.version: 2.3.1
rh-pre-commit.check-secrets: ENABLED
* Move keywords off of fragment
rh-pre-commit.version: 2.3.1
rh-pre-commit.check-secrets: ENABLED
* Fix comment typo
rh-pre-commit.version: 2.3.1
rh-pre-commit.check-secrets: ENABLED
* Refactor how keywords are used in detect
rh-pre-commit.version: 2.3.1
rh-pre-commit.check-secrets: ENABLED
* Clarify comments and rename method to match
rh-pre-commit.version: 2.3.1
rh-pre-commit.check-secrets: ENABLED
* Improve performance
rh-pre-commit.version: 2.3.1
rh-pre-commit.check-secrets: ENABLED
* Fix issues after rebase
Only adjust matchIndex to fix the following line issue when not working
with encoded segments since they handle adjusting the index themselves.
rh-pre-commit.version: 2.3.1
rh-pre-commit.check-secrets: ENABLED
* Update detect/decoder.go
Don't escape characters that don't need escaping
Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com>
* Update flag help text
rh-pre-commit.version: 2.3.1
rh-pre-commit.check-secrets: ENABLED
* Add meta data tags from decoding
rh-pre-commit.version: 2.3.1
rh-pre-commit.check-secrets: ENABLED
---------
Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com>
* fix: use regexTarget for extend config
* fix: add keywords from base and extended rule into global keywords list
* docs: add an example to extend default rules
* chore: update project URL references
* Remove IAM identifiers for non-credential resources
Only detects:
AWS STS service bearer token
Context-specific credential
Access key
Temporary (AWS STS) access key IDs use this prefix, but are unique only in combination with the secret access key and the session token.
* Update gitleaks.toml
* Update testdata
* Update tests
* 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
* Add sidekiq rules
* Added two new rules for sidekiq
* Other: Add keywords to square rules per Zach's instructions
* Validate now works, but test suite is failing
* Tests are now passing
* Add Sidekiq Rules: Ran go fmt
* * After resolving conflicts, had to rerun the rule generator to add back the semicolon char
* After running tests, had to fix one line in testdata/expected/report/sarif_simple.sarif
* * Added keywords to simple.toml for sidekiq-sensitive-url so that the rule matches what is in gitleaks.toml
Co-authored-by: Andrew Weiner <aweiner@frontrush.com>
* init
* working on default and path config extensions
* adding trace log level, consolidating some code
* cleaning things up, updating generate package
* fix tests
* formatting
* adding tests for extend
* extend not extends
* formatting
* only allow usedefault or path to be set
* update readme
* add note about allowlists
* more readme, expand env var for path
* actually dont support env var. ez attack
* gitlab pats may contain underscores as well as dashes
* include testdata index binary
Co-authored-by: Greg Johnson (codeEmitter) <gjohnson@gitlab.com>
* build: remove `GO111MODULE` as it turned on by default
Signed-off-by: Rui Chen <rui@chenrui.dev>
* build: update for go1.17
* run test
Signed-off-by: Rui Chen <rui@chenrui.dev>
* lint: remove unused code