mirror of
https://github.com/securego/gosec.git
synced 2026-06-20 00:15:59 +02:00
feat: support path-based rule exclusions via exclude-rules (#1465)
* add path-based rule exclusions Implements #1287 * Ssupport for excluding specific rules from specific paths, enabling large monorepos to apply different security rules to different components (e.g., CLI tools vs services). * fix formatting issuue with path filter test to pass gci
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"global": {
|
||||
"audit": false,
|
||||
"nosec": false,
|
||||
"show-ignored": false
|
||||
},
|
||||
"G101": {
|
||||
"pattern": "(?i)passwd|pass|password|pwd|secret|private_key|token|api_key",
|
||||
"ignore_entropy": false,
|
||||
"entropy_threshold": "80.0",
|
||||
"per_char_threshold": "3.0",
|
||||
"truncate": "32"
|
||||
},
|
||||
"exclude-rules": [
|
||||
{
|
||||
"path": "cmd/.*",
|
||||
"rules": ["G204", "G304"]
|
||||
},
|
||||
{
|
||||
"path": "internal/testutil/.*",
|
||||
"rules": ["G101", "G401", "G501"]
|
||||
},
|
||||
{
|
||||
"path": "scripts/.*",
|
||||
"rules": ["*"]
|
||||
},
|
||||
{
|
||||
"path": ".*_test\\.go$",
|
||||
"rules": ["G101", "G304"]
|
||||
},
|
||||
{
|
||||
"path": "internal/(mock|fake|stub)s?/.*",
|
||||
"rules": ["*"]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user