Skip to content

Commit

Permalink
Merge pull request Checkmarx#6535 from Checkmarx/kics-896
Browse files Browse the repository at this point in the history
fix(inspector): Change regex special mask
  • Loading branch information
asofsilva authored Jul 28, 2023
2 parents 2373004 + b939efc commit 962a078
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion assets/queries/common/passwords_and_secrets/regex_rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@
"regex": "['\"]?(?i)heroku((.|\\n)*)\\b([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})\\b['\"]?",
"multiline": {
"detectLineGroup": 3
}
},
"specialMask": "['\"]?(?i)api_key[^\\w\"']+"
},
{
"id": "bb51eb1e-0357-44a2-86d7-dd5350cffd43",
Expand Down
2 changes: 1 addition & 1 deletion pkg/engine/secrets/inspector.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ func hideSecret(linesVuln *model.VulnerabilityLines,
regex := query.RegexStr

if len(query.SpecialMask) > 0 {
regex = "(.+)" + query.SpecialMask // get key
regex = "(.*)" + query.SpecialMask // get key
}

var re = regexp.MustCompile(regex)
Expand Down

0 comments on commit 962a078

Please sign in to comment.