1
0
mirror of https://github.com/securego/gosec.git synced 2025-07-15 01:04:43 +02:00

Fix nosec when applied to a block

Handle properly nosec directive when applied to a block or as a single
line on a multi-line issue.

Signed-off-by: Cosmin Cojocar <cosmin@cojocar.ch>
This commit is contained in:
Cosmin Cojocar
2024-05-28 11:46:49 +01:00
parent ed3f51e663
commit ac75d44f56
3 changed files with 91 additions and 1 deletions

View File

@ -122,7 +122,7 @@ func (i ignores) get(file string, line string) map[string][]issue.SuppressionInf
start, end := i.parseLine(line)
if is, ok := i[file]; ok {
for _, i := range is {
if start <= i.start && end >= i.end {
if i.start <= start && i.end >= end || start <= i.start && end >= i.end {
return i.suppressions
}
}