@openai/codex-security 0.7.0 → 0.8.1
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/README.md +18 -12
- package/_bundled_plugin/.codex-plugin/plugin.json +1 -0
- package/_bundled_plugin/examples/completed-scan/findings.json +34 -34
- package/_bundled_plugin/examples/completed-scan/report.md +22 -31
- package/_bundled_plugin/examples/completed-scan/scan-manifest.json +27 -29
- package/_bundled_plugin/examples/{completed-scan → legacy-completed-scan}/coverage.json +1 -0
- package/_bundled_plugin/examples/legacy-completed-scan/findings.json +57 -0
- package/_bundled_plugin/examples/legacy-completed-scan/report.md +98 -0
- package/_bundled_plugin/examples/legacy-completed-scan/scan-manifest.json +43 -0
- package/_bundled_plugin/mcp/helpers.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/helpers.mjs.br.part-001 +0 -0
- package/_bundled_plugin/mcp/native/win32-arm64/windows.node +0 -0
- package/_bundled_plugin/mcp/native/win32-x64/windows.node +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-002 +0 -0
- package/_bundled_plugin/references/core-scan.md +2 -2
- package/_bundled_plugin/references/final-report.md +16 -6
- package/_bundled_plugin/references/scan-artifacts.md +6 -6
- package/_bundled_plugin/references/scan-contract.md +10 -12
- package/_bundled_plugin/references/threat-model.md +1 -1
- package/_bundled_plugin/schemas/scan-manifest.schema.json +36 -11
- package/_bundled_plugin/schemas/tools/scan-draft.schema.json +5 -5
- package/_bundled_plugin/scripts/deep_scan_workbench.py +1 -1
- package/_bundled_plugin/scripts/finalize_scan_contract.py +97 -20
- package/_bundled_plugin/scripts/report_projection.py +5 -2
- package/_bundled_plugin/scripts/review_state.py +68 -0
- package/_bundled_plugin/scripts/servicenow_avit.py +107 -0
- package/_bundled_plugin/scripts/validate_scan_contract.py +1 -2
- package/_bundled_plugin/scripts/workbench/retained_coverage.py +49 -37
- package/_bundled_plugin/scripts/workbench/retained_records.py +7 -7
- package/_bundled_plugin/scripts/workbench/saved_coverage.py +15 -15
- package/_bundled_plugin/scripts/workbench/saved_sources.py +24 -6
- package/_bundled_plugin/scripts/workbench_constants.py +0 -1
- package/_bundled_plugin/scripts/workbench_coverage_receipts.py +4 -4
- package/_bundled_plugin/scripts/workbench_db.py +5 -150
- package/_bundled_plugin/scripts/workbench_saved_results.py +169 -4
- package/_bundled_plugin/scripts/workbench_scan_history.py +12 -7
- package/_bundled_plugin/scripts/workbench_scan_start.py +4 -1
- package/_bundled_plugin/skills/publish-findings/SKILL.md +9 -3
- package/_bundled_plugin/skills/security-diff-scan/SKILL.md +1 -1
- package/_bundled_plugin/skills/security-scan/SKILL.md +7 -7
- package/_bundled_plugin/skills/track-findings/SKILL.md +1 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +50 -27
- package/dist/api.js.map +1 -1
- package/dist/artifact-export.d.ts +12 -3
- package/dist/artifact-export.d.ts.map +1 -1
- package/dist/artifact-export.js +30 -10
- package/dist/artifact-export.js.map +1 -1
- package/dist/cli-help.d.ts.map +1 -1
- package/dist/cli-help.js +1 -0
- package/dist/cli-help.js.map +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +69 -55
- package/dist/cli.js.map +1 -1
- package/dist/cloud-publish.d.ts.map +1 -1
- package/dist/cloud-publish.js +2 -23
- package/dist/cloud-publish.js.map +1 -1
- package/dist/contract.d.ts +4 -2
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +39 -21
- package/dist/contract.js.map +1 -1
- package/dist/custom-publish.js +2 -2
- package/dist/custom-publish.js.map +1 -1
- package/dist/custom-validation-prompt.d.ts.map +1 -1
- package/dist/custom-validation-prompt.js +14 -6
- package/dist/custom-validation-prompt.js.map +1 -1
- package/dist/custom-validation.d.ts.map +1 -1
- package/dist/custom-validation.js +17 -15
- package/dist/custom-validation.js.map +1 -1
- package/dist/deduplication/codex-review.d.ts.map +1 -1
- package/dist/deduplication/codex-review.js +2 -2
- package/dist/deduplication/codex-review.js.map +1 -1
- package/dist/deduplication/deduplication-prompts.d.ts +1 -0
- package/dist/deduplication/deduplication-prompts.d.ts.map +1 -1
- package/dist/deduplication/deduplication-prompts.js +3 -0
- package/dist/deduplication/deduplication-prompts.js.map +1 -1
- package/dist/deduplication/records-protocol.d.ts.map +1 -1
- package/dist/deduplication/records-protocol.js +21 -1
- package/dist/deduplication/records-protocol.js.map +1 -1
- package/dist/deduplication/scan.d.ts.map +1 -1
- package/dist/deduplication/scan.js +2 -2
- package/dist/deduplication/scan.js.map +1 -1
- package/dist/external-findings-local.d.ts +1 -0
- package/dist/external-findings-local.d.ts.map +1 -1
- package/dist/external-findings-local.js +25 -2
- package/dist/external-findings-local.js.map +1 -1
- package/dist/external-findings-publish.d.ts +1 -0
- package/dist/external-findings-publish.d.ts.map +1 -1
- package/dist/external-findings-publish.js +55 -26
- package/dist/external-findings-publish.js.map +1 -1
- package/dist/external-findings-read.d.ts +1 -0
- package/dist/external-findings-read.d.ts.map +1 -1
- package/dist/external-findings-read.js +10 -0
- package/dist/external-findings-read.js.map +1 -1
- package/dist/external-findings.d.ts +2 -0
- package/dist/external-findings.d.ts.map +1 -1
- package/dist/external-findings.js.map +1 -1
- package/dist/external-import-contract.d.ts +4 -0
- package/dist/external-import-contract.d.ts.map +1 -1
- package/dist/external-import-contract.js +34 -10
- package/dist/external-import-contract.js.map +1 -1
- package/dist/finding-workflow.d.ts +2 -0
- package/dist/finding-workflow.d.ts.map +1 -1
- package/dist/finding-workflow.js +3 -0
- package/dist/finding-workflow.js.map +1 -1
- package/dist/github-advisories.d.ts.map +1 -1
- package/dist/github-advisories.js +5 -5
- package/dist/github-advisories.js.map +1 -1
- package/dist/github-dependabot-findings.d.ts +6 -0
- package/dist/github-dependabot-findings.d.ts.map +1 -0
- package/dist/github-dependabot-findings.js +247 -0
- package/dist/github-dependabot-findings.js.map +1 -0
- package/dist/github-findings.d.ts.map +1 -1
- package/dist/github-findings.js +11 -4
- package/dist/github-findings.js.map +1 -1
- package/dist/github-identifiers.d.ts +4 -0
- package/dist/github-identifiers.d.ts.map +1 -0
- package/dist/github-identifiers.js +9 -0
- package/dist/github-identifiers.js.map +1 -0
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +4 -6
- package/dist/github.js.map +1 -1
- package/dist/host-protocol.d.ts +1 -1
- package/dist/host-protocol.d.ts.map +1 -1
- package/dist/host-protocol.js +2 -2
- package/dist/host-protocol.js.map +1 -1
- package/dist/hosted-scan.d.ts.map +1 -1
- package/dist/hosted-scan.js +13 -6
- package/dist/hosted-scan.js.map +1 -1
- package/dist/import-scan.js +16 -16
- package/dist/import-scan.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/knowledge-base.js +3 -0
- package/dist/knowledge-base.js.map +1 -1
- package/dist/mock-scan.d.ts +1 -2
- package/dist/mock-scan.d.ts.map +1 -1
- package/dist/mock-scan.js +12 -17
- package/dist/mock-scan.js.map +1 -1
- package/dist/models.d.ts +9 -1
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js.map +1 -1
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +1 -6
- package/dist/multiscan.js.map +1 -1
- package/dist/native-json-findings.d.ts +30 -0
- package/dist/native-json-findings.d.ts.map +1 -0
- package/dist/native-json-findings.js +114 -0
- package/dist/native-json-findings.js.map +1 -0
- package/dist/opengrep-findings.d.ts +10 -0
- package/dist/opengrep-findings.d.ts.map +1 -0
- package/dist/opengrep-findings.js +198 -0
- package/dist/opengrep-findings.js.map +1 -0
- package/dist/patch-tui.d.ts.map +1 -1
- package/dist/patch-tui.js +2 -0
- package/dist/patch-tui.js.map +1 -1
- package/dist/publication.js +1 -2
- package/dist/publication.js.map +1 -1
- package/dist/record.d.ts +1 -0
- package/dist/record.d.ts.map +1 -1
- package/dist/record.js +10 -0
- package/dist/record.js.map +1 -1
- package/dist/result.d.ts +5 -3
- package/dist/result.d.ts.map +1 -1
- package/dist/result.js +9 -6
- package/dist/result.js.map +1 -1
- package/dist/scan-history-renderer.js +1 -1
- package/dist/scan-history-renderer.js.map +1 -1
- package/dist/scanner-import.d.ts +0 -1
- package/dist/scanner-import.d.ts.map +1 -1
- package/dist/scanner-import.js +9 -9
- package/dist/scanner-import.js.map +1 -1
- package/dist/security-policy.d.ts.map +1 -1
- package/dist/security-policy.js +16 -2
- package/dist/security-policy.js.map +1 -1
- package/dist/semgrep-findings.d.ts.map +1 -1
- package/dist/semgrep-findings.js +15 -82
- package/dist/semgrep-findings.js.map +1 -1
- package/docs/cli.md +55 -10
- package/docs/dedupe-records.md +15 -1
- package/docs/hosted-scans.md +14 -0
- package/package.json +5 -5
package/dist/semgrep-findings.js
CHANGED
|
@@ -1,23 +1,8 @@
|
|
|
1
1
|
import { cloudRepositoryUrlKey, validateExternalEvidence, } from "./external-import-contract.js";
|
|
2
|
-
import {
|
|
2
|
+
import { messageText, parseNativeJsonResult, position, projectNativeJsonResult, sourceRepositoryUrl, ungatedText, weaknessIds, } from "./native-json-findings.js";
|
|
3
|
+
import { array, hasSarifExternalPropertyReferences, normalizeRecords, readScannerJson, record, relativePath, requiredText, sarifRunContextForResult, stableId, text, } from "./scanner-import.js";
|
|
3
4
|
function sourceRepository(options) {
|
|
4
|
-
|
|
5
|
-
const url = new URL(value);
|
|
6
|
-
if (!["http:", "https:"].includes(url.protocol) ||
|
|
7
|
-
url.username ||
|
|
8
|
-
url.password)
|
|
9
|
-
throw new Error("Use an HTTP(S) source repository URL without credentials.");
|
|
10
|
-
return value;
|
|
11
|
-
}
|
|
12
|
-
function ungatedText(value) {
|
|
13
|
-
const supplied = text(value);
|
|
14
|
-
// The current CLI emits this placeholder for gated Community Edition fields.
|
|
15
|
-
return supplied === "requires login" ? null : supplied;
|
|
16
|
-
}
|
|
17
|
-
function messageText(value) {
|
|
18
|
-
if (typeof value !== "string")
|
|
19
|
-
throw new Error("Expected a Semgrep message string.");
|
|
20
|
-
return text(value);
|
|
5
|
+
return sourceRepositoryUrl(options?.sourceRepositoryUrl, "Semgrep");
|
|
21
6
|
}
|
|
22
7
|
function severity(value) {
|
|
23
8
|
const levels = {
|
|
@@ -31,20 +16,6 @@ function severity(value) {
|
|
|
31
16
|
};
|
|
32
17
|
return typeof value === "string" ? (levels[value] ?? "unknown") : "unknown";
|
|
33
18
|
}
|
|
34
|
-
function weaknessIds(value) {
|
|
35
|
-
const labels = typeof value === "string" ? [value] : strings(value);
|
|
36
|
-
return [
|
|
37
|
-
...new Set(labels.flatMap((label) => {
|
|
38
|
-
const match = /^(CWE-\d+)(?::|$)/u.exec(label);
|
|
39
|
-
return match ? [match[1]] : [];
|
|
40
|
-
})),
|
|
41
|
-
];
|
|
42
|
-
}
|
|
43
|
-
function position(value, label) {
|
|
44
|
-
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1)
|
|
45
|
-
throw new Error(`${label} must be a positive integer.`);
|
|
46
|
-
return value;
|
|
47
|
-
}
|
|
48
19
|
function identity(rule, path, line, column, endLine, endColumn) {
|
|
49
20
|
// CE omits fingerprints and source snippets. Its fallback is stable only while the range is stable.
|
|
50
21
|
return stableId("semgrep-location", [
|
|
@@ -104,55 +75,16 @@ export function normalizeSemgrepFindings(input, options, target = "cloud") {
|
|
|
104
75
|
if (array(document["errors"] ?? [], "Semgrep errors").length)
|
|
105
76
|
throw new Error("The Semgrep report contains scan errors; supply a successful report before importing findings.");
|
|
106
77
|
const { results, paths: _paths, time: _time, ...context } = document;
|
|
107
|
-
return normalizeRecords(array(results, "Semgrep results"), (value, sourceFindingId) => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
throw new Error("This adapter supports Semgrep SAST; Supply Chain and Secrets reports need separate qualification.");
|
|
118
|
-
const rule = requiredText(result["check_id"], "Semgrep check_id");
|
|
119
|
-
const rawPath = requiredText(result["path"], "Semgrep path");
|
|
120
|
-
const start = record(result["start"], "Semgrep start");
|
|
121
|
-
const end = record(result["end"], "Semgrep end");
|
|
122
|
-
const line = position(start["line"], "Start line");
|
|
123
|
-
const column = position(start["col"], "Start column");
|
|
124
|
-
const endLine = position(end["line"], "End line");
|
|
125
|
-
const endColumn = position(end["col"], "End column");
|
|
126
|
-
if (endLine < line || (endLine === line && endColumn < column))
|
|
127
|
-
throw new Error("Semgrep source range ends before it starts.");
|
|
128
|
-
const path = relativePath(rawPath);
|
|
129
|
-
return {
|
|
130
|
-
source_finding_id: sourceFindingId,
|
|
131
|
-
evidence: validateExternalEvidence({
|
|
132
|
-
title: rule,
|
|
133
|
-
description: messageText(extra["message"]),
|
|
134
|
-
severity: severity(extra["severity"]),
|
|
135
|
-
locations: path ? [{ path, line }] : [],
|
|
136
|
-
details: {
|
|
137
|
-
kind: "sast",
|
|
138
|
-
repository: { url: repositoryUrl },
|
|
139
|
-
scanner_origin: "Semgrep",
|
|
140
|
-
rule: { id: rule },
|
|
141
|
-
weakness_ids: weaknessIds(metadata["cwe"]),
|
|
142
|
-
code: {
|
|
143
|
-
end_line: path ? endLine : null,
|
|
144
|
-
snippet: ungatedText(extra["lines"]),
|
|
145
|
-
},
|
|
146
|
-
source_status: typeof extra["is_ignored"] === "boolean"
|
|
147
|
-
? extra["is_ignored"]
|
|
148
|
-
? "ignored"
|
|
149
|
-
: "open"
|
|
150
|
-
: null,
|
|
151
|
-
},
|
|
152
|
-
source_data: structuredClone({ report: context, result }),
|
|
153
|
-
}, target),
|
|
154
|
-
};
|
|
155
|
-
}, jsonIdentity, target);
|
|
78
|
+
return normalizeRecords(array(results, "Semgrep results"), (value, sourceFindingId) => ({
|
|
79
|
+
source_finding_id: sourceFindingId,
|
|
80
|
+
evidence: projectNativeJsonResult(parseNativeJsonResult(value, "Semgrep"), {
|
|
81
|
+
origin: "Semgrep",
|
|
82
|
+
repositoryUrl,
|
|
83
|
+
severity,
|
|
84
|
+
reportContext: context,
|
|
85
|
+
target,
|
|
86
|
+
}),
|
|
87
|
+
}), jsonIdentity, target);
|
|
156
88
|
}
|
|
157
89
|
export function normalizeSemgrepSarif(input, options, target = "cloud") {
|
|
158
90
|
const repositoryUrl = sourceRepository(options);
|
|
@@ -256,7 +188,8 @@ export function normalizeSemgrepSarif(input, options, target = "cloud") {
|
|
|
256
188
|
source_finding_id: sourceFindingId,
|
|
257
189
|
evidence: validateExternalEvidence({
|
|
258
190
|
title: ruleId,
|
|
259
|
-
description: text(message["markdown"]) ??
|
|
191
|
+
description: text(message["markdown"]) ??
|
|
192
|
+
messageText(message["text"], "Semgrep"),
|
|
260
193
|
severity: mappedSeverity,
|
|
261
194
|
locations: path ? [{ path, line }] : [],
|
|
262
195
|
details: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semgrep-findings.js","sourceRoot":"","sources":["../src/semgrep-findings.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,KAAK,EACL,kCAAkC,EAClC,gBAAgB,EAChB,eAAe,EACf,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,wBAAwB,EACxB,QAAQ,EACR,OAAO,EACP,IAAI,GACL,MAAM,qBAAqB,CAAC;AAO7B,SAAS,gBAAgB,CAAC,OAA6B;IACrD,MAAM,KAAK,GAAG,YAAY,CACxB,OAAO,EAAE,mBAAmB,EAC5B,uDAAuD,CACxD,CAAC;IACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3B,IACE,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC3C,GAAG,CAAC,QAAQ;QACZ,GAAG,CAAC,QAAQ;QAE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OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,eAAe,CACxB;oBACD,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBACzB,MAAM;iBACP,CAAC;aACH,EACD,MAAM,CACP;SACF,CAAC;IACJ,CAAC,EACD,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,EAC7D,MAAM,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,IAAY,EACZ,OAA6B,EAC7B,MAAM,GAAyB,OAAO;IAEtC,OAAO,wBAAwB,CAAC,MAAM,eAAe,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAChF,CAAC","sourcesContent":["import type { ExternalImportTarget } from \"./external-import-contract.js\";\nimport {\n cloudRepositoryUrlKey,\n validateExternalEvidence,\n} from \"./external-import-contract.js\";\nimport type { ExternalFindings } from \"./external-findings.js\";\nimport {\n array,\n hasSarifExternalPropertyReferences,\n normalizeRecords,\n readScannerJson,\n record,\n relativePath,\n requiredText,\n sarifRunContextForResult,\n stableId,\n strings,\n text,\n} from \"./scanner-import.js\";\n\nexport interface SemgrepImportOptions {\n /** Source repository declared by the caller; never inferred from the destination. */\n sourceRepositoryUrl: string;\n}\n\nfunction sourceRepository(options: SemgrepImportOptions): string {\n const value = requiredText(\n options?.sourceRepositoryUrl,\n \"Semgrep sourceRepositoryUrl (--source-repository-url)\",\n );\n const url = new URL(value);\n if (\n ![\"http:\", \"https:\"].includes(url.protocol) ||\n url.username ||\n url.password\n )\n throw new Error(\n \"Use an HTTP(S) source repository URL without credentials.\",\n );\n return value;\n}\n\nfunction ungatedText(value: unknown): string | null {\n const supplied = text(value);\n // The current CLI emits this placeholder for gated Community Edition fields.\n return supplied === \"requires login\" ? null : supplied;\n}\n\nfunction messageText(value: unknown): string | null {\n if (typeof value !== \"string\")\n throw new Error(\"Expected a Semgrep message string.\");\n return text(value);\n}\n\nfunction severity(value: unknown): string {\n const levels: Record<string, string> = {\n CRITICAL: \"critical\",\n HIGH: \"high\",\n MEDIUM: \"medium\",\n LOW: \"low\",\n ERROR: \"high\",\n WARNING: \"medium\",\n INFO: \"low\",\n };\n return typeof value === \"string\" ? (levels[value] ?? \"unknown\") : \"unknown\";\n}\n\nfunction weaknessIds(value: unknown): string[] {\n const labels = typeof value === \"string\" ? [value] : strings(value);\n return [\n ...new Set(\n labels.flatMap((label) => {\n const match = /^(CWE-\\d+)(?::|$)/u.exec(label);\n return match ? [match[1]!] : [];\n }),\n ),\n ];\n}\n\nfunction position(value: unknown, label: string): number {\n if (typeof value !== \"number\" || !Number.isSafeInteger(value) || value < 1)\n throw new Error(`${label} must be a positive integer.`);\n return value;\n}\n\nfunction identity(\n rule: string,\n path: string,\n line: number,\n column: number,\n endLine: number,\n endColumn: number,\n): string {\n // CE omits fingerprints and source snippets. Its fallback is stable only while the range is stable.\n return stableId(\"semgrep-location\", [\n rule,\n path,\n line,\n column,\n endLine,\n endColumn,\n ]);\n}\n\nfunction jsonIdentity(value: unknown): string {\n const result = record(value, \"Semgrep result\");\n const extra = record(result[\"extra\"], \"Semgrep extra\");\n const supplied = ungatedText(extra[\"fingerprint\"]);\n if (supplied) return stableId(\"semgrep\", [supplied]);\n const start = record(result[\"start\"], \"Semgrep start\");\n const end = record(result[\"end\"], \"Semgrep end\");\n return identity(\n requiredText(result[\"check_id\"], \"Semgrep check_id\"),\n requiredText(result[\"path\"], \"Semgrep path\"),\n position(start[\"line\"], \"Start line\"),\n position(start[\"col\"], \"Start column\"),\n position(end[\"line\"], \"End line\"),\n position(end[\"col\"], \"End column\"),\n );\n}\n\nfunction sarifArtifactUri(\n artifact: Record<string, unknown>,\n runContext: Record<string, unknown>,\n): string | null {\n const base = artifact[\"uriBaseId\"];\n // Native Semgrep uses %SRCROOT% without defining a base. Keep other references raw.\n if (\n artifact[\"index\"] !== undefined ||\n (base !== undefined &&\n (base !== \"%SRCROOT%\" ||\n record(runContext[\"originalUriBaseIds\"] ?? {}, \"SARIF URI bases\")[\n base\n ] !== undefined))\n )\n return null;\n const uri = requiredText(artifact[\"uri\"], \"Semgrep artifact URI\");\n // Semgrep's native formatter copies filesystem paths without URI encoding.\n return base === \"%SRCROOT%\" ? uri : decodeURIComponent(uri);\n}\n\nfunction sarifIdentity(\n value: unknown,\n runContext: Record<string, unknown>,\n): string {\n const result = record(value, \"Semgrep result\");\n const supplied = ungatedText(\n record(result[\"fingerprints\"] ?? {}, \"Semgrep fingerprints\")[\n \"matchBasedId/v1\"\n ],\n );\n if (supplied) return stableId(\"semgrep\", [supplied]);\n const locations = array(result[\"locations\"] ?? [], \"Semgrep locations\");\n if (locations.length !== 1)\n throw new Error(\"Expected Semgrep's single primary result location.\");\n const physical = record(\n record(locations[0], \"Location\")[\"physicalLocation\"],\n \"Physical location\",\n );\n const uri = sarifArtifactUri(\n record(physical[\"artifactLocation\"], \"Artifact location\"),\n runContext,\n );\n if (uri === null)\n throw new Error(\n \"Cannot derive a Semgrep CE identity from an indexed or unresolved base-relative artifact URI.\",\n );\n const region = record(physical[\"region\"], \"Semgrep region\");\n const line = position(region[\"startLine\"], \"Start line\");\n const column = position(region[\"startColumn\"] ?? 1, \"Start column\");\n return identity(\n requiredText(result[\"ruleId\"], \"Semgrep ruleId\"),\n uri,\n line,\n column,\n position(region[\"endLine\"] ?? line, \"End line\"),\n position(region[\"endColumn\"] ?? column, \"End column\"),\n );\n}\n\nexport function normalizeSemgrepFindings(\n input: unknown,\n options: SemgrepImportOptions,\n target: ExternalImportTarget = \"cloud\",\n): ExternalFindings {\n const document = record(input, \"Semgrep report\");\n if (document[\"version\"] === \"2.1.0\" && document[\"runs\"] !== undefined)\n return normalizeSemgrepSarif(document, options, target);\n const repositoryUrl = sourceRepository(options);\n requiredText(document[\"version\"], \"Semgrep version\");\n if (array(document[\"errors\"] ?? [], \"Semgrep errors\").length)\n throw new Error(\n \"The Semgrep report contains scan errors; supply a successful report before importing findings.\",\n );\n const { results, paths: _paths, time: _time, ...context } = document;\n return normalizeRecords(\n array(results, \"Semgrep results\"),\n (value, sourceFindingId) => {\n const result = record(value, \"Semgrep result\");\n const extra = record(result[\"extra\"], \"Semgrep extra\");\n const metadata = record(extra[\"metadata\"] ?? {}, \"Semgrep metadata\");\n const product = metadata[\"product\"];\n const validation = extra[\"validation_state\"];\n if (\n (product != null && product !== \"sast\") ||\n extra[\"sca_info\"] != null ||\n extra[\"historical_info\"] != null ||\n (validation != null && validation !== \"NO_VALIDATOR\")\n )\n throw new Error(\n \"This adapter supports Semgrep SAST; Supply Chain and Secrets reports need separate qualification.\",\n );\n const rule = requiredText(result[\"check_id\"], \"Semgrep check_id\");\n const rawPath = requiredText(result[\"path\"], \"Semgrep path\");\n const start = record(result[\"start\"], \"Semgrep start\");\n const end = record(result[\"end\"], \"Semgrep end\");\n const line = position(start[\"line\"], \"Start line\");\n const column = position(start[\"col\"], \"Start column\");\n const endLine = position(end[\"line\"], \"End line\");\n const endColumn = position(end[\"col\"], \"End column\");\n if (endLine < line || (endLine === line && endColumn < column))\n throw new Error(\"Semgrep source range ends before it starts.\");\n const path = relativePath(rawPath);\n return {\n source_finding_id: sourceFindingId,\n evidence: validateExternalEvidence(\n {\n title: rule,\n description: messageText(extra[\"message\"]),\n severity: severity(extra[\"severity\"]),\n locations: path ? [{ path, line }] : [],\n details: {\n kind: \"sast\",\n repository: { url: repositoryUrl },\n scanner_origin: \"Semgrep\",\n rule: { id: rule },\n weakness_ids: weaknessIds(metadata[\"cwe\"]),\n code: {\n end_line: path ? endLine : null,\n snippet: ungatedText(extra[\"lines\"]),\n },\n source_status:\n typeof extra[\"is_ignored\"] === \"boolean\"\n ? extra[\"is_ignored\"]\n ? \"ignored\"\n : \"open\"\n : null,\n },\n source_data: structuredClone({ report: context, result }),\n },\n target,\n ),\n };\n },\n jsonIdentity,\n target,\n );\n}\n\nexport function normalizeSemgrepSarif(\n input: unknown,\n options: SemgrepImportOptions,\n target: ExternalImportTarget = \"cloud\",\n): ExternalFindings {\n const repositoryUrl = sourceRepository(options);\n const document = record(input, \"Semgrep SARIF\");\n if (document[\"version\"] !== \"2.1.0\")\n throw new Error(\"Expected Semgrep SARIF 2.1.0.\");\n const entries = array(document[\"runs\"], \"SARIF runs\").flatMap((value) => {\n const run = record(value, \"SARIF run\");\n for (const entry of array(\n run[\"versionControlProvenance\"] ?? [],\n \"Version control provenance\",\n )) {\n const declared = text(\n record(entry, \"Repository provenance\")[\"repositoryUri\"],\n );\n if (\n declared &&\n cloudRepositoryUrlKey(declared) !== cloudRepositoryUrlKey(repositoryUrl)\n )\n throw new Error(\n \"SARIF source repository does not match the declared source repository URL.\",\n );\n }\n const tool = record(run[\"tool\"], \"SARIF tool\");\n const driver = record(tool[\"driver\"], \"SARIF driver\");\n if (\n ![\"semgrep\", \"semgrep oss\", \"semgrep pro\"].includes(\n requiredText(driver[\"name\"], \"SARIF producer\").toLowerCase(),\n )\n )\n throw new Error(\"Expected a Semgrep SARIF producer.\");\n if (\n hasSarifExternalPropertyReferences(run[\"externalPropertyFileReferences\"])\n )\n throw new Error(\"Use a self-contained Semgrep SARIF report.\");\n for (const invocation of array(\n run[\"invocations\"] ?? [],\n \"Semgrep invocations\",\n )) {\n const details = record(invocation, \"Semgrep invocation\");\n if (details[\"executionSuccessful\"] === false)\n throw new Error(\"Semgrep SARIF contains an unsuccessful invocation.\");\n if (\n array(\n details[\"toolExecutionNotifications\"] ?? [],\n \"Semgrep scan notifications\",\n ).length\n )\n throw new Error(\"Semgrep SARIF contains scan error notifications.\");\n }\n const rules = array(driver[\"rules\"] ?? [], \"Semgrep rules\").map((r) =>\n record(r, \"Semgrep rule\"),\n );\n const rulesById = new Map<\n unknown,\n { rule: Record<string, unknown>; index: number } | null\n >();\n for (const [index, rule] of rules.entries()) {\n const id = rule[\"id\"];\n rulesById.set(id, rulesById.has(id) ? null : { rule, index });\n }\n const { runs: _runs, ...documentContext } = document;\n const { results: _results, tool: _tool, ...runContext } = run;\n const { rules: _rules, ...driverContext } = driver;\n const { driver: _driver, ...toolContext } = tool;\n return array(run[\"results\"] ?? [], \"Semgrep results\").map((result) => ({\n result,\n rulesById,\n hasRules: rules.length > 0,\n documentContext,\n runContext,\n driverContext,\n toolContext,\n }));\n });\n return normalizeRecords(\n entries,\n ({ result: value, rulesById, hasRules, ...context }, sourceFindingId) => {\n const result = record(value, \"Semgrep result\");\n const properties = record(\n result[\"properties\"] ?? {},\n \"Semgrep result properties\",\n );\n if (\n properties[\"exposure\"] != null ||\n properties[\"dependencyPaths\"] != null\n )\n throw new Error(\n \"This adapter supports Semgrep SAST; Supply Chain reports need separate qualification.\",\n );\n const ruleId = requiredText(result[\"ruleId\"], \"Semgrep ruleId\");\n const selectedRule = rulesById.get(ruleId);\n if (selectedRule === null || (hasRules && selectedRule === undefined))\n throw new Error(\n \"Semgrep result must reference exactly one rule in its run.\",\n );\n const rule = selectedRule?.rule;\n const ruleIndex = selectedRule?.index;\n if (\n result[\"ruleIndex\"] !== undefined &&\n result[\"ruleIndex\"] !== ruleIndex\n )\n throw new Error(\"Semgrep ruleIndex and ruleId disagree.\");\n if (result[\"rule\"] !== undefined) {\n const ref = record(result[\"rule\"], \"Semgrep rule reference\");\n if (\n ref[\"toolComponent\"] !== undefined ||\n (ref[\"id\"] !== undefined && ref[\"id\"] !== ruleId) ||\n (ref[\"index\"] !== undefined && ref[\"index\"] !== ruleIndex) ||\n (ref[\"guid\"] !== undefined && ref[\"guid\"] !== rule?.[\"guid\"])\n )\n throw new Error(\"Inconsistent or external Semgrep rule reference.\");\n }\n const locations = array(result[\"locations\"] ?? [], \"Semgrep locations\");\n if (locations.length !== 1)\n throw new Error(\"Expected Semgrep's single primary result location.\");\n const physical = record(\n record(locations[0], \"Location\")[\"physicalLocation\"],\n \"Physical location\",\n );\n const artifact = record(\n physical[\"artifactLocation\"],\n \"Artifact location\",\n );\n const rawPath = sarifArtifactUri(artifact, context.runContext);\n const region = record(physical[\"region\"], \"Semgrep region\");\n const line = position(region[\"startLine\"], \"Start line\");\n const column = position(region[\"startColumn\"] ?? 1, \"Start column\");\n const endLine = position(region[\"endLine\"] ?? line, \"End line\");\n const endColumn = position(region[\"endColumn\"] ?? column, \"End column\");\n if (endLine < line || (endLine === line && endColumn < column))\n throw new Error(\"Semgrep source range ends before it starts.\");\n const message = record(result[\"message\"], \"Semgrep message\");\n const configuration = record(\n rule?.[\"defaultConfiguration\"] ?? {},\n \"Rule configuration\",\n );\n const level = text(result[\"level\"]) ?? text(configuration[\"level\"]);\n // SARIF collapses severity categories; retain its diagnostic level and all original metadata.\n const mappedSeverity =\n level === \"error\"\n ? \"high\"\n : level === \"warning\"\n ? \"medium\"\n : level === \"note\"\n ? \"low\"\n : \"unknown\";\n // Native %SRCROOT% values are filesystem paths; direct URIs can name other targets.\n const absoluteUri =\n artifact[\"uriBaseId\"] !== \"%SRCROOT%\" &&\n typeof artifact[\"uri\"] === \"string\" &&\n /^[a-z][a-z\\d+.-]*:/iu.test(artifact[\"uri\"]);\n const path =\n rawPath === null || absoluteUri ? null : relativePath(rawPath);\n return {\n source_finding_id: sourceFindingId,\n evidence: validateExternalEvidence(\n {\n title: ruleId,\n description:\n text(message[\"markdown\"]) ?? messageText(message[\"text\"]),\n severity: mappedSeverity,\n locations: path ? [{ path, line }] : [],\n details: {\n kind: \"sast\",\n repository: { url: repositoryUrl },\n scanner_origin: \"Semgrep\",\n rule: { id: ruleId },\n weakness_ids: weaknessIds(\n record(rule?.[\"properties\"] ?? {}, \"Rule properties\")[\"tags\"],\n ),\n code: {\n end_line: path ? endLine : null,\n snippet: ungatedText(\n record(region[\"snippet\"] ?? {}, \"Snippet\")[\"text\"],\n ),\n },\n source_status:\n Array.isArray(result[\"suppressions\"]) &&\n result[\"suppressions\"].some((value) => {\n const status = record(value, \"Suppression\")[\"status\"];\n return status === undefined || status === \"accepted\";\n })\n ? \"suppressed\"\n : null,\n },\n source_data: structuredClone({\n ...context,\n runContext: sarifRunContextForResult(\n context.runContext,\n result,\n rule,\n context.driverContext,\n context.toolContext,\n context.documentContext,\n ),\n ...(rule ? { rule } : {}),\n result,\n }),\n },\n target,\n ),\n };\n },\n ({ result, runContext }) => sarifIdentity(result, runContext),\n target,\n );\n}\n\nexport async function readSemgrepFindings(\n path: string,\n options: SemgrepImportOptions,\n target: ExternalImportTarget = \"cloud\",\n): Promise<ExternalFindings> {\n return normalizeSemgrepFindings(await readScannerJson(path), options, target);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"semgrep-findings.js","sourceRoot":"","sources":["../src/semgrep-findings.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,QAAQ,EACR,uBAAuB,EACvB,mBAAmB,EACnB,WAAW,EACX,WAAW,GACZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,KAAK,EACL,kCAAkC,EAClC,gBAAgB,EAChB,eAAe,EACf,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,wBAAwB,EACxB,QAAQ,EACR,IAAI,GACL,MAAM,qBAAqB,CAAC;AAO7B,SAAS,gBAAgB,CAAC,OAA6B;IACrD,OAAO,mBAAmB,CAAC,OAAO,EAAE,mBAAmB,EAAE,SAAS,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,MAAM,MAAM,GAA2B;QACrC,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,QAAQ;QAChB,GAAG,EAAE,KAAK;QACV,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,QAAQ;QACjB,IAAI,EAAE,KAAK;KACZ,CAAC;IACF,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,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C,EAAE,CAAC;oBACzB,MAAM;iBACP,CAAC;aACH,EACD,MAAM,CACP;SACF,CAAC;IACJ,CAAC,EACD,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,EAC7D,MAAM,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,IAAY,EACZ,OAA6B,EAC7B,MAAM,GAAyB,OAAO;IAEtC,OAAO,wBAAwB,CAAC,MAAM,eAAe,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAChF,CAAC","sourcesContent":["import type { ExternalImportTarget } from \"./external-import-contract.js\";\nimport {\n cloudRepositoryUrlKey,\n validateExternalEvidence,\n} from \"./external-import-contract.js\";\nimport type { ExternalFindings } from \"./external-findings.js\";\nimport {\n messageText,\n parseNativeJsonResult,\n position,\n projectNativeJsonResult,\n sourceRepositoryUrl,\n ungatedText,\n weaknessIds,\n} from \"./native-json-findings.js\";\nimport {\n array,\n hasSarifExternalPropertyReferences,\n normalizeRecords,\n readScannerJson,\n record,\n relativePath,\n requiredText,\n sarifRunContextForResult,\n stableId,\n text,\n} from \"./scanner-import.js\";\n\nexport interface SemgrepImportOptions {\n /** Source repository declared by the caller; never inferred from the destination. */\n sourceRepositoryUrl: string;\n}\n\nfunction sourceRepository(options: SemgrepImportOptions): string {\n return sourceRepositoryUrl(options?.sourceRepositoryUrl, \"Semgrep\");\n}\n\nfunction severity(value: unknown): string {\n const levels: Record<string, string> = {\n CRITICAL: \"critical\",\n HIGH: \"high\",\n MEDIUM: \"medium\",\n LOW: \"low\",\n ERROR: \"high\",\n WARNING: \"medium\",\n INFO: \"low\",\n };\n return typeof value === \"string\" ? (levels[value] ?? \"unknown\") : \"unknown\";\n}\n\nfunction identity(\n rule: string,\n path: string,\n line: number,\n column: number,\n endLine: number,\n endColumn: number,\n): string {\n // CE omits fingerprints and source snippets. Its fallback is stable only while the range is stable.\n return stableId(\"semgrep-location\", [\n rule,\n path,\n line,\n column,\n endLine,\n endColumn,\n ]);\n}\n\nfunction jsonIdentity(value: unknown): string {\n const result = record(value, \"Semgrep result\");\n const extra = record(result[\"extra\"], \"Semgrep extra\");\n const supplied = ungatedText(extra[\"fingerprint\"]);\n if (supplied) return stableId(\"semgrep\", [supplied]);\n const start = record(result[\"start\"], \"Semgrep start\");\n const end = record(result[\"end\"], \"Semgrep end\");\n return identity(\n requiredText(result[\"check_id\"], \"Semgrep check_id\"),\n requiredText(result[\"path\"], \"Semgrep path\"),\n position(start[\"line\"], \"Start line\"),\n position(start[\"col\"], \"Start column\"),\n position(end[\"line\"], \"End line\"),\n position(end[\"col\"], \"End column\"),\n );\n}\n\nfunction sarifArtifactUri(\n artifact: Record<string, unknown>,\n runContext: Record<string, unknown>,\n): string | null {\n const base = artifact[\"uriBaseId\"];\n // Native Semgrep uses %SRCROOT% without defining a base. Keep other references raw.\n if (\n artifact[\"index\"] !== undefined ||\n (base !== undefined &&\n (base !== \"%SRCROOT%\" ||\n record(runContext[\"originalUriBaseIds\"] ?? {}, \"SARIF URI bases\")[\n base\n ] !== undefined))\n )\n return null;\n const uri = requiredText(artifact[\"uri\"], \"Semgrep artifact URI\");\n // Semgrep's native formatter copies filesystem paths without URI encoding.\n return base === \"%SRCROOT%\" ? uri : decodeURIComponent(uri);\n}\n\nfunction sarifIdentity(\n value: unknown,\n runContext: Record<string, unknown>,\n): string {\n const result = record(value, \"Semgrep result\");\n const supplied = ungatedText(\n record(result[\"fingerprints\"] ?? {}, \"Semgrep fingerprints\")[\n \"matchBasedId/v1\"\n ],\n );\n if (supplied) return stableId(\"semgrep\", [supplied]);\n const locations = array(result[\"locations\"] ?? [], \"Semgrep locations\");\n if (locations.length !== 1)\n throw new Error(\"Expected Semgrep's single primary result location.\");\n const physical = record(\n record(locations[0], \"Location\")[\"physicalLocation\"],\n \"Physical location\",\n );\n const uri = sarifArtifactUri(\n record(physical[\"artifactLocation\"], \"Artifact location\"),\n runContext,\n );\n if (uri === null)\n throw new Error(\n \"Cannot derive a Semgrep CE identity from an indexed or unresolved base-relative artifact URI.\",\n );\n const region = record(physical[\"region\"], \"Semgrep region\");\n const line = position(region[\"startLine\"], \"Start line\");\n const column = position(region[\"startColumn\"] ?? 1, \"Start column\");\n return identity(\n requiredText(result[\"ruleId\"], \"Semgrep ruleId\"),\n uri,\n line,\n column,\n position(region[\"endLine\"] ?? line, \"End line\"),\n position(region[\"endColumn\"] ?? column, \"End column\"),\n );\n}\n\nexport function normalizeSemgrepFindings(\n input: unknown,\n options: SemgrepImportOptions,\n target: ExternalImportTarget = \"cloud\",\n): ExternalFindings {\n const document = record(input, \"Semgrep report\");\n if (document[\"version\"] === \"2.1.0\" && document[\"runs\"] !== undefined)\n return normalizeSemgrepSarif(document, options, target);\n const repositoryUrl = sourceRepository(options);\n requiredText(document[\"version\"], \"Semgrep version\");\n if (array(document[\"errors\"] ?? [], \"Semgrep errors\").length)\n throw new Error(\n \"The Semgrep report contains scan errors; supply a successful report before importing findings.\",\n );\n const { results, paths: _paths, time: _time, ...context } = document;\n return normalizeRecords(\n array(results, \"Semgrep results\"),\n (value, sourceFindingId) => ({\n source_finding_id: sourceFindingId,\n evidence: projectNativeJsonResult(\n parseNativeJsonResult(value, \"Semgrep\"),\n {\n origin: \"Semgrep\",\n repositoryUrl,\n severity,\n reportContext: context,\n target,\n },\n ),\n }),\n jsonIdentity,\n target,\n );\n}\n\nexport function normalizeSemgrepSarif(\n input: unknown,\n options: SemgrepImportOptions,\n target: ExternalImportTarget = \"cloud\",\n): ExternalFindings {\n const repositoryUrl = sourceRepository(options);\n const document = record(input, \"Semgrep SARIF\");\n if (document[\"version\"] !== \"2.1.0\")\n throw new Error(\"Expected Semgrep SARIF 2.1.0.\");\n const entries = array(document[\"runs\"], \"SARIF runs\").flatMap((value) => {\n const run = record(value, \"SARIF run\");\n for (const entry of array(\n run[\"versionControlProvenance\"] ?? [],\n \"Version control provenance\",\n )) {\n const declared = text(\n record(entry, \"Repository provenance\")[\"repositoryUri\"],\n );\n if (\n declared &&\n cloudRepositoryUrlKey(declared) !== cloudRepositoryUrlKey(repositoryUrl)\n )\n throw new Error(\n \"SARIF source repository does not match the declared source repository URL.\",\n );\n }\n const tool = record(run[\"tool\"], \"SARIF tool\");\n const driver = record(tool[\"driver\"], \"SARIF driver\");\n if (\n ![\"semgrep\", \"semgrep oss\", \"semgrep pro\"].includes(\n requiredText(driver[\"name\"], \"SARIF producer\").toLowerCase(),\n )\n )\n throw new Error(\"Expected a Semgrep SARIF producer.\");\n if (\n hasSarifExternalPropertyReferences(run[\"externalPropertyFileReferences\"])\n )\n throw new Error(\"Use a self-contained Semgrep SARIF report.\");\n for (const invocation of array(\n run[\"invocations\"] ?? [],\n \"Semgrep invocations\",\n )) {\n const details = record(invocation, \"Semgrep invocation\");\n if (details[\"executionSuccessful\"] === false)\n throw new Error(\"Semgrep SARIF contains an unsuccessful invocation.\");\n if (\n array(\n details[\"toolExecutionNotifications\"] ?? [],\n \"Semgrep scan notifications\",\n ).length\n )\n throw new Error(\"Semgrep SARIF contains scan error notifications.\");\n }\n const rules = array(driver[\"rules\"] ?? [], \"Semgrep rules\").map((r) =>\n record(r, \"Semgrep rule\"),\n );\n const rulesById = new Map<\n unknown,\n { rule: Record<string, unknown>; index: number } | null\n >();\n for (const [index, rule] of rules.entries()) {\n const id = rule[\"id\"];\n rulesById.set(id, rulesById.has(id) ? null : { rule, index });\n }\n const { runs: _runs, ...documentContext } = document;\n const { results: _results, tool: _tool, ...runContext } = run;\n const { rules: _rules, ...driverContext } = driver;\n const { driver: _driver, ...toolContext } = tool;\n return array(run[\"results\"] ?? [], \"Semgrep results\").map((result) => ({\n result,\n rulesById,\n hasRules: rules.length > 0,\n documentContext,\n runContext,\n driverContext,\n toolContext,\n }));\n });\n return normalizeRecords(\n entries,\n ({ result: value, rulesById, hasRules, ...context }, sourceFindingId) => {\n const result = record(value, \"Semgrep result\");\n const properties = record(\n result[\"properties\"] ?? {},\n \"Semgrep result properties\",\n );\n if (\n properties[\"exposure\"] != null ||\n properties[\"dependencyPaths\"] != null\n )\n throw new Error(\n \"This adapter supports Semgrep SAST; Supply Chain reports need separate qualification.\",\n );\n const ruleId = requiredText(result[\"ruleId\"], \"Semgrep ruleId\");\n const selectedRule = rulesById.get(ruleId);\n if (selectedRule === null || (hasRules && selectedRule === undefined))\n throw new Error(\n \"Semgrep result must reference exactly one rule in its run.\",\n );\n const rule = selectedRule?.rule;\n const ruleIndex = selectedRule?.index;\n if (\n result[\"ruleIndex\"] !== undefined &&\n result[\"ruleIndex\"] !== ruleIndex\n )\n throw new Error(\"Semgrep ruleIndex and ruleId disagree.\");\n if (result[\"rule\"] !== undefined) {\n const ref = record(result[\"rule\"], \"Semgrep rule reference\");\n if (\n ref[\"toolComponent\"] !== undefined ||\n (ref[\"id\"] !== undefined && ref[\"id\"] !== ruleId) ||\n (ref[\"index\"] !== undefined && ref[\"index\"] !== ruleIndex) ||\n (ref[\"guid\"] !== undefined && ref[\"guid\"] !== rule?.[\"guid\"])\n )\n throw new Error(\"Inconsistent or external Semgrep rule reference.\");\n }\n const locations = array(result[\"locations\"] ?? [], \"Semgrep locations\");\n if (locations.length !== 1)\n throw new Error(\"Expected Semgrep's single primary result location.\");\n const physical = record(\n record(locations[0], \"Location\")[\"physicalLocation\"],\n \"Physical location\",\n );\n const artifact = record(\n physical[\"artifactLocation\"],\n \"Artifact location\",\n );\n const rawPath = sarifArtifactUri(artifact, context.runContext);\n const region = record(physical[\"region\"], \"Semgrep region\");\n const line = position(region[\"startLine\"], \"Start line\");\n const column = position(region[\"startColumn\"] ?? 1, \"Start column\");\n const endLine = position(region[\"endLine\"] ?? line, \"End line\");\n const endColumn = position(region[\"endColumn\"] ?? column, \"End column\");\n if (endLine < line || (endLine === line && endColumn < column))\n throw new Error(\"Semgrep source range ends before it starts.\");\n const message = record(result[\"message\"], \"Semgrep message\");\n const configuration = record(\n rule?.[\"defaultConfiguration\"] ?? {},\n \"Rule configuration\",\n );\n const level = text(result[\"level\"]) ?? text(configuration[\"level\"]);\n // SARIF collapses severity categories; retain its diagnostic level and all original metadata.\n const mappedSeverity =\n level === \"error\"\n ? \"high\"\n : level === \"warning\"\n ? \"medium\"\n : level === \"note\"\n ? \"low\"\n : \"unknown\";\n // Native %SRCROOT% values are filesystem paths; direct URIs can name other targets.\n const absoluteUri =\n artifact[\"uriBaseId\"] !== \"%SRCROOT%\" &&\n typeof artifact[\"uri\"] === \"string\" &&\n /^[a-z][a-z\\d+.-]*:/iu.test(artifact[\"uri\"]);\n const path =\n rawPath === null || absoluteUri ? null : relativePath(rawPath);\n return {\n source_finding_id: sourceFindingId,\n evidence: validateExternalEvidence(\n {\n title: ruleId,\n description:\n text(message[\"markdown\"]) ??\n messageText(message[\"text\"], \"Semgrep\"),\n severity: mappedSeverity,\n locations: path ? [{ path, line }] : [],\n details: {\n kind: \"sast\",\n repository: { url: repositoryUrl },\n scanner_origin: \"Semgrep\",\n rule: { id: ruleId },\n weakness_ids: weaknessIds(\n record(rule?.[\"properties\"] ?? {}, \"Rule properties\")[\"tags\"],\n ),\n code: {\n end_line: path ? endLine : null,\n snippet: ungatedText(\n record(region[\"snippet\"] ?? {}, \"Snippet\")[\"text\"],\n ),\n },\n source_status:\n Array.isArray(result[\"suppressions\"]) &&\n result[\"suppressions\"].some((value) => {\n const status = record(value, \"Suppression\")[\"status\"];\n return status === undefined || status === \"accepted\";\n })\n ? \"suppressed\"\n : null,\n },\n source_data: structuredClone({\n ...context,\n runContext: sarifRunContextForResult(\n context.runContext,\n result,\n rule,\n context.driverContext,\n context.toolContext,\n context.documentContext,\n ),\n ...(rule ? { rule } : {}),\n result,\n }),\n },\n target,\n ),\n };\n },\n ({ result, runContext }) => sarifIdentity(result, runContext),\n target,\n );\n}\n\nexport async function readSemgrepFindings(\n path: string,\n options: SemgrepImportOptions,\n target: ExternalImportTarget = \"cloud\",\n): Promise<ExternalFindings> {\n return normalizeSemgrepFindings(await readScannerJson(path), options, target);\n}\n"]}
|
package/docs/cli.md
CHANGED
|
@@ -506,7 +506,7 @@ or JSONL output produce:
|
|
|
506
506
|
With `--full-output`, the error appears under `error` in an `ok: false` envelope.
|
|
507
507
|
If the scan target changed, the error explains that the results no longer
|
|
508
508
|
represent the current checkout. Retained sealed results remain available under
|
|
509
|
-
`data`, including their manifest, findings,
|
|
509
|
+
`data`, including their manifest, findings, review summary, scan directory, and report
|
|
510
510
|
path. Unsealed or invalid artifacts are not included. This also applies to
|
|
511
511
|
`scans rerun` and `scans resume`.
|
|
512
512
|
For `scans rerun` and `scans resume`, `--filter-output` applies to retained `data`;
|
|
@@ -1268,6 +1268,8 @@ Supply the validation prompt again when rerunning.
|
|
|
1268
1268
|
|
|
1269
1269
|
## Import vendor findings locally
|
|
1270
1270
|
|
|
1271
|
+
Use the [scanner file import schema and capability guide](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/schema-guide.md) to compare provider identities, mapped evidence and destination behavior before selecting a report.
|
|
1272
|
+
|
|
1271
1273
|
External finding imports are disabled by default. Opt in for the current shell:
|
|
1272
1274
|
|
|
1273
1275
|
```bash
|
|
@@ -1303,7 +1305,9 @@ repository path instead of a Cloud repository ID or URL. Supported inputs includ
|
|
|
1303
1305
|
Wiz findings, [Snyk Open Source JSON and SARIF](#import-snyk-open-source-findings),
|
|
1304
1306
|
[Endor Labs Finding JSON and SARIF](#import-endor-labs-findings),
|
|
1305
1307
|
[Semgrep Code JSON and SARIF](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/semgrep.md),
|
|
1306
|
-
|
|
1308
|
+
[OpenGrep native JSON](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/opengrep.md),
|
|
1309
|
+
[GitHub Dependabot repository alerts](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/github-dependabot.md),
|
|
1310
|
+
and [saved GitHub code-scanning alerts and GHSA advisories](#import-github-findings-locally-or-to-cloud):
|
|
1307
1311
|
|
|
1308
1312
|
```bash
|
|
1309
1313
|
codex-security publish findings selected-wiz.json \
|
|
@@ -1335,8 +1339,18 @@ Repeated imports update the same record by repository, provider, source key, and
|
|
|
1335
1339
|
source finding ID. The result reports created, updated, and unchanged counts.
|
|
1336
1340
|
Keep the source key stable across exports. Records omitted from a later selection
|
|
1337
1341
|
remain stored; omission does not resolve or delete a finding. Excluded records
|
|
1338
|
-
are reported, and an import with exclusions exits with status 1.
|
|
1339
|
-
|
|
1342
|
+
are reported, and an import with exclusions exits with status 1. Both destinations
|
|
1343
|
+
read the same vendor formats; Cloud's field, size and nesting limits do not apply
|
|
1344
|
+
to local file imports.
|
|
1345
|
+
|
|
1346
|
+
For OpenGrep, use `--provider opengrep` and supply `--source-repository-url`.
|
|
1347
|
+
The reader supports native JSON and gzip for both destinations. It uses the
|
|
1348
|
+
existing `semgrep` source-provider contract while retaining `OpenGrep` as the
|
|
1349
|
+
scanner origin; keep a stable OpenGrep-specific source key. Review report
|
|
1350
|
+
diagnostics as well as findings: import completion does not establish scan
|
|
1351
|
+
coverage. The [OpenGrep guide](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/opengrep.md)
|
|
1352
|
+
covers evidence identity, empty reports, and assessing an imported finding with
|
|
1353
|
+
the existing SDK validator.
|
|
1340
1354
|
|
|
1341
1355
|
`scan import --json` and `scan import --csv` remain separate commands for importing
|
|
1342
1356
|
Codex Security's findings schema as a saved scan; they do not accept vendor
|
|
@@ -2268,6 +2282,33 @@ be unchanged since the scan. `--source-root` is supported only for SARIF.
|
|
|
2268
2282
|
If export fails, it exits with `2`. Fix the reported error and rerun the export;
|
|
2269
2283
|
the saved scan remains available, so you don't need to run another scan.
|
|
2270
2284
|
|
|
2285
|
+
### Export findings for ServiceNow
|
|
2286
|
+
|
|
2287
|
+
Use `servicenow-avit` to prepare a CSV for ServiceNow Application Vulnerability
|
|
2288
|
+
Response. In ServiceNow, open **All > Manual AVIT Ingestion > Upload File UI**
|
|
2289
|
+
and download the CSV template. Keep the headers and a single row per template
|
|
2290
|
+
file. Fill in the exact ServiceNow application name, requester, assignee, and
|
|
2291
|
+
assignment group. Supply the application team, purpose, sensitive data types,
|
|
2292
|
+
compliance programs, technology stack, and URLs to test. Leave the finding
|
|
2293
|
+
columns blank and reuse this file for future exports of the same application. See the
|
|
2294
|
+
[example template](https://github.com/openai/codex-security/blob/main/examples/servicenow-avit-template.csv).
|
|
2295
|
+
|
|
2296
|
+
```bash
|
|
2297
|
+
codex-security export --scan latest --export-format servicenow-avit \
|
|
2298
|
+
--avit-template invoice-desk.csv --output findings-avit.csv
|
|
2299
|
+
```
|
|
2300
|
+
|
|
2301
|
+
The command writes one row per saved finding. It fills the risk rating and uses
|
|
2302
|
+
the first CWE when available, otherwise the Codex finding ID. Technical details
|
|
2303
|
+
include that ID, the primary file and line, the summary, and remediation. For
|
|
2304
|
+
**Steps to reproduce**, review any recorded attack-path steps and complete blank
|
|
2305
|
+
cells before uploading. Both text fields have a 1,000-character limit. An ellipsis
|
|
2306
|
+
marks shortened text. Other template columns keep their original values.
|
|
2307
|
+
|
|
2308
|
+
The output defaults to `servicenow-avit.csv`. Upload the completed file in the
|
|
2309
|
+
same ServiceNow screen. Each upload creates a new penetration-test form for the
|
|
2310
|
+
application. See [ServiceNow's upload instructions](https://www.servicenow.com/docs/r/security-management/application-vulnerability-response/ingest-vulnerabilities-manually-avr.html).
|
|
2311
|
+
|
|
2271
2312
|
### Export a threat model
|
|
2272
2313
|
|
|
2273
2314
|
To save a scan's threat model as Markdown, run:
|
|
@@ -2310,6 +2351,8 @@ console.log(exported.path, exported.provenance);
|
|
|
2310
2351
|
```
|
|
2311
2352
|
|
|
2312
2353
|
Use `artifact: "findings"` with `format: "csv" | "json" | "sarif"` for findings.
|
|
2354
|
+
For ServiceNow, use `format: "servicenow-avit"` and set `avitTemplate` to the
|
|
2355
|
+
path of the application's populated CSV template.
|
|
2313
2356
|
`output: "-"` streams stdout and returns null path/provenance. `pythonPath`
|
|
2314
2357
|
selects an interpreter; `signal` cancels.
|
|
2315
2358
|
|
|
@@ -2392,10 +2435,12 @@ Acquire code-scanning findings with the existing `import github` collector and
|
|
|
2392
2435
|
save its complete JSON output. In Codex, the official
|
|
2393
2436
|
[GitHub Codex plugin](https://github.com/openai/plugins/tree/main/plugins/github)
|
|
2394
2437
|
can help select the repository, alert numbers and ref through GitHub's MCP
|
|
2395
|
-
server
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2438
|
+
server. Pass that selection to the collector. For Dependabot, use
|
|
2439
|
+
the [repository alert export guide](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/github-dependabot.md)
|
|
2440
|
+
to save the native REST records from one repository and preview them with
|
|
2441
|
+
`--provider github`. For GHSA disclosures, use the
|
|
2442
|
+
[advisory collector](#import-ghsa-advisories-separately).
|
|
2443
|
+
The following example previews local storage of a code-scanning export.
|
|
2399
2444
|
|
|
2400
2445
|
```bash
|
|
2401
2446
|
codex-security import github example/project --format json > /path/outside/repository/alerts.json
|
|
@@ -2416,8 +2461,8 @@ The importer fetches every page, retrieves alert details, and retains the select
|
|
|
2416
2461
|
ref's instance. It writes the saved input for publication; no website download or
|
|
2417
2462
|
hand-written JSON mapping is needed. Use `--github-alert NUMBER` repeatedly for
|
|
2418
2463
|
selected alerts or `--github-ref REF` for another ref. Defaults are open alerts on
|
|
2419
|
-
the default branch. MCP list calls are paginated separately
|
|
2420
|
-
|
|
2464
|
+
the default branch. MCP list calls are paginated separately. Code-scanning
|
|
2465
|
+
imports require the saved collector output, which includes the selected instance.
|
|
2421
2466
|
|
|
2422
2467
|
The importer uses GitHub CLI authentication (`gh auth login`) and `GH_HOST`;
|
|
2423
2468
|
the plugin's connection does not sign in `gh`. Reading alerts requires
|
package/docs/dedupe-records.md
CHANGED
|
@@ -190,7 +190,7 @@ For failure or an inconclusive review, send an explicit error:
|
|
|
190
190
|
}
|
|
191
191
|
```
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
A host error ends the review without another submission. Invalid model
|
|
194
194
|
answers, missing decisions, and host errors make the whole batch unresolved;
|
|
195
195
|
previous successful reviews in that run do not become persistence decisions.
|
|
196
196
|
The existing algorithm treats a validated `DISTINCT` as a nonmatch, when
|
|
@@ -203,6 +203,20 @@ severity-based representative selection are reused. No local review checkpoints
|
|
|
203
203
|
are read or written in records mode. Local saved-scan execution retains its
|
|
204
204
|
existing tool-submission validation and workflow checkpoints.
|
|
205
205
|
|
|
206
|
+
### Continuing a review
|
|
207
|
+
|
|
208
|
+
A `review.run` request with `supportsContinuation: true` can receive the result
|
|
209
|
+
`{"status":"missing_submission"}`. Send this only after verifying that the
|
|
210
|
+
original turn completed without a pending decision or blocker. Keep that
|
|
211
|
+
review session open. The CLI then sends one `review.continue` request with a
|
|
212
|
+
fresh JSON-RPC ID and `params: {requestId, prompt}`. The request ID in the
|
|
213
|
+
parameters identifies the original review. Submit the prompt in the same
|
|
214
|
+
session and reply on the new JSON-RPC ID. The correction omits
|
|
215
|
+
`supportsContinuation`, so the host releases the session after that turn. A second missing submission ends
|
|
216
|
+
the review as unresolved. A pending tool call uses the original turn and
|
|
217
|
+
requires no correction. An uncertain outcome or explicit blocker follows the
|
|
218
|
+
existing error path. Hosts without continuation support can ignore the field.
|
|
219
|
+
|
|
206
220
|
## Final response and persistence
|
|
207
221
|
|
|
208
222
|
```json
|
package/docs/hosted-scans.md
CHANGED
|
@@ -208,6 +208,20 @@ needs before returning that outcome. Use shared mounts or a coordinated transfer
|
|
|
208
208
|
that preserves the supplied path bindings, not independent copies of mutable
|
|
209
209
|
workbench state.
|
|
210
210
|
|
|
211
|
+
For path scans with the Linux CLI and a current plugin, use the inventory
|
|
212
|
+
path the scope helper reports. A Linux executor can keep the inventory in
|
|
213
|
+
`stateDirectory` outside the checkout and captured output. The state binding
|
|
214
|
+
may include one protected symlink and must exclude `..` from the path and
|
|
215
|
+
link target. Its protected directory must support executor-owned mode-`0600`
|
|
216
|
+
files and keep a reader open across writer close.
|
|
217
|
+
|
|
218
|
+
Other layouts use `scoped-source-input.jsonl` in scan output. If a later
|
|
219
|
+
shell loses the inventory, run the recovery command in the prompt. It may
|
|
220
|
+
replace an earlier output file, so the executor needs permission to remove it.
|
|
221
|
+
State transfers include private inventories named
|
|
222
|
+
`<scope-input-filename>.scoped-<24 lowercase hex digits>.jsonl`. Hosts can
|
|
223
|
+
remove the request's private inventories after execution finishes.
|
|
224
|
+
|
|
211
225
|
Run the plugin stdio server from
|
|
212
226
|
`pluginRoot/scripts/launch_codex_security_mcp --stdio` with the supplied
|
|
213
227
|
environment. The executor needs the target files, plugin skills and registered
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openai/codex-security",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "TypeScript SDK and CLI for Codex Security",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "OpenAI",
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
]
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@inquirer/prompts": "8.7.
|
|
60
|
+
"@inquirer/prompts": "8.7.4",
|
|
61
61
|
"@linear/sdk": "98.0.0",
|
|
62
62
|
"@octokit/core": "7.0.8",
|
|
63
|
-
"@openai/codex": "0.
|
|
64
|
-
"@openai/codex-sdk": "0.
|
|
63
|
+
"@openai/codex": "0.165.0",
|
|
64
|
+
"@openai/codex-sdk": "0.165.0",
|
|
65
65
|
"ajv": "8.20.0",
|
|
66
66
|
"fflate": "0.8.3",
|
|
67
67
|
"incur": "0.7.1",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"prettier": "3.9.10",
|
|
97
97
|
"typescript": "7.0.2"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "1f2f96d562b98216257e7f7cdacd40c446b97f70",
|
|
100
100
|
"scripts": {
|
|
101
101
|
"audit:prod": "pnpm audit --prod --audit-level high",
|
|
102
102
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|