@eurekadevsecops/radar 1.5.2 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scanners/depscan/about.toml +5 -0
- package/scanners/gitleaks/about.toml +5 -0
- package/scanners/grype/about.toml +5 -0
- package/scanners/{radar-sast → grype}/run.sh +1 -1
- package/scanners/opengrep/about.toml +5 -0
- package/src/commands/scan.js +2 -2
- package/src/plugins/scanners.js +40 -2
- package/src/telemetry/index.js +1 -1
- package/src/util/git/index.js +18 -1
- package/src/util/sarif/analysis/summarize.js +9 -7
- package/src/util/sarif/transforms/escalate.js +7 -5
- package/src/util/sarif/transforms/merge.js +5 -3
- package/src/util/sarif/transforms/normalize.js +26 -9
- package/depscan/depscan-universal.json +0 -1
- package/depscan/depscan.html +0 -31
- package/depscan/depscan.sarif +0 -70
- package/depscan/sbom-universal.json +0 -1
- package/depscan/sbom-universal.vdr.json +0 -20938
- package/depscan/scan.sarif +0 -70
- package/depscan-c1.sarif +0 -1
- package/depscan-c2.sarif +0 -1
- package/depscan.sarif +0 -70
- package/gitleaks-c1.sarif +0 -1
- package/gitleaks-c2.sarif +0 -1
- package/opengrep-c1.sarif +0 -1
- package/opengrep-c2.sarif +0 -1
- package/scanners/radar-sast/rules.yaml +0 -69031
- package/scanners/scanners.toml +0 -20
package/package.json
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
# $3 - Path to the output folder where scan results should be stored
|
|
5
5
|
|
|
6
6
|
set -e
|
|
7
|
-
|
|
7
|
+
docker run --rm -v $1:/app -v $2:/input -v $3:/output ghcr.io/eurekadevsecops/radar-grype 2>&1
|
package/src/commands/scan.js
CHANGED
|
@@ -150,8 +150,8 @@ module.exports = {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
// Send telemetry: git metadata.
|
|
153
|
+
const metadata = git.metadata(target)
|
|
153
154
|
if (telemetry.enabled && scanID) {
|
|
154
|
-
const metadata = git.metadata(target)
|
|
155
155
|
await telemetry.send(`scans/:scanID/metadata`, { scanID }, { metadata })
|
|
156
156
|
await telemetry.sendSensitive(`scans/:scanID/metadata`, { scanID }, { metadata })
|
|
157
157
|
}
|
|
@@ -173,7 +173,7 @@ module.exports = {
|
|
|
173
173
|
|
|
174
174
|
// Transform scan findings: treat warnings and notes as errors, and normalize location paths.
|
|
175
175
|
if (escalations) results.sarif = SARIF.transforms.escalate(results.sarif, escalations)
|
|
176
|
-
SARIF.transforms.normalize(results.sarif, target)
|
|
176
|
+
SARIF.transforms.normalize(results.sarif, target, metadata, git.root(target))
|
|
177
177
|
|
|
178
178
|
// Write findings to the destination SARIF file.
|
|
179
179
|
if (outfile) fs.writeFileSync(outfile, JSON.stringify(results.sarif))
|
package/src/plugins/scanners.js
CHANGED
|
@@ -2,8 +2,46 @@ const fs = require('node:fs')
|
|
|
2
2
|
const path = require('node:path')
|
|
3
3
|
const TOML = require('smol-toml')
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const
|
|
5
|
+
function enumerate(dir) {
|
|
6
|
+
const files = []
|
|
7
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true })
|
|
8
|
+
for (const entry of entries) {
|
|
9
|
+
if (entry.isDirectory()) {
|
|
10
|
+
const candidate = path.join(dir, entry.name, 'about.toml')
|
|
11
|
+
try {
|
|
12
|
+
const stat = fs.statSync(candidate)
|
|
13
|
+
if (stat.isFile()) {
|
|
14
|
+
files.push(candidate)
|
|
15
|
+
}
|
|
16
|
+
} catch {
|
|
17
|
+
// no about.toml in this subfolder — ignore
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return files
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function parseTOML(filePath) {
|
|
25
|
+
const text = fs.readFileSync(filePath, "utf8")
|
|
26
|
+
try {
|
|
27
|
+
return TOML.parse(text)
|
|
28
|
+
} catch (error) {
|
|
29
|
+
const rel = path.relative(process.cwd(), filePath)
|
|
30
|
+
throw new Error(`Failed to parse TOML at ${rel}: ${error.message}`)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function readConfig(dir) {
|
|
35
|
+
const scanners = []
|
|
36
|
+
const files = enumerate(dir)
|
|
37
|
+
for (const file of files) {
|
|
38
|
+
const scanner = parseTOML(file)
|
|
39
|
+
scanners.push(scanner)
|
|
40
|
+
}
|
|
41
|
+
return { scanners }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const config = readConfig(path.join(__dirname, '..', '..', 'scanners'))
|
|
7
45
|
const categories = Array.from(new Set(config.scanners.flatMap(scanner => scanner.categories)))
|
|
8
46
|
|
|
9
47
|
module.exports = {
|
package/src/telemetry/index.js
CHANGED
|
@@ -9,7 +9,7 @@ class Telemetry {
|
|
|
9
9
|
|
|
10
10
|
constructor() {
|
|
11
11
|
this.enabled = !!this.#EUREKA_AGENT_TOKEN
|
|
12
|
-
this.#EWA_URL = this.#claims(this.#EUREKA_AGENT_TOKEN)
|
|
12
|
+
this.#EWA_URL = this.#claims(this.#EUREKA_AGENT_TOKEN)?.aud?.replace(/\/$/, '')
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
async send(path, params, body, token) {
|
package/src/util/git/index.js
CHANGED
|
@@ -84,6 +84,23 @@ git rev-list --abbrev=4 --abbrev-commit --all | \
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
function root(folder) {
|
|
88
|
+
try {
|
|
89
|
+
// Get the full OS path to the root of the repo.
|
|
90
|
+
const root = execSync('git rev-parse --show-toplevel', { cwd: folder }).toString().trim()
|
|
91
|
+
return root
|
|
92
|
+
} catch (error) {
|
|
93
|
+
return {
|
|
94
|
+
type: 'error',
|
|
95
|
+
error: {
|
|
96
|
+
code: 'E_GIT_METADATA',
|
|
97
|
+
details: error
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
87
103
|
module.exports = {
|
|
88
|
-
metadata
|
|
104
|
+
metadata,
|
|
105
|
+
root
|
|
89
106
|
}
|
|
@@ -20,14 +20,16 @@ module.exports = (sarif, dir) => {
|
|
|
20
20
|
continue
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
if (Array.isArray(run?.tool?.driver?.rules)) {
|
|
24
|
+
for (const rule of run.tool.driver.rules) {
|
|
25
|
+
if (rule.id === result.ruleId) {
|
|
26
|
+
const level = rule?.defaultConfiguration?.level ?? 'error'
|
|
27
|
+
if (level === 'error' || level === 'warning' || level === 'note') {
|
|
28
|
+
finding.level = level
|
|
29
|
+
summary[`${finding.level}s`].push(finding)
|
|
30
|
+
}
|
|
31
|
+
break
|
|
29
32
|
}
|
|
30
|
-
break
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
}
|
|
@@ -8,12 +8,14 @@ module.exports = (sarif, escalations) => {
|
|
|
8
8
|
continue
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (
|
|
14
|
-
rule.defaultConfiguration
|
|
11
|
+
if (Array.isArray(run?.tool?.driver?.rules)) {
|
|
12
|
+
for (const rule of run.tool.driver.rules) {
|
|
13
|
+
if (rule.id === result.ruleId) {
|
|
14
|
+
if (escalations.includes(rule.defaultConfiguration?.level)) {
|
|
15
|
+
rule.defaultConfiguration.level = 'error'
|
|
16
|
+
}
|
|
17
|
+
break
|
|
15
18
|
}
|
|
16
|
-
break
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
}
|
|
@@ -41,9 +41,11 @@ module.exports = async (outfile, files) => {
|
|
|
41
41
|
rules.set(result.ruleId, true)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
if (Array.isArray(run?.tool?.driver?.rules)) {
|
|
45
|
+
for (const rule of run.tool.driver.rules) {
|
|
46
|
+
if (rules.has(rule.id)) {
|
|
47
|
+
tool.driver.rules.push(rule)
|
|
48
|
+
}
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
51
|
|
|
@@ -1,18 +1,35 @@
|
|
|
1
1
|
const path = require('node:path')
|
|
2
|
-
module.exports = (sarif, dir) => {
|
|
2
|
+
module.exports = (sarif, dir, git, root) => {
|
|
3
3
|
// Normalize findings.
|
|
4
4
|
for (const run of sarif.runs) {
|
|
5
|
-
if (!run.results) continue
|
|
6
|
-
for (const result of run.results) {
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
// Record the source repo location and the relative target subfolder within the repo.
|
|
7
|
+
run.originalUriBaseIds = {
|
|
8
|
+
"SOURCE": {
|
|
9
|
+
"uri": git.repo.url.https,
|
|
10
|
+
"description": "Source origin for the target being scanned (ie. git repo URL)."
|
|
11
|
+
},
|
|
12
|
+
"TARGET": {
|
|
13
|
+
"uri": `${path.relative(root, dir)}`,
|
|
14
|
+
"uriBaseId": "SOURCE",
|
|
15
|
+
"description": "Scan target (subfolder) within the source repo or folder."
|
|
16
|
+
}
|
|
17
|
+
}
|
|
10
18
|
|
|
11
|
-
|
|
19
|
+
// Make all physical locations for the result relative to the scan directory.
|
|
20
|
+
if (!run.results) continue
|
|
21
|
+
for (const result of run.results) {
|
|
12
22
|
for (const location of result.locations) {
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
23
|
+
if (location.physicalLocation?.artifactLocation?.uri?.startsWith('/app')) {
|
|
24
|
+
let file = path.relative('/app', location.physicalLocation.artifactLocation.uri)
|
|
25
|
+
if (result?.message?.text) result.message.text = result.message.text.replace(location.physicalLocation.artifactLocation.uri, file)
|
|
26
|
+
location.physicalLocation.artifactLocation.uri = file
|
|
27
|
+
}
|
|
28
|
+
else if (location.physicalLocation?.artifactLocation?.uri?.startsWith('/')) {
|
|
29
|
+
let file = path.relative('/', location.physicalLocation.artifactLocation.uri)
|
|
30
|
+
if (result?.message?.text) result.message.text = result.message.text.replace(location.physicalLocation.artifactLocation.uri, file)
|
|
31
|
+
location.physicalLocation.artifactLocation.uri = file
|
|
32
|
+
}
|
|
16
33
|
}
|
|
17
34
|
|
|
18
35
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id": "CVE-2022-33987", "package": "npm:got", "purl": "pkg:npm/got@9.6.0", "package_type": "npm", "package_usage": "optional", "version": "9.6.0", "fix_version": "11.8.5", "severity": "MEDIUM", "cvss_score": "5.3", "short_description": "# Got allows a redirect to a UNIX socket\nThe got package before 11.8.5 and 12.1.0 for Node.js allows a redirect to a UNIX socket.\nUpgrade to version 11.8.5 or later", "related_urls": [], "occurrence_count": 0, "reachable_flows": 0}
|
package/depscan/depscan.html
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<style>
|
|
6
|
-
.r1 {font-style: italic}
|
|
7
|
-
.r2 {color: #800080; text-decoration-color: #800080; font-weight: bold}
|
|
8
|
-
.r3 {color: #7c8082; text-decoration-color: #7c8082; font-style: italic}
|
|
9
|
-
.r4 {color: #00875f; text-decoration-color: #00875f}
|
|
10
|
-
.r6 {color: #ff753d; text-decoration-color: #ff753d; font-weight: bold}
|
|
11
|
-
body {
|
|
12
|
-
color: #000000;
|
|
13
|
-
background-color: #ffffff;
|
|
14
|
-
}
|
|
15
|
-
</style>
|
|
16
|
-
</head>
|
|
17
|
-
<body>
|
|
18
|
-
<pre style="font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"><code style="font-family:inherit">
|
|
19
|
-
<span class="r1"> Dependency Scan Results (UNIVERSAL) </span>
|
|
20
|
-
╔══════════════════════════════════════════════════════╤════════════════════════════════════════╤══════════════════════╤═════════════════╤═══════════╗
|
|
21
|
-
║<span class="r2"> Dependency Tree </span>│<span class="r2"> Insights </span>│<span class="r2"> Fix Version </span>│<span class="r2"> Severity </span>│<span class="r2"> Score </span>║
|
|
22
|
-
╟──────────────────────────────────────────────────────┼────────────────────────────────────────┼──────────────────────┼─────────────────┼───────────╢
|
|
23
|
-
║ <span class="r3">package-json@6.5.0 </span> │ <span class="r4">📓 Indirect dependency</span> │ 11.8.5 │ MEDIUM │ 5.3 ║
|
|
24
|
-
║ <span class="r5">└── </span><span class="r6">got@9.6.0 ⬅ CVE-2022-33987 </span> │ │ │ │ ║
|
|
25
|
-
╚══════════════════════════════════════════════════════╧════════════════════════════════════════╧══════════════════════╧═════════════════╧═══════════╝
|
|
26
|
-
╭─────────────────────────────────────────────────────────── Recommendation ───────────────────────────────────────────────────────────╮
|
|
27
|
-
│ ✅ No package requires immediate attention since the major vulnerabilities are found only in dev packages and indirect dependencies. │
|
|
28
|
-
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
|
29
|
-
</code></pre>
|
|
30
|
-
</body>
|
|
31
|
-
</html>
|
package/depscan/depscan.sarif
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "2.1.0",
|
|
3
|
-
"$schema": "https://json.schemastore.org/sarif-2.1.0.json",
|
|
4
|
-
"runs": [
|
|
5
|
-
{
|
|
6
|
-
"tool": {
|
|
7
|
-
"driver": {
|
|
8
|
-
"name": "owasp-depscan",
|
|
9
|
-
"semanticVersion": "5.5.0",
|
|
10
|
-
"informationUri": "https://github.com/owasp-dep-scan/dep-scan",
|
|
11
|
-
"properties": {
|
|
12
|
-
"protocol_version": "v1.0.0",
|
|
13
|
-
"scanner_name": "owasp-depscan",
|
|
14
|
-
"scanner_version": "5.5.0",
|
|
15
|
-
"db": "https://github.com/AppThreat/vulnerability-db",
|
|
16
|
-
"scan_mode": "source"
|
|
17
|
-
},
|
|
18
|
-
"rules": [
|
|
19
|
-
{
|
|
20
|
-
"id": "CVE-2022-33987/pkg:npm/got@9.6.0",
|
|
21
|
-
"shortDescription": {
|
|
22
|
-
"text": "Vulnerable pkg: npm/got@9.6.0\nCVE: CVE-2022-33987\nFix: Update to 11.8.5 or later\n\ndepscan:insights: Indirect dependency\ndepscan:prioritized: false\naffectedVersionRange: got@<11.8.5\n"
|
|
23
|
-
},
|
|
24
|
-
"fullDescription": {
|
|
25
|
-
"text": "# Got allows a redirect to a UNIX socket\nThe got package before 11.8.5 and 12.1.0 for Node.js allows a redirect to a UNIX socket.\nUpgrade to version 11.8.5 or later"
|
|
26
|
-
},
|
|
27
|
-
"help": {
|
|
28
|
-
"text": "Update to 11.8.5 or later"
|
|
29
|
-
},
|
|
30
|
-
"helpUri": "https://nvd.nist.gov/vuln/detail/CVE-2022-33987",
|
|
31
|
-
"properties": {
|
|
32
|
-
"tags": [
|
|
33
|
-
"CVE-2022-33987"
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"results": [
|
|
42
|
-
{
|
|
43
|
-
"ruleId": "CVE-2022-33987/pkg:npm/got@9.6.0",
|
|
44
|
-
"level": "warning",
|
|
45
|
-
"message": {
|
|
46
|
-
"text": "Vulnerability CVE-2022-33987 in pkg npm/got@9.6.0. Update to 11.8.5 or later"
|
|
47
|
-
},
|
|
48
|
-
"locations": [
|
|
49
|
-
{
|
|
50
|
-
"physicalLocation": {
|
|
51
|
-
"artifactLocation": {
|
|
52
|
-
"uri": "package-lock.json",
|
|
53
|
-
"uriBaseId": "%SRCROOT%"
|
|
54
|
-
},
|
|
55
|
-
"region": {
|
|
56
|
-
"startLine": 1
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"message": {
|
|
60
|
-
"text": "Vulnerability CVE-2022-33987 in pkg npm/got@9.6.0. Update to 11.8.5 or later"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
}
|