* 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
Because `segment.adjustMatchIndex(matchIndex)` was above
`segment.lineEndIndex(currentRaw, matchIndex[1]-matchIndex[0])` there
were cases where it would cause an out of bounds error.
This change resolves the issue by just assuming the whole segment is a
opaque chunk of text and starts at the boundaries of the segment instead
so that the order doesn't matter as much.
The other option would have been to reorder the assignments and add
tests to account for that case, but I figured this option is less likely
to have gotchas when working with different encoding formats at the
potential expense of getting an extra line or two if an encoding format
in the future ever allows multiple lines of encoded content to be
considered a single segment.
* feat: add support for Azure DevOps platform in SCM detection and link generation
* feat: add support for visualstudio.com in Azure DevOps platform detection
* feat: consolidate Azure DevOps platform detection for dev.azure.com and visualstudio.com
* feat: add option to set config from env var with toml content
* Update README.md
Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com>
* fix: check if config provided by GITLEAKS_CONFIG_TOML can be loaded
* docs: move load configuration section to have it before configuration
---------
Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com>
* fix: make config template work when providing non-iota values for MatchCondition
https://pkg.go.dev/text/template#hdr-Actions
> {{with pipeline}} T1 {{end}}
> If the value of the pipeline is empty, no output is generated;
> otherwise, dot is set to the value of the pipeline and T1 is
> executed.
Within the `with` block `.MatchCondition` is implicit and must be omitted to
work. The fault/bug was not triggered before because this is the first
non-default MatchCondition apparently.
* feat: exclude false positive matches for Yocto/Bitbake from generic-api-key rule
Fixes#1775
This eliminates golang.org/x/text@v0.3.0 from the dependency chain, which is associated with a critical CVE that can cause Gitleaks to be flagged in regulated environments.