fix: line content for repeated secrets and 10K byte lines - #399
fix: line content for repeated secrets and 10K byte lines#399cx-diogo-rocha wants to merge 7 commits into
Conversation
| return rules.GetDefaultRules(includeDeprecated) | ||
| } | ||
|
|
||
| func GetRegexSuffix() string { return ruledefine.SecretSuffix } |
There was a problem hiding this comment.
| func GetRegexSuffix() string { return ruledefine.SecretSuffix } | |
| func GetRegexSuffix() string { | |
| return ruledefine.SecretSuffix | |
| } |
| adjustedEndColumn-- | ||
| } | ||
|
|
||
| lineContent, err := linecontent.GetLineContent(value.Line, value.Secret, adjustedStartColumn) |
There was a problem hiding this comment.
If hasNewline == true, both adjustedStartColumn and adjustedEndColumn will be reduced by 1. However, line 553 might remove multiple \r characters and that isn't being accounted for in the same way as \n. This previously wasn't used for linecontent.GetLineContent, but now that it is, won't this cause issues if \r characters are removed without correcting adjustedStartColumn ?
There was a problem hiding this comment.
\r should only happen in Windows new lines and in that case adjusting the columns would break the secret position. For example
api_key=\r\n
integration_api_key_prod_abc123def456
Has endColumn 37 (on second line), and this is true with or without the presence of \r. But if we adjust the EndColumn with removal of \r, it would be 36 and become incorrect
Closes #
Proposed Changes
Fixes to line content on these cases:
Checklist
I submit this contribution under the Apache-2.0 license.