Skip to content

Commit

Permalink
Upload vulnerability database issue #557 (#605)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramanan-ravi authored Oct 3, 2022
1 parent 2717611 commit 7589a5f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion deepfence_agent/plugins/SecretScanner
Submodule SecretScanner updated 3 files
+17 −0 MAINTAINERS.md
+9 −2 main.go
+66 −0 server/http.go
13 changes: 9 additions & 4 deletions deepfence_console/fetcher/fetcher-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ func handleVulnerabilityFeedTarUpload(respWrite http.ResponseWriter, req *http.R
return
}

if handler.Filename != filepath.Clean(handler.Filename) || !strings.HasPrefix(handler.Filename, "/data") {
if handler.Filename != filepath.Clean(handler.Filename) {
http.Error(respWrite, "Invalid request", http.StatusBadRequest)
return
}
Expand Down Expand Up @@ -619,14 +619,19 @@ func handleVulnerabilityFeedTarUpload(respWrite http.ResponseWriter, req *http.R
msg := "Complete"
if err != nil {
msg = "Error while extracting file: " + err.Error()
log.Println("updateVulnerabilityDb extractTarFile " + err.Error())
return
}
statusFile, statusFileErr := os.OpenFile(extractFolder+"/extract_status.txt", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
if statusFileErr == nil {
_, _ = statusFile.WriteString(msg)
statusFile.Close()
}
vulnerabilityDbUpdater.updateVulnerabilityDbListing()

err := vulnerabilityDbUpdater.updateVulnerabilityDbListing()
if err != nil {
log.Println("updateVulnerabilityDbListing " + err.Error())
return
}
// call mapper api to update grype db
updateVulnerabilityMapperDB()
}()
Expand Down Expand Up @@ -1497,7 +1502,7 @@ func main() {
log.Fatal(server.ListenAndServe())
}

//convertRootESIndexToCustomerSpecificESIndex : convert root ES index to customer specific ES index
// convertRootESIndexToCustomerSpecificESIndex : convert root ES index to customer specific ES index
func convertRootESIndexToCustomerSpecificESIndex(rootIndex string) string {
customerUniqueId := os.Getenv("CUSTOMER_UNIQUE_ID")
if customerUniqueId != "" {
Expand Down

0 comments on commit 7589a5f

Please sign in to comment.