Skip to content

Commit

Permalink
security: small code-improvements
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Kotzbauer <[email protected]>
  • Loading branch information
ckotzbauer committed Feb 6, 2023
1 parent 0815f33 commit 7ba0f9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/vuln/source/git/git_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func (g *GitSource) filterSboms(ignoreDirs, sbomFileNames []string) filepath.Wal
file := filepath.Base(p)
for _, f := range sbomFileNames {
if f == file {
/* #nosec */
content, err := os.ReadFile(p)
if err != nil {
logrus.WithError(err).Errorf("An error occurred while reading file %s", p)
Expand Down
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"net/http"
"runtime"
"time"

"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -41,7 +42,13 @@ func newRootCmd() *cobra.Command {
http.HandleFunc("/health", health)
http.Handle("/report/", http.StripPrefix("/report", fs))
http.Handle("/metrics", promhttp.Handler())
logrus.WithError(http.ListenAndServe(":8080", nil)).Fatal("Starting webserver failed!")

server := &http.Server{
Addr: ":8080",
ReadHeaderTimeout: 3 * time.Second,
}

logrus.WithError(server.ListenAndServe()).Fatal("Starting webserver failed!")
},
}

Expand Down

0 comments on commit 7ba0f9f

Please sign in to comment.