mirror of
https://github.com/securego/gosec.git
synced 2024-11-05 19:45:51 +00:00
Ensure ignores are handled properly for multi-line issues
Signed-off-by: Cosmin Cojocar <gcojocar@adobe.com>
This commit is contained in:
parent
6d56592f09
commit
3188e3fb8e
2 changed files with 33 additions and 1 deletions
|
@ -123,7 +123,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 i.start <= start && i.end >= end {
|
||||
if start <= i.start && end >= i.end {
|
||||
return i.suppressions
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1212,6 +1212,38 @@ func HelloServer(w http.ResponseWriter, r *http.Request) {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
`}, 0, gosec.NewConfig()},
|
||||
{[]string{`
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
hs *http.Server
|
||||
mux *http.ServeMux
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
func New(listenAddr string) *Server {
|
||||
mux := http.NewServeMux()
|
||||
|
||||
return &Server{
|
||||
hs: &http.Server{ // #nosec G112 - Not publicly exposed
|
||||
Addr: listenAddr,
|
||||
Handler: mux,
|
||||
},
|
||||
mux: mux,
|
||||
mu: sync.Mutex{},
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
fmt.Print("test")
|
||||
}
|
||||
`}, 0, gosec.NewConfig()},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue