* 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>
We should use `(*regexp.Regexp).MatchString` instead of
`(*regexp.Regexp).Match([]byte(...))` when matching string to avoid
unnecessary `[]byte` conversions and reduce allocations.
Example benchmark:
var pathRegex = regexp.MustCompile(".*.yaml")
func BenchmarkMatch(b *testing.B) {
for i := 0; i < b.N; i++ {
if match := pathRegex.Match([]byte("./config/deploy.yaml")); !match {
b.Fail()
}
}
}
func BenchmarkMatchString(b *testing.B) {
for i := 0; i < b.N; i++ {
if match := pathRegex.MatchString("./config/deploy.yaml"); !match {
b.Fail()
}
}
}
goos: linux
goarch: amd64
pkg: github.com/zricethezav/gitleaks/v8/detect
cpu: AMD Ryzen 7 PRO 4750U with Radeon Graphics
BenchmarkMatch-16 2167712 657.9 ns/op 24 B/op 1 allocs/op
BenchmarkMatchString-16 3275372 324.8 ns/op 0 B/op 0 allocs/op
PASS
ok github.com/zricethezav/gitleaks/v8/detect 3.436s
Signed-off-by: Eng Zer Jun <engzerjun@gmail.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