Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/updater/diffdumps/rhelv2_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ func generateRHELv2VulnsDiff(cfg config, outputDir string, baseLastModifiedTime
if err := generateRHELv2RepoToCPE(filepath.Join(outputDir, repoToCPEFile), headF); err != nil {
return errors.Wrapf(err, "generating %s", repo2cpe.RHELv2CPERepoName)
}

// additional copy of repo to cpe JSON at bundle root (due to ROX-30576)
if err := generateRHELv2RepoToCPE(filepath.Join(outputDir, repo2cpe.RHELv2CPERepoName), headF); err != nil {
return errors.Wrapf(err, "generating %s at bundle root", repo2cpe.RHELv2CPERepoName)
}
}

// Only look at JSON files in the vulns/ folder.
Expand Down
11 changes: 11 additions & 0 deletions pkg/rhelv2/rhelv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,5 +245,16 @@ func updateRepoToCPE(outputDir string) (*repo2cpe.RHELv2MappingFile, error) {
return nil, errors.Wrapf(err, "encoding mapping")
}

// Also create copy at bundle root (due to ROX-30576)
outFRoot, err := os.Create(filepath.Join(outputDir, repo2cpe.RHELv2CPERepoName))
if err != nil {
return nil, errors.Wrapf(err, "failed to create file %q at bundle root", repo2cpe.RHELv2CPERepoName)
}
defer utils.IgnoreError(outFRoot.Close)

if err := json.NewEncoder(outFRoot).Encode(&mapping); err != nil {
return nil, errors.Wrapf(err, "encoding mapping at bundle root")
}

return &mapping, nil
}
2 changes: 2 additions & 0 deletions pkg/vulndump/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/mholt/archiver/v3"
"github.com/pkg/errors"
"github.com/stackrox/scanner/database"
"github.com/stackrox/scanner/pkg/repo2cpe"
)

// WriteZip takes the given files and creates the vuln dump zip.
Expand All @@ -25,6 +26,7 @@ func WriteZip(inputDir, outFile string, ignoreKubernetesVulns, ignoreRHELv2Vulns
}
if !ignoreRHELv2Vulns {
sources = append(sources, filepath.Join(inputDir, RHELv2DirName))
sources = append(sources, filepath.Join(inputDir, repo2cpe.RHELv2CPERepoName))
}
if !ignoreIstioVulns {
sources = append(sources, filepath.Join(inputDir, IstioDirName))
Expand Down
Loading