Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for the [extend] file is wrong #1384

Open
drclark-dev opened this issue Apr 2, 2024 · 0 comments
Open

Documentation for the [extend] file is wrong #1384

drclark-dev opened this issue Apr 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@drclark-dev
Copy link

The documentation for [extend] config files states:

# Extend the base (this) configuration. When you extend a configuration
# the base rules take precedence over the extended rules. I.e., if there are
# duplicate rules in both the base configuration and the extended configuration
# the base rules will override the extended rules.

This seems counterintuitive because extensibility by definition adds to or modifies base functionality, and in fact after testing with an extend file that makes private-key just match on the substring toto I see that it does in fact override the base rules.

title = "Test extend"

[extend]
useDefault = true

[[rules]]
description = "test"
id = "private-key"
regex = '''toto'''

And using the extend file I get a match based on the extend rule, not the base rule.

gitleaks detect --no-git -v -c ..\gitleaks-extend.toml

    ○
    │╲
    │ ○
    ○ ░
    ░    gitleaks

Finding:     totoo
Secret:      toto
RuleID:      private-key
Entropy:     1.000000
File:        test.txt
Line:        1
Fingerprint: test.txt:private-key:1

11:02AM INF scan completed in 13.3ms
11:02AM WRN leaks found: 1

In my opinion this is the desired functionality for an extend rule, and the documentation should be corrected to reflect it.

@drclark-dev drclark-dev added the bug Something isn't working label Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant