Skip to content

Commit

Permalink
remove deletion of files
Browse files Browse the repository at this point in the history
Signed-off-by: Vivek Kumar Sahu <[email protected]>
  • Loading branch information
viveksahu26 committed Nov 29, 2024
1 parent 0047dbe commit 4196120
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
2 changes: 1 addition & 1 deletion pkg/compliance/bsiV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func bsiV2SbomSignature(doc sbom.Document) *db.Record {
valid, err := common.VerifySignature(pubKey, blob, sig)
if err != nil {
fmt.Printf("Verification failed: %v\n", err)
return db.NewRecordStmt(SBOM_SIGNATURE, "doc", "Verification failed", 0.0, "")
return db.NewRecordStmt(SBOM_SIGNATURE, "doc", "Verification failed!", 0.0, "")
}
if valid {
score = 10.0
Expand Down
12 changes: 0 additions & 12 deletions pkg/compliance/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,6 @@ func IsComponentPartOfPrimaryDependency(primaryCompDeps []string, comp string) b
}

func VerifySignature(publicKeyPath, sbomPath, signaturePath string) (bool, error) {
filesToDelete := []string{publicKeyPath, sbomPath, signaturePath}
defer DeleteFiles(filesToDelete)
pubKeyData, err := os.ReadFile(publicKeyPath)
if err != nil {
return false, err
Expand Down Expand Up @@ -427,16 +425,6 @@ func VerifySignature(publicKeyPath, sbomPath, signaturePath string) (bool, error
return true, err
}

func DeleteFiles(files []string) {
for _, file := range files {
if err := os.Remove(file); err != nil {
fmt.Printf("Error deleting file %s: %v\n", file, err)
} else {
fmt.Printf("Deleted file: %s\n", file)
}
}
}

func HashSBOM(sbomPath string) ([]byte, error) {
sbomData, err := os.ReadFile(sbomPath)
if err != nil {
Expand Down

0 comments on commit 4196120

Please sign in to comment.