-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
unmarshal exact - ensuring the config does not contain invalid values #815
Conversation
@zricethezav Please take a look at this PR, merging it should be straight forwards, and makes configuration much easier, because end users will know when they put invalid/unsupported keys in the config file. Thank you! |
@zricethezav any thoughts for this PR, thank you? |
56a5dd0
to
6661b03
Compare
@svyotov going to take a look at this soon. Sorry for the delay |
Hello @zricethezav! Do you have a verdict for this PR, will it be useful or should we close it? |
@svyotov I think I agree with these changes. UnmarshalExact will only throw an error if an extraneous or incorrect entry is discovered, not if one is missing right? For example, most of the rules do not contain |
I believe so, and also the tests indicate so (error when there was an extra key) and none of the old unit tests failed (some of them must be missing keys).
|
86ffb60
to
7829659
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Jit has detected 2 important findings in this PR that you should review.
The findings are detailed below as separate comments.
It’s highly recommended that you fix these security issues before merge.
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}''' | ||
tags = ["key", "AWS"] | ||
[rules.allowlist] | ||
regexes = ['''AKIALALEMEL33243OLIA'''] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security control: Secret Detection
Type: Aws-Access-Token
Description: AWS
Severity: HIGH
Jit Bot commands and options (e.g., ignore issue)
You can trigger Jit actions by commenting on this PR review:
#jit_ignore_fp
Ignore and mark this specific single instance of finding as “False Positive”#jit_ignore_accept
Ignore and mark this specific single instance of finding as “Accept Risk”#jit_undo_ignore
Undo ignore command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#jit_ignore_fp
RuleID: "aws-access-key", | ||
Allowlist: Allowlist{ | ||
Regexes: []*regexp.Regexp{ | ||
regexp.MustCompile("AKIALALEMEL33243OLIA"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security control: Secret Detection
Type: Aws-Access-Token
Description: AWS
Severity: HIGH
Jit Bot commands and options (e.g., ignore issue)
You can trigger Jit actions by commenting on this PR review:
#jit_ignore_fp
Ignore and mark this specific single instance of finding as “False Positive”#jit_ignore_accept
Ignore and mark this specific single instance of finding as “Accept Risk”#jit_undo_ignore
Undo ignore command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#jit_ignore_fp
Hello, I have re-based, added a test for missing keys, and made a change to the previous test to work with the new schema. |
@zricethezav please let me know if I need to do anything about the current failures in the CI. I do want to help get this in - if it is useful. |
To be clear though, this will be a breaking change, as anyone having invalid values in their config - values which up to now where ignored - will get errors from the tool, so the version change for this release should be minor |
closing this due to lack of interest/response. |
Description:
Fixes #811. This PR tries to ensure if there are extra invalid values in the git config to fail and not continue silently. Uses viper.UnmarshalExact which uses mapstructure.
Checklist: