gosec: allow global
config (#2880)
This commit is contained in:
parent
8d2eb67e4f
commit
c531fc2ad5
@ -797,6 +797,20 @@ linters-settings:
|
||||
|
||||
# To specify the configuration of rules.
|
||||
config:
|
||||
# Globals are applicable to all rules.
|
||||
global:
|
||||
# If true, ignore #nosec in comments (and an alternative as well).
|
||||
# Default: false
|
||||
nosec: true
|
||||
# Add an alternative comment prefix to #nosec (both will work at the same time).
|
||||
# Default: ""
|
||||
"#nosec": "#my-custom-nosec"
|
||||
# Define whether nosec issues are counted as finding or not.
|
||||
# Default: false
|
||||
show-ignored: true
|
||||
# Audit mode enables addition checks that for normal code analysis might be too nosy.
|
||||
# Default: false
|
||||
audit: true
|
||||
G101:
|
||||
# Regexp pattern for variables and constants to find.
|
||||
# Default: "(?i)passwd|pass|password|pwd|secret|token|pw|apiKey|bearer|cred"
|
||||
|
@ -34,9 +34,12 @@ func NewGosec(settings *config.GoSecSettings) *goanalysis.Linter {
|
||||
filters = gosecRuleFilters(settings.Includes, settings.Excludes)
|
||||
|
||||
for k, v := range settings.Config {
|
||||
// Uses ToUpper because the parsing of the map's key change the key to lowercase.
|
||||
// The value is not impacted by that: the case is respected.
|
||||
conf.Set(strings.ToUpper(k), v)
|
||||
if k != gosec.Globals {
|
||||
// Uses ToUpper because the parsing of the map's key change the key to lowercase.
|
||||
// The value is not impacted by that: the case is respected.
|
||||
k = strings.ToUpper(k)
|
||||
}
|
||||
conf.Set(k, v)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user