Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip EAP Jetbrains editions in Vuln processing #23400

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions changes/22723-intellij-EAP
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- added translation rule to skip EAP versions of Jetbrains products in vulnerability processing
11 changes: 11 additions & 0 deletions server/vulnerabilities/nvd/cpe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,17 @@ func TestCPEFromSoftwareIntegration(t *testing.T) {
},
cpe: "cpe:2.3:a:jetbrains:intellij_idea:2023.3.2.233.13135.103:*:*:*:*:macos:*:*",
},
{
// Skip EAP JebBrains products
software: fleet.Software{
Name: "IntelliJ IDEA 2024.3 EAP.app",
Source: "apps",
Version: "EAP IU-242.16677.21",
Vendor: "",
BundleIdentifier: "com.jetbrains.intellij-EAP",
},
cpe: "",
},
{
software: fleet.Software{
Name: "User PyCharm Custom Name.app", // 2023/10/31: The actual product name must be part of the app name per our code in CPEFromSoftware
Expand Down
8 changes: 8 additions & 0 deletions server/vulnerabilities/nvd/cpe_translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@
"vendor": ["flock"]
}
},
{
"software": {
"bundle_identifier": ["/^com.jetbrains.*EAP/"]
},
"filter": {
"skip": true
}
},
{
"software": {
"bundle_identifier": ["/^com\\.jetbrains\\.intellij/"],
Expand Down
30 changes: 30 additions & 0 deletions tools/nvd/nvdvuln/nvdvuln.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"flag"
"fmt"
"io"
"os"
"path/filepath"
"sort"
Expand Down Expand Up @@ -305,6 +306,35 @@ func vulnDBSync(vulnDBDir string, debug bool, logger log.Logger) error {
if err != nil {
return err
}

// copy dev CPE Translations file
src := "./server/vulnerabilities/nvd/cpe_translations.json"
dst := filepath.Join(vulnDBDir, "cpe_translations.json")
if err := copyFile(src, dst); err != nil {
return err
}

return nil
}

func copyFile(src, dst string) error {
srcFile, err := os.Open(src)
if err != nil {
return err
}
defer srcFile.Close()

dstFile, err := os.Create(dst)
if err != nil {
return err
}
defer dstFile.Close()

_, err = io.Copy(dstFile, srcFile)
if err != nil {
return err
}

return nil
}

Expand Down
Loading