@openai/codex-security 0.10.0 → 0.10.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/_bundled_plugin/.mcp.json +1 -0
- package/_bundled_plugin/mcp/helpers.mjs.br +0 -0
- package/_bundled_plugin/mcp/native/darwin-arm64/unix.node +0 -0
- package/_bundled_plugin/mcp/native/darwin-x64/unix.node +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 +0 -0
- package/_bundled_plugin/references/access-advisory.md +1 -1
- package/_bundled_plugin/references/threat-model.md +1 -0
- package/_bundled_plugin/scripts/deep_scan_workbench.py +1 -0
- package/_bundled_plugin/scripts/finalize_scan_contract.py +18 -6
- package/_bundled_plugin/scripts/launch_codex_security_mcp.cmd +2 -0
- package/_bundled_plugin/scripts/workbench_db.py +16 -54
- package/_bundled_plugin/scripts/workbench_scan_history.py +23 -28
- package/_bundled_plugin/scripts/workbench_scan_start.py +65 -2
- package/_bundled_plugin/scripts/workbench_source_scopes.py +8 -0
- package/_bundled_plugin/scripts/workbench_target.py +17 -3
- package/_bundled_plugin/shared/workbench-history-repairs.json +5 -1
- package/_bundled_plugin/skills/attack-path-analysis/SKILL.md +4 -2
- package/_bundled_plugin/skills/attack-path-analysis/references/severity-policy.md +2 -2
- package/_bundled_plugin/skills/publish-findings/SKILL.md +3 -1
- package/dist/api.d.ts +1 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +23 -4
- package/dist/api.js.map +1 -1
- package/dist/classify-severity-diagnostics.d.ts +10 -0
- package/dist/classify-severity-diagnostics.d.ts.map +1 -0
- package/dist/classify-severity-diagnostics.js +57 -0
- package/dist/classify-severity-diagnostics.js.map +1 -0
- package/dist/classify-severity-records.d.ts +4 -0
- package/dist/classify-severity-records.d.ts.map +1 -1
- package/dist/classify-severity-records.js +35 -8
- package/dist/classify-severity-records.js.map +1 -1
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +99 -11
- package/dist/cli.js.map +1 -1
- package/dist/component-plan.d.ts.map +1 -1
- package/dist/component-plan.js +3 -3
- package/dist/component-plan.js.map +1 -1
- package/dist/continuum-aws.d.ts +6 -0
- package/dist/continuum-aws.d.ts.map +1 -0
- package/dist/continuum-aws.js +202 -0
- package/dist/continuum-aws.js.map +1 -0
- package/dist/continuum-collector.d.ts +44 -0
- package/dist/continuum-collector.d.ts.map +1 -0
- package/dist/continuum-collector.js +266 -0
- package/dist/continuum-collector.js.map +1 -0
- package/dist/continuum-findings.d.ts +31 -2
- package/dist/continuum-findings.d.ts.map +1 -1
- package/dist/continuum-findings.js +440 -64
- package/dist/continuum-findings.js.map +1 -1
- package/dist/contract.d.ts +1 -0
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +3 -0
- package/dist/contract.js.map +1 -1
- package/dist/crowdstrike-findings.d.ts +7 -0
- package/dist/crowdstrike-findings.d.ts.map +1 -0
- package/dist/crowdstrike-findings.js +210 -0
- package/dist/crowdstrike-findings.js.map +1 -0
- package/dist/external-findings-local.d.ts.map +1 -1
- package/dist/external-findings-local.js +26 -8
- package/dist/external-findings-local.js.map +1 -1
- package/dist/external-findings-publish.d.ts.map +1 -1
- package/dist/external-findings-publish.js +5 -1
- package/dist/external-findings-publish.js.map +1 -1
- package/dist/external-findings-read.d.ts +10 -2
- package/dist/external-findings-read.d.ts.map +1 -1
- package/dist/external-findings-read.js +26 -3
- package/dist/external-findings-read.js.map +1 -1
- package/dist/external-import-contract.d.ts +3 -0
- package/dist/external-import-contract.d.ts.map +1 -1
- package/dist/external-import-contract.js +6 -1
- package/dist/external-import-contract.js.map +1 -1
- package/dist/host-protocol.d.ts +6 -0
- package/dist/host-protocol.d.ts.map +1 -1
- package/dist/host-protocol.js +11 -1
- package/dist/host-protocol.js.map +1 -1
- package/dist/host-records-protocol.d.ts +2 -0
- package/dist/host-records-protocol.d.ts.map +1 -1
- package/dist/host-records-protocol.js +4 -0
- package/dist/host-records-protocol.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +4 -2
- package/dist/multiscan.js.map +1 -1
- package/dist/project-config-schema.d.ts +2 -0
- package/dist/project-config-schema.d.ts.map +1 -1
- package/dist/project-config-schema.js +1 -0
- package/dist/project-config-schema.js.map +1 -1
- package/dist/project-config.d.ts +1 -0
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +3 -0
- package/dist/project-config.js.map +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +4 -0
- package/dist/runtime.js.map +1 -1
- package/dist/scan-comparison.d.ts +20 -2
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +20 -3
- package/dist/scan-comparison.js.map +1 -1
- package/dist/scan-settings.d.ts +1 -0
- package/dist/scan-settings.d.ts.map +1 -1
- package/dist/scan-settings.js +1 -0
- package/dist/scan-settings.js.map +1 -1
- package/dist/severity-review.d.ts.map +1 -1
- package/dist/severity-review.js +1 -0
- package/dist/severity-review.js.map +1 -1
- package/dist/stored-finding-projection.d.ts.map +1 -1
- package/dist/stored-finding-projection.js +30 -5
- package/dist/stored-finding-projection.js.map +1 -1
- package/dist/targets.d.ts +2 -0
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +27 -0
- package/dist/targets.js.map +1 -1
- package/dist/trusted-executable.d.ts +1 -0
- package/dist/trusted-executable.d.ts.map +1 -1
- package/dist/trusted-executable.js +11 -3
- package/dist/trusted-executable.js.map +1 -1
- package/dist/value.js +3 -1
- package/dist/value.js.map +1 -1
- package/docs/classify-severity-records.md +30 -0
- package/docs/cli.md +164 -18
- package/docs/sdk.md +23 -8
- package/package.json +7 -2
- package/schemas/project-config.schema.json +5 -0
- package/_bundled_plugin/skills/publish-findings/scripts/collect_continuum.py +0 -224
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-findings-publish.js","sourceRoot":"","sources":["../src/external-findings-publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EAEnB,qBAAqB,EACrB,sBAAsB,EAEtB,eAAe,GAEhB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,y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E,OAAO;wBACd,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;qBACrD,EACD,KAAK,CACN,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;gBAC1B,IAAI,QAAQ,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO;oBAAE,MAAM,KAAK,CAAC;gBAC3D,MAAM,OAAO,GAAG,KAAK;oBACnB,CAAC,CAAC,8GAA8G,WAAW,EAAE;oBAC7H,CAAC,CAAC,wFAAwF,CAAC;gBAC7F,MAAM,kBAAkB,CACtB,OAAO,EACP,KAAK,EACL,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAChC,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { readScannerJson } from \"./scanner-import.js\";\nimport { hash, randomUUID } from \"node:crypto\";\nimport { chmodSync } from \"node:fs\";\nimport { lstat, mkdir, open, readFile, rename, rm } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { nullIfMissingFile } from \"./targets.js\";\nimport { setTimeout as delay } from \"node:timers/promises\";\nimport { isProxy } from \"node:util/types\";\nimport {\n privateImportClient,\n privateJobVersions,\n selectPrivateReport,\n type PrivateImportFormat,\n readPrivateCheckpoint,\n parsePrivateCheckpoint,\n type PrivateImportContext,\n unsuccessfulJob,\n type PrivateImportJob,\n} from \"./private-finding-import.js\";\nimport { readCloudCredentials } from \"./cloud-publish.js\";\nimport type { LocalExternalImportOptions } from \"./external-findings-import.js\";\nimport { armorCodeRepositoryUrl } from \"./armorcode-findings.js\";\nimport { declaredScannerRepositoryUrl } from \"./scanner-repository-url.js\";\nimport { tenableReportFormat } from \"./tenable-findings.js\";\nimport {\n guardianFindingId,\n guardianFindingRepository,\n guardianSelectionFormat,\n} from \"./semgrep-guardian-findings.js\";\nimport { cloudBaseUrl, cloudFindingsUrl } from \"./cloud-endpoint.js\";\nimport { CodexSecurityError, errorMessage } from \"./errors.js\";\nimport {\n codexSecurityStateDirectory,\n createWindowsOutputDirectory,\n validatePreparedOutputDir,\n sqliteDatabaseOpener,\n} from \"./runtime.js\";\nimport {\n EXTERNAL_FINDINGS_PROVIDERS,\n readExternalFindings,\n requireCloudReader,\n semgrepSarifRepositories,\n snykFileRepositories,\n type CloudFindingsReader,\n} from \"./external-findings-read.js\";\nimport { canonicalJson, isRecord } from \"./record.js\";\nimport { notify } from \"./value.js\";\nimport { wizCsvRepositoryUrl } from \"./wiz-csv.js\";\nimport { isWizPackageFinding, wizFindingRepository } from \"./wiz-findings.js\";\nimport { getOpenGrepSourcePositions } from \"./opengrep-findings.js\";\nimport { dependabotRepository } from \"./github-dependabot-findings.js\";\nimport { retainedGitHubRepository } from \"./github-findings.js\";\nimport {\n normalizeSemgrepFindings,\n readSemgrepReport,\n} from \"./semgrep-findings.js\";\nimport { normalizeSnykFile, snykRepositoryUrls } from \"./snyk-findings.js\";\nimport {\n type SnykIssuesFindings,\n isSnykRestFinding,\n isSnykRestFormat,\n snykRestImportRepository,\n snykRestRepositoryMatches,\n} from \"./snyk-rest-findings.js\";\nimport {\n hasRetainedSemgrepScope,\n isSemgrepPlatformEvidence,\n isSemgrepPlatformFormat,\n semgrepPlatformFormat,\n semgrepPlatformFindingBinding,\n semgrepPlatformRepositoryReference,\n semgrepPlatformReportScope,\n} from \"./semgrep-platform-findings.js\";\nimport {\n hostedRepositoryUrlKey,\n normalizeHostedGitRepositoryUrl,\n} from \"./hosted-git-repository.js\";\nimport { trivyRemoteKey, trivyRepositoryUrl } from \"./trivy-findings.js\";\nimport { hostedRepositoryUrl } from \"./hosted-scanner-http.js\";\nimport { endorRepositoryUrls } from \"./endor-findings.js\";\nimport {\n blackDuckReportRepositories,\n projectedBlackDuckRepositoryUrl,\n} from \"./blackduck-findings.js\";\nimport { checkmarxSelection } from \"./checkmarx-repository.js\";\nimport { continuumReportRepositories } from \"./continuum-findings.js\";\nimport { veracodeReportRepositories } from \"./veracode-findings.js\";\nimport { inspectorReportRepository } from \"./inspector-findings.js\";\nimport { sonarRepositoryUrls } from \"./sonar-findings.js\";\nimport {\n checkRetainedTrivyProvider,\n checkTrivyReportProvider,\n isTrivyReportHeader,\n retainedTrivyReport,\n trivyBatchSourceUrls,\n validateTrivyRepositoryUrl,\n} from \"./trivy-import.js\";\nimport {\n NoPublishableFindingsError,\n reportForJson,\n snapshotSourceRepositories,\n type ExternalSourceRepository,\n snapshotImportOptions,\n cloneImportPreview,\n snapshotNormalizedFindings,\n type ExternalFindings,\n} from \"./external-findings.js\";\nimport {\n canonicalNumber,\n cloudRepositoryUrlKey,\n validateImportRequest,\n validateExternalEvidence,\n validateExternalReport,\n validateImportReceipt,\n validateRepositories,\n validateSourceReports,\n validateSourceReport,\n} from \"./external-import-contract.js\";\nimport type {\n FindingImportRequest,\n FindingImportReceipt,\n ImportRepository,\n Provider,\n SourceReportSummary,\n} from \"./external-import-models.js\";\n\nconst MAX_REQUEST_BYTES = 5 * 1024 * 1024;\n\n/** Source and destination for evidence already normalized to the Cloud contract. */\nexport interface NormalizedExternalPublicationOptions {\n repository: string;\n provider: FindingImportRequest[\"source\"][\"provider\"];\n sourceKey: string;\n /** Full Inspector project ARNs mapped to independently verified repository URLs. */\n inspectorProjectMap?: ReadonlyMap<string, string>;\n}\n\n/** File readers accepted by the Cloud publisher. */\nexport interface ExternalPublicationOptions extends LocalExternalImportOptions {\n provider: CloudFindingsReader;\n}\n\n/** Optional transport, account, cancellation, and progress hooks. */\nexport interface ExternalPublicationDependencies {\n /** Independently verified source repositories supplied by the reader. */\n sourceRepositories?: readonly ExternalSourceRepository[];\n environment?: NodeJS.ProcessEnv;\n fetch?: (url: string, options: RequestInit) => Promise<Response>;\n credentials?: () => Promise<{ access_token: string; account_id: string }>;\n signal?: AbortSignal;\n onProgress?: (event: ExternalPublicationProgress) => void;\n}\n\nexport interface ExternalPublicationProgress {\n phase:\n | \"reading\"\n | \"discovering\"\n | \"preparing\"\n | \"waiting\"\n | \"uploading\"\n | \"verifying\";\n completed: number;\n total?: number;\n}\n\n/** Counts describe acknowledged receipts, even when later transport or readback fails. */\nexport interface ExternalPublicationResult {\n cloudApiUrl: string;\n cloudUrl?: string;\n status: \"complete\" | \"partial\" | \"interrupted\";\n read: number;\n report?: ExternalFindings[\"report\"];\n ready: number;\n excluded: ExternalFindings[\"excluded\"];\n receipts: FindingImportReceipt[];\n counts: Required<FindingImportReceipt[\"counts\"]>;\n failures: { source_finding_id: string; code: string; message: string }[];\n unacknowledged: number;\n verified: number;\n error?: string;\n savedSubmission?: string;\n /** Private jobs expose aggregate outcomes before assessment or publication. */\n privateJob?: PrivateImportJob;\n}\n\n/** Preserve accepted work in CLI JSON output when publication cannot finish. */\nexport class ExternalPublicationError extends CodexSecurityError {\n constructor(\n message: string,\n public readonly result: ExternalPublicationResult,\n cause: unknown,\n ) {\n super(message, { cause });\n }\n}\n\ninterface SavedSubmission {\n accountId: string;\n trivyRepositoryUrl?: string;\n requests: FindingImportRequest[];\n receipts?: FindingImportReceipt[];\n repositorySeverities?: string[];\n semgrepPartialScopeDigest?: string;\n /** Catalog URL when this source selection was approved, before any repository rename. */\n approvedRepositoryUrl?: string;\n approvedRepositoryPlatform?: \"other\";\n inspectorProjectMapRequired?: true;\n}\n\nexport interface ExternalPublicationPreview extends ExternalFindings {\n cloudApiUrl: string;\n cloudUrl?: string;\n accountId: string;\n destination: ImportRepository;\n source: FindingImportRequest[\"source\"];\n resumed: boolean;\n requests: FindingImportRequest[];\n privateImport?: {\n format: PrivateImportFormat;\n contextVersion: string;\n sha256: string;\n bytes: number;\n retryOfJobId?: string;\n };\n}\n\n/** Bind reviewed evidence to its account, repository, connector and destination version. */\nexport function cloudReviewDigest(\n preview: ExternalPublicationPreview,\n checkout: string,\n findings?: readonly { id: string; version: number }[],\n) {\n return hash(\n \"sha256\",\n canonicalJson({\n checkout,\n api: preview.cloudApiUrl,\n account: preview.accountId,\n repository: preview.destination.id,\n connector: preview.destination.repo_connector_id,\n url: preview.destination.url,\n reset: preview.destination.reset_marker,\n source: preview.source,\n privateImport: preview.privateImport,\n ...(findings && { findings, excluded: preview.excluded }),\n items: preview.requests.flatMap((request) =>\n request.items.map((item) => [\n item.source_finding_id,\n item.expected_version,\n request.repository.environment_id,\n item.evidence,\n ]),\n ),\n }),\n );\n}\n\nexport interface PreparedExternalPublication {\n preview: ExternalPublicationPreview;\n publish(): Promise<ExternalPublicationResult>;\n}\n\n/** @internal Persist only the acknowledgements made by the selected Cloud destination. */\ntype RecordPublicationReceipts = (\n scope: Pick<\n ExternalPublicationPreview,\n \"accountId\" | \"cloudApiUrl\" | \"destination\" | \"requests\" | \"findings\"\n >,\n receipts: FindingImportReceipt[],\n privateJobId?: string,\n) => Promise<void>;\n\n/** @internal Keep a stored submission scoped to the finding versions that were approved. */\nexport interface WorkbenchPublication {\n checkout: string;\n findings: readonly { id: string; version: number }[];\n record: RecordPublicationReceipts;\n}\n\ntype BeforeRetire = (result: ExternalPublicationResult) => Promise<void>;\n\n// Limit read concurrency to avoid one network round trip per finding in series.\n// Wait for the entire batch on failure so callers never outlive their read tasks.\nasync function readInBatches<T, U>(\n items: T[],\n read: (item: T) => Promise<U>,\n): Promise<U[]> {\n const output: U[] = [];\n for (let start = 0; start < items.length; start += 4) {\n const batch = await Promise.allSettled(\n items.slice(start, start + 4).map(read),\n );\n for (const result of batch) {\n if (result.status === \"rejected\") throw result.reason;\n output.push(result.value);\n }\n }\n return output;\n}\n\nfunction matchesRepositoryEvidence(\n expected: ExternalFindings[\"findings\"][number][\"evidence\"],\n stored: ExternalFindings[\"findings\"][number][\"evidence\"],\n): boolean {\n const storedWire = canonicalJson(stored);\n if (canonicalJson(expected) === storedWire) return true;\n // A repository can store a literal first-component colon with an explicit\n // relative prefix. Match only that spelling in typed locations and their manifests.\n const qualified = new Map<string, string>();\n const locations = expected.locations?.map((location, index) => {\n const { path } = location;\n const actual = stored.locations?.[index]?.path;\n if (actual !== `./${path}` || !/^[^/:\\\\@]+:[^/\\\\]/u.test(path))\n return location;\n qualified.set(path, actual);\n return { ...location, path: actual };\n });\n if (!qualified.size) return false;\n const packages = expected.packages?.map((item) => {\n const path = item.manifest_path && qualified.get(item.manifest_path);\n return path ? { ...item, manifest_path: path } : item;\n });\n return canonicalJson({ ...expected, locations, packages }) === storedWire;\n}\n\nfunction isCompleteUnscoredOpenGrepReport(report: ExternalFindings) {\n let rows = report.excluded.length;\n for (const { evidence } of report.findings) {\n const traces = evidence.source_data?.[\"results\"];\n if (\n evidence.details?.scanner_origin !== \"OpenGrep\" ||\n evidence.severity !== \"unknown\" ||\n !Array.isArray(traces)\n )\n return false;\n rows += traces.length;\n }\n return rows === report.read;\n}\n\nfunction repositoryFindings(\n report: ExternalFindings,\n severities: readonly string[] | undefined,\n) {\n return severities\n ? report.findings.filter(({ evidence }) =>\n severities.includes(evidence.severity),\n )\n : report.findings;\n}\n\nfunction repositorySelection(\n report: ExternalFindings,\n severities: readonly string[] | undefined,\n sourcePositions: PublicationSelection[\"sourcePositions\"],\n): ExternalFindings {\n const findings = repositoryFindings(report, severities);\n if (findings.length === report.findings.length) return report;\n const excluded = [...report.excluded];\n const skipped = new Set(excluded.map(({ position }) => position));\n function exclude(position: number, id: string | null, severity: string) {\n excluded.push({\n position,\n source_finding_id: id,\n reason: `The repository publisher does not accept severity ${JSON.stringify(severity)}. A local import or an available private inbox can retain this finding.`,\n });\n }\n // Serialized OpenGrep selections retain every trace but lose the reader's\n // position map. All these traces have unknown severity, so the remaining\n // source rows are provably excluded even when their individual IDs are lost.\n if (!sourcePositions && isCompleteUnscoredOpenGrepReport(report)) {\n const id =\n report.findings.length === 1\n ? report.findings[0]!.source_finding_id\n : null;\n for (let row = 1; row <= report.read; row++)\n if (!skipped.has(row)) exclude(row, id, \"unknown\");\n } else {\n const retained = new Set(findings);\n let position = 0;\n for (const finding of report.findings) {\n do {\n position++;\n } while (skipped.has(position));\n if (retained.has(finding)) continue;\n const { source_finding_id, evidence } = finding;\n for (const row of sourcePositions?.get(source_finding_id) ?? [position])\n exclude(row, source_finding_id, evidence.severity);\n }\n }\n return {\n ...report,\n findings,\n excluded: excluded.sort((a, b) => a.position - b.position),\n };\n}\n\nfunction sameSubmission(\n left: SavedSubmission,\n right: SavedSubmission,\n): boolean {\n return (\n left.accountId === right.accountId &&\n left.trivyRepositoryUrl === right.trivyRepositoryUrl &&\n left.inspectorProjectMapRequired === right.inspectorProjectMapRequired &&\n canonicalJson(left.requests) === canonicalJson(right.requests)\n );\n}\n\nfunction wireFinding({\n source_finding_id,\n evidence,\n}: ExternalFindings[\"findings\"][number]) {\n return { source_finding_id, evidence };\n}\n\nfunction submissionFindings(\n requests: readonly FindingImportRequest[],\n): ExternalFindings[\"findings\"] {\n return requests.flatMap((batch) => batch.items.map(wireFinding));\n}\n\nasync function readOptionalFile(path: string): Promise<string | undefined> {\n return (await readFile(path, \"utf8\").catch(nullIfMissingFile)) ?? undefined;\n}\n\nexport function externalPublicationStateDirectory(\n environment: NodeJS.ProcessEnv,\n): string {\n return join(\n codexSecurityStateDirectory(environment),\n \"external-finding-publications\",\n );\n}\n\nexport async function writeAtomicJson(\n path: string,\n value: unknown,\n): Promise<void> {\n const temporary = `${path}.${randomUUID()}.tmp`;\n try {\n const file = await open(temporary, \"wx\", 0o600);\n try {\n await file.writeFile(JSON.stringify(value));\n await file.sync();\n } finally {\n await file.close();\n }\n await rename(temporary, path);\n } finally {\n await rm(temporary, { force: true });\n }\n}\n\nfunction sourcePath(repository: ImportRepository): string {\n return `/repository_connectors/${encodeURIComponent(repository.repo_connector_id)}/repositories/${encodeURIComponent(repository.id)}/source_reports`;\n}\n\nclass CloudImportError extends CodexSecurityError {\n constructor(\n public readonly status: number,\n message: string,\n ) {\n super(message);\n }\n}\n\nfunction validatePublicationReceipt(\n value: unknown,\n batch: FindingImportRequest,\n): FindingImportReceipt {\n const receipt = validateImportReceipt(value);\n const remaining = new Set(batch.items.map((item) => item.client_id));\n if (\n receipt.id !== batch.request_id ||\n canonicalJson(receipt.repository) !== canonicalJson(batch.repository) ||\n canonicalJson(receipt.source) !== canonicalJson(batch.source) ||\n receipt.item_count !== batch.items.length ||\n receipt.results.length !== batch.items.length ||\n receipt.results.some((item) => !remaining.delete(item.client_id))\n )\n throw new CodexSecurityError(\n \"Cloud returned a receipt for a different publication.\",\n );\n const actual = { created: 0, updated: 0, unchanged: 0, error: 0 };\n for (const result of receipt.results) {\n actual[result.outcome]++;\n if (result.outcome === \"error\") {\n if (\n !result.error ||\n result.source_report_id !== null ||\n result.observation_id !== null ||\n result.canonical_finding_id !== null ||\n result.version !== null\n )\n throw new CodexSecurityError(\n \"Cloud returned inconsistent item error fields.\",\n );\n } else if (\n result.error !== null ||\n !result.source_report_id ||\n !result.observation_id ||\n !result.canonical_finding_id ||\n result.version === null\n )\n throw new CodexSecurityError(\n \"Cloud returned an incomplete saved finding.\",\n );\n }\n if (canonicalJson(receipt.counts) !== canonicalJson(actual))\n throw new CodexSecurityError(\n \"Cloud returned inconsistent publication counts.\",\n );\n return receipt;\n}\n\nfunction acknowledgedReceipts({ receipts = [], requests }: SavedSubmission) {\n if (receipts.length > requests.length)\n throw new CodexSecurityError(\n \"Saved publication has more receipts than requests.\",\n );\n return receipts.map((receipt, index) =>\n validatePublicationReceipt(receipt, requests[index]!),\n );\n}\n\nasync function withImportLock<T>(\n state: string,\n key: string,\n signal: AbortSignal | undefined,\n operation: () => Promise<T>,\n): Promise<T> {\n if (process.platform === \"win32\")\n await createWindowsOutputDirectory(state, true);\n else await mkdir(state, { recursive: true, mode: 0o700 });\n await validatePreparedOutputDir(state, undefined, true);\n const path = join(state, key + \".lock.sqlite\");\n const metadata = await lstat(path).catch(nullIfMissingFile);\n if (metadata && !metadata.isFile())\n throw new CodexSecurityError(\"The publication lock is not a regular file.\");\n const guard = sqliteDatabaseOpener()(path);\n try {\n if (process.platform !== \"win32\") chmodSync(path, 0o600);\n guard.exec(\"PRAGMA busy_timeout = 0\");\n for (;;) {\n signal?.throwIfAborted();\n try {\n guard.exec(\"BEGIN EXCLUSIVE\");\n break;\n } catch (error) {\n const sqliteError = error as { code?: string; errcode?: number };\n if (sqliteError.errcode !== 5 && sqliteError.code !== \"SQLITE_BUSY\")\n throw error;\n await delay(50, undefined, { signal });\n }\n }\n return await operation();\n } finally {\n guard.close();\n }\n}\n\ntype ResolvedPublicationInput = PublicationSelection & {\n recheckFileRepository?: (\n approvedUrl: string,\n platform?: \"other\",\n ) => Promise<unknown>;\n};\n\ntype PreparePublicationInput =\n | ResolvedPublicationInput\n | ((destination: ImportRepository) => Promise<ResolvedPublicationInput>);\n\nfunction hostedSourceReferences(\n readerSources: readonly ExternalSourceRepository[],\n url?: string,\n sourcePlatform?: string,\n): readonly ExternalSourceRepository[] {\n // The catalog supplies a GitHub identity only when the reader has no SCM mapping.\n const sources =\n readerSources.length || !url\n ? readerSources\n : [{ url, platform: \"github\" as const }];\n return sourcePlatform === \"other\"\n ? sources.filter(({ platform }) => platform !== \"github\")\n : sources;\n}\n\nfunction checkFindingProvider(\n input: ExternalFindings,\n provider: Provider,\n): void {\n function checkFormat(format: unknown) {\n if (format === tenableReportFormat)\n requireCloudReader({ provider: \"tenable\" });\n if (format === guardianSelectionFormat && provider !== \"semgrep\")\n throw new CodexSecurityError(\n \"Use the semgrep provider for Guardian findings.\",\n );\n }\n checkFormat(input.report?.[\"format\"]);\n for (const { source_finding_id, evidence } of input.findings) {\n if (guardianFindingId.test(source_finding_id))\n checkFormat(guardianSelectionFormat);\n checkFormat(evidence.source_data?.[\"format\"]);\n }\n}\n\nexport async function prepareExternalPublication(\n path: string,\n options: ExternalPublicationOptions,\n dependencies: ExternalPublicationDependencies = {},\n): Promise<PreparedExternalPublication> {\n const settings = snapshotImportOptions(options);\n requireCloudReader(settings);\n const readerSources = snapshotSourceRepositories(\n dependencies.sourceRepositories,\n );\n const provider = EXTERNAL_FINDINGS_PROVIDERS[settings.provider];\n let input: PreparePublicationInput;\n let fileRepositories: (() => readonly ExternalSourceRepository[]) | undefined;\n if (settings.provider === \"semgrep\" || settings.provider === \"snyk\") {\n const semgrep = settings.provider === \"semgrep\";\n const report = await (semgrep\n ? readSemgrepReport(path)\n : readScannerJson(path));\n const normalize = async (url?: string, platform?: \"other\") => {\n const references = hostedSourceReferences(\n readerSources,\n url,\n semgrep ? platform : undefined,\n );\n const semgrepOptions = {\n sourceRepositoryUrl: settings.sourceRepositoryUrl,\n sourceRepositories: references,\n };\n const findings = semgrep\n ? normalizeSemgrepFindings(report, semgrepOptions, \"cloud\")\n : await normalizeSnykFile(report, \"cloud\", references);\n return normalizedPublicationInput(findings, provider);\n };\n const hosted =\n isRecord(report) &&\n (semgrep\n ? isSemgrepPlatformFormat(report[\"format\"]) ||\n report[\"format\"] === guardianSelectionFormat\n : isSnykRestFormat(report[\"format\"]));\n if (!semgrep && !hosted)\n fileRepositories = () => snykFileRepositories(report);\n input = hosted\n ? async (destination) => {\n try {\n const projection = await normalize(destination.url);\n if (!semgrep) return projection;\n return {\n ...projection,\n recheckFileRepository: async (approvedUrl, platform) => {\n if (platform === \"other\")\n await normalize(approvedUrl, platform);\n },\n };\n } catch (error) {\n const project = report[\"project\"];\n const candidate =\n report[\"sourceRepositoryUrl\"] ??\n settings.sourceRepositoryUrl ??\n (semgrep && isRecord(project) ? project[\"url\"] : undefined);\n if (typeof candidate !== \"string\" || candidate === destination.url)\n throw error;\n // A renamed repository can require its old spelling to identify the saved request.\n // Only an approved checkpoint can later authorize that spelling.\n const projection = await normalize(\n normalizeHostedGitRepositoryUrl(candidate, destination.url, true),\n );\n return {\n ...projection,\n recheckFileRepository: (approvedUrl, platform) => {\n if (approvedUrl === destination.url) throw error;\n return normalize(approvedUrl, platform);\n },\n };\n }\n }\n : await normalize();\n } else {\n const parsed = await readExternalFindings(path, settings);\n input = normalizedPublicationInput(parsed.findings, provider);\n if (provider === \"endor\")\n fileRepositories = () => parsed.sourceRepositories ?? [];\n }\n return preparePublicationInput(\n input,\n { ...settings, provider },\n dependencies,\n readerSources,\n undefined,\n settings.sourceRepositoryUrl,\n fileRepositories,\n );\n}\n\n/** Prepare normalized provider evidence without reading a vendor export. */\nexport async function prepareNormalizedExternalPublication(\n input: ExternalFindings,\n options: NormalizedExternalPublicationOptions,\n dependencies: ExternalPublicationDependencies = {},\n): Promise<PreparedExternalPublication> {\n return prepareNormalizedPublication(input, options, dependencies);\n}\n\n/** @internal The workbench persists acknowledgements before a repository checkpoint is retired. */\nexport async function prepareNormalizedPublication(\n input: ExternalFindings,\n options: NormalizedExternalPublicationOptions,\n dependencies: ExternalPublicationDependencies,\n workbench?: WorkbenchPublication | \"preview\",\n): Promise<PreparedExternalPublication> {\n const settings = snapshotImportOptions(options);\n requireCloudReader(settings);\n return preparePublicationInput(\n normalizedPublicationInput(input, settings.provider),\n settings,\n dependencies,\n snapshotSourceRepositories(dependencies.sourceRepositories),\n workbench,\n );\n}\n\nfunction cloudSourceKey(\n url: string,\n platform: ExternalSourceRepository[\"platform\"],\n) {\n return hostedRepositoryUrlKey(\n url,\n platform === \"github\",\n platform === \"gitlab\",\n \"cloud\",\n );\n}\n\n/** Verify every source in a hosted selection, including SDK inputs containing typed-only rows. */\nfunction hostedRepositoryMatcher(\n input: ExternalFindings & Partial<SnykIssuesFindings>,\n provider: NormalizedExternalPublicationOptions[\"provider\"],\n declaredUrl: string | undefined,\n destination: Pick<ImportRepository, \"url\">,\n readerSources: readonly ExternalSourceRepository[],\n): { github: boolean; matches: (url: string) => boolean } | undefined {\n const references = hostedSourceReferences(\n readerSources,\n destination.url,\n input.sourceRepositoryPlatform,\n );\n if (provider === \"snyk\") {\n const declaredSource =\n input.sourceRepositoryUrl !== undefined ||\n input.sourceRepositoryPlatform !== undefined ||\n declaredUrl !== undefined ||\n readerSources.length > 0;\n const binding = snykRestImportRepository(\n input,\n provider,\n [\n ...readerSources.map(({ url }) => url),\n ...(declaredUrl === undefined ? [] : [declaredUrl]),\n ],\n references,\n undefined,\n declaredSource ? destination.url : undefined,\n );\n if (binding)\n return {\n github: binding.platform === \"github\",\n matches: (url) => snykRestRepositoryMatches(binding, url),\n };\n }\n if (provider !== \"semgrep\") return;\n\n const declared =\n input.sourceRepositoryUrl === undefined\n ? undefined\n : hostedRepositoryUrl(\n input.sourceRepositoryUrl,\n \"Semgrep source repository\",\n );\n const reportScope = semgrepPlatformReportScope(input, provider, references);\n const hasNativeSource =\n reportScope !== undefined ||\n input.findings.some((finding) =>\n isSemgrepPlatformEvidence(finding, provider),\n );\n const claims = new Set<string>();\n let original =\n input.report?.[\"format\"] === guardianSelectionFormat\n ? declaredScannerRepositoryUrl(input.report[\"repositoryUrl\"], \"Guardian\")\n : undefined;\n const nativeRows = [];\n for (const finding of input.findings) {\n const typed = finding.evidence.details?.repository?.url;\n if (typed) claims.add(typed);\n const guardian = guardianFindingRepository(finding, \"cloud\");\n if (guardian) {\n original ??= guardian;\n claims.add(guardian);\n continue;\n }\n const sarif = semgrepSarifRepositories(finding, hasNativeSource);\n for (const { url } of sarif)\n claims.add(hostedRepositoryUrl(url, \"Semgrep source repository\"));\n nativeRows.push({ finding, sarif });\n }\n for (const { finding, sarif } of nativeRows) {\n const native = semgrepPlatformFindingBinding(\n finding,\n provider,\n references,\n reportScope,\n [{ url: projectedBlackDuckRepositoryUrl(finding, \"cloud\") }, ...sarif],\n \"cloud\",\n )?.url;\n if (native) {\n original ??= native;\n claims.add(native);\n }\n }\n const source =\n original ??\n declared ??\n declaredUrl ??\n (readerSources.length || input.sourceRepositoryPlatform !== undefined\n ? destination.url\n : undefined);\n if (source === undefined) return;\n const { platform } = semgrepPlatformRepositoryReference(source, references);\n const expected = cloudSourceKey(source, platform);\n const matches = (url: string) => cloudSourceKey(url, platform) === expected;\n if (declared !== undefined) claims.add(declared);\n if (declaredUrl !== undefined) claims.add(declaredUrl);\n for (const reader of readerSources)\n claims.add(\n normalizeHostedGitRepositoryUrl(\n reader.url,\n source,\n reader.platform !== undefined,\n ),\n );\n for (const url of claims)\n if (!matches(hostedRepositoryUrl(url, \"Semgrep source repository\")))\n throw new CodexSecurityError(\n \"The finding does not match the original Semgrep project repository.\",\n );\n return { github: platform === \"github\", matches };\n}\n\ninterface PublicationSelection {\n current: ExternalFindings;\n sourcePositions?: ReadonlyMap<string, readonly number[]>;\n}\n\nfunction ownData(value: unknown, key: string) {\n return isRecord(value) && !isProxy(value)\n ? (Object.getOwnPropertyDescriptor(value, key)?.value as unknown)\n : undefined;\n}\n\nfunction publicationIdentity(\n parsed: ExternalFindings,\n provider?: NormalizedExternalPublicationOptions[\"provider\"],\n) {\n // For Trivy, the independently checked header binds the repository. Files\n // and normalized rows use the same checkpoint when their findings agree.\n if (\n parsed.report === undefined ||\n (provider === \"trivy\" && isTrivyReportHeader(parsed.report))\n )\n return parsed.findings;\n return { findings: parsed.findings, report: reportForJson(parsed.report) };\n}\n\nfunction validatePublicationFindings(parsed: ExternalFindings) {\n validateExternalReport(parsed.report);\n const ids = new Set<string>();\n for (const finding of parsed.findings) {\n const id = finding.source_finding_id;\n if (!id.trim() || id.includes(\"\\0\") || Buffer.byteLength(id) > 512)\n throw new CodexSecurityError(\n \"Source finding id must contain 1–512 UTF-8 bytes and no NUL characters.\",\n );\n if (ids.has(id))\n throw new CodexSecurityError(\n `Duplicate source finding id ${JSON.stringify(id)}.`,\n );\n ids.add(id);\n finding.evidence = validateExternalEvidence(finding.evidence);\n }\n}\n\nfunction normalizedPublicationInput(\n input: ExternalFindings & Partial<SnykIssuesFindings>,\n provider: NormalizedExternalPublicationOptions[\"provider\"],\n): PublicationSelection {\n const current = snapshotNormalizedFindings(\n input,\n undefined,\n \"cloud\",\n provider,\n );\n if (current.snykRestContext !== undefined) {\n if (provider !== \"snyk\")\n throw new CodexSecurityError(\n \"Snyk REST evidence requires the snyk provider.\",\n );\n if (!isSnykRestFormat(current.snykRestContext?.[\"format\"]))\n throw new CodexSecurityError(\n \"Expected a versioned Snyk REST report context.\",\n );\n }\n const markedSemgrep =\n \"sourceFormat\" in current && isSemgrepPlatformFormat(current.sourceFormat);\n if (markedSemgrep && provider !== \"semgrep\")\n throw new CodexSecurityError(\n \"Semgrep Platform evidence requires the semgrep provider.\",\n );\n if (markedSemgrep || \"semgrepPlatformScope\" in current)\n semgrepPlatformReportScope(current, provider);\n validatePublicationFindings(current);\n checkFindingProvider(current, provider);\n return {\n current,\n sourcePositions: getOpenGrepSourcePositions(ownData(input, \"findings\")),\n };\n}\n\n// A normalized hosted input can omit native fields that the authenticated\n// repository and the retained source response establish for each occurrence.\nfunction hostedPublicationFindings(\n current: ExternalFindings & Partial<SnykIssuesFindings>,\n provider: Provider,\n destination: ImportRepository,\n readerSources: readonly ExternalSourceRepository[],\n): ExternalFindings {\n if (provider === \"snyk\") {\n const first = current.findings.find(isSnykRestFinding);\n if (!first && current.snykRestContext === undefined) return current;\n const url =\n current.snykRestContext?.[\"sourceRepositoryUrl\"] ??\n current.sourceRepositoryUrl ??\n first?.evidence.source_data?.[\"sourceRepositoryUrl\"];\n snykRestImportRepository(\n current,\n provider,\n [],\n hostedSourceReferences(\n readerSources,\n typeof url === \"string\" ? url : destination.url,\n current.sourceRepositoryPlatform,\n ),\n (finding, source) => {\n finding.evidence.source_data = source;\n },\n );\n return current;\n }\n if (provider !== \"semgrep\") return current;\n const first = current.findings.find((finding) =>\n isSemgrepPlatformEvidence(finding, provider),\n );\n if (!first) return current;\n const retained = first.evidence.source_data;\n const project = retained?.[\"project\"];\n const url =\n current.sourceRepositoryUrl ??\n retained?.[\"sourceRepositoryUrl\"] ??\n (isRecord(project) ? project[\"url\"] : undefined);\n const references = hostedSourceReferences(\n readerSources,\n typeof url === \"string\"\n ? normalizeHostedGitRepositoryUrl(url, destination.url, true)\n : destination.url,\n current.sourceRepositoryPlatform,\n );\n const scope = semgrepPlatformReportScope(current, provider, references);\n const findings = current.findings.map((finding) => {\n const data = finding.evidence.source_data;\n const original =\n isRecord(data?.[\"finding\"]) &&\n isSemgrepPlatformEvidence(finding, provider);\n if (!original && data?.[\"format\"] !== semgrepPlatformFormat) return finding;\n const binding = semgrepPlatformFindingBinding(\n finding,\n provider,\n references,\n scope,\n undefined,\n \"cloud\",\n );\n return binding?.sourceData &&\n (original || binding.sourceData[\"format\"] !== semgrepPlatformFormat)\n ? {\n ...finding,\n evidence: {\n ...finding.evidence,\n ...binding.migration,\n source_data: binding.sourceData,\n },\n }\n : finding;\n });\n return { ...current, findings };\n}\n\nasync function preparePublicationInput(\n supplied: PreparePublicationInput,\n options: NormalizedExternalPublicationOptions,\n dependencies: ExternalPublicationDependencies,\n readerSources: readonly ExternalSourceRepository[],\n workbench?: WorkbenchPublication | \"preview\",\n declaredUrl?: string,\n fileRepositories?: () => readonly ExternalSourceRepository[],\n): Promise<PreparedExternalPublication> {\n const record = workbench !== \"preview\" && workbench?.record;\n function withReceipts(\n scope: ExternalPublicationPreview,\n prepared: {\n preview: ExternalPublicationPreview;\n publish(beforeRetire?: BeforeRetire): Promise<ExternalPublicationResult>;\n },\n ): PreparedExternalPublication {\n return {\n preview: prepared.preview,\n async publish() {\n if (!record) return prepared.publish();\n let recorded = false;\n const persist = async (result: ExternalPublicationResult) => {\n if (recorded) return;\n recorded = true;\n const job = result.privateJob;\n const privateJobId =\n job?.status === \"completed\" &&\n !result.counts.error &&\n !result.unacknowledged\n ? job.id\n : undefined;\n if (!privateJobId && !result.receipts.length) return;\n try {\n await record(scope, result.receipts, privateJobId);\n } catch (error) {\n throw new ExternalPublicationError(\n `Cloud returned receipts, but the workbench could not record them: ${errorMessage(error)}`,\n result,\n error,\n );\n }\n };\n let result: ExternalPublicationResult;\n try {\n result = await prepared.publish(persist);\n } catch (error) {\n if (error instanceof ExternalPublicationError)\n await persist(error.result);\n throw error;\n }\n await persist(result);\n return result;\n },\n };\n }\n const { inspectorProjectMap } = options;\n const progress = (event: ExternalPublicationProgress): void =>\n notify(() => dependencies.onProgress?.(event));\n if (\n !options.sourceKey.trim() ||\n options.sourceKey.includes(\"\\0\") ||\n Buffer.byteLength(options.sourceKey) > 512\n ) {\n throw new CodexSecurityError(\n \"The source key must contain 1–512 UTF-8 bytes and no NUL characters. Use a stable scanner organization/project/branch namespace across imports.\",\n );\n }\n const environment = dependencies.environment ?? process.env;\n dependencies.signal?.throwIfAborted();\n progress({ phase: \"reading\", completed: 0 });\n const trivyReportUrls =\n options.provider === \"trivy\" && typeof supplied !== \"function\"\n ? trivyBatchSourceUrls(\n supplied.current,\n supplied.current.findings.length > 0,\n )\n : undefined;\n if (trivyReportUrls) validateTrivyRepositoryUrl(options.repository);\n const catalogKey = trivyReportUrls\n ? (url: string) => cloudSourceKey(url, \"github\")\n : cloudRepositoryUrlKey;\n const state = externalPublicationStateDirectory(environment);\n function checkSelection(input: PublicationSelection) {\n const parsed = input.current;\n checkTrivyReportProvider(options.provider, parsed.report);\n for (const finding of parsed.findings)\n checkRetainedTrivyProvider(options.provider, finding);\n if (!parsed.findings.length) throw new NoPublishableFindingsError(parsed);\n }\n if (typeof supplied !== \"function\") checkSelection(supplied);\n progress({ phase: \"discovering\", completed: 0 });\n const apiBaseUrl = cloudBaseUrl(environment);\n const cloudApiUrl = `${apiBaseUrl}/external`;\n // Validate the configured return destination before authentication or uploads.\n cloudFindingsUrl(environment, options.repository);\n const credentials = await (\n dependencies.credentials ??\n (() => readCloudCredentials(environment, dependencies.signal))\n )();\n let canStartJob = false;\n let repositorySeverities: string[] | undefined;\n const jobVersionHeader = \"Codex-Security-Private-Import-Job-Version\";\n const providerJobVersion = privateJobVersions[options.provider];\n // Older services recognize an exact v2 request for AWS. Only ask for v3\n // when publishing a provider introduced by that contract.\n const requestedJobVersion = String(providerJobVersion ?? 2);\n let jobApiVersion: typeof providerJobVersion;\n async function request(\n endpoint: string,\n body?: FindingImportRequest,\n ): Promise<unknown> {\n dependencies.signal?.throwIfAborted();\n // Allow upload and response transport around the server's publication budget.\n const timeout = AbortSignal.timeout(body ? 60_000 : 30_000);\n const repositoryCatalog = endpoint.startsWith(\"/repositories?\");\n const response = await (dependencies.fetch ?? globalThis.fetch)(\n `${cloudApiUrl}${endpoint}`,\n {\n method: body ? \"POST\" : \"GET\",\n headers: {\n Authorization: `Bearer ${credentials.access_token}`,\n \"ChatGPT-Account-ID\": credentials.account_id,\n Accept: \"application/json\",\n ...(repositoryCatalog\n ? { [jobVersionHeader]: requestedJobVersion }\n : {}),\n ...(body ? { \"Content-Type\": \"application/json\" } : {}),\n },\n ...(body ? { body: JSON.stringify(body) } : {}),\n redirect: \"error\",\n signal: dependencies.signal\n ? AbortSignal.any([dependencies.signal, timeout])\n : timeout,\n },\n );\n if (!response.ok) {\n const payload = (await response.json().catch(() => null)) as {\n error?: { message?: string };\n } | null;\n const retryAfter = response.headers.get(\"Retry-After\");\n const detail = payload?.error?.message ?? response.statusText;\n let message = `Cloud import failed (HTTP ${response.status}).`;\n if (detail) message += ` ${detail}`;\n if (repositoryCatalog && response.status === 404) {\n if (!/[.!?]$/u.test(message)) message += \".\";\n message +=\n \" Cloud import is not available for this account or deployment.\";\n }\n if (retryAfter) message += ` Retry-After: ${retryAfter}.`;\n throw new CloudImportError(response.status, message);\n }\n if (repositoryCatalog) {\n const advertised = (header: string) =>\n response.headers\n .get(header)\n ?.split(\",\")\n .map((item) => item.trim());\n repositorySeverities = advertised(\n \"Codex-Security-Repository-Import-Severities\",\n );\n canStartJob =\n advertised(\"Codex-Security-Private-Import-Providers\")?.includes(\n options.provider,\n ) ?? false;\n jobApiVersion =\n response.headers.get(jobVersionHeader) === requestedJobVersion\n ? providerJobVersion\n : undefined;\n }\n return response.json();\n }\n async function discoverDestination(): Promise<ImportRepository> {\n const destinations: ImportRepository[] = [];\n let page: string | null = null;\n const seenPages = new Set<string>();\n do {\n const result = validateRepositories(\n await request(\n `/repositories?limit=20&repository=${encodeURIComponent(options.repository)}${page ? `&page=${encodeURIComponent(page)}` : \"\"}`,\n ),\n );\n destinations.push(\n ...result.data.filter(\n (item) =>\n item.id === options.repository ||\n catalogKey(item.url) === catalogKey(options.repository),\n ),\n );\n page = result.next;\n if (\n result.has_more !== (page !== null) ||\n (page !== null && seenPages.has(page))\n )\n throw new CodexSecurityError(\n \"Cloud returned invalid repository pagination.\",\n );\n if (page !== null) seenPages.add(page);\n } while (page !== null);\n if (destinations.length !== 1)\n throw new CodexSecurityError(\n destinations.length\n ? \"The repository matches multiple connectors. Select an unambiguous Cloud repository.\"\n : \"The destination repository is not available to this Cloud account. Copy its repository URL or ID from Codex Security Cloud and check that you are signed into the intended account.\",\n );\n const destination = destinations[0]!;\n if (trivyReportUrls) validateTrivyRepositoryUrl(destination.url);\n return destination;\n }\n const destination = await discoverDestination();\n const deferred = typeof supplied === \"function\";\n const resolved = deferred ? await supplied(destination) : supplied;\n if (deferred) checkSelection(resolved);\n const report: ExternalFindings & Partial<SnykIssuesFindings> =\n resolved.current;\n const source = { provider: options.provider, source_key: options.sourceKey };\n const importPrefix = source.provider === \"sonar\" ? \"/v2\" : \"\";\n const sourceReportsPath = importPrefix + sourcePath(destination);\n const hosted = options.provider === \"snyk\" || options.provider === \"semgrep\";\n const parsed = hostedPublicationFindings(\n report,\n options.provider,\n destination,\n readerSources,\n );\n const key = hash(\n \"sha256\",\n canonicalJson([\n \"external-findings/2\",\n apiBaseUrl,\n credentials.account_id,\n destination.id,\n destination.repo_connector_id,\n source,\n publicationIdentity(parsed, options.provider),\n ...(workbench === \"preview\"\n ? [\"preview\"]\n : workbench\n ? [workbench.checkout, workbench.findings]\n : []),\n ]),\n );\n const pendingPath = join(state, key + \".pending.json\");\n const underPublishLock = <T>(operation: () => Promise<T>) =>\n withImportLock(state, key, dependencies.signal, operation);\n const removePending = () => rm(pendingPath, { force: true });\n const privateClient = privateImportClient(\n apiBaseUrl,\n credentials,\n dependencies.fetch ?? globalThis.fetch,\n dependencies.signal,\n );\n const scopedSemgrepReport =\n options.provider === \"semgrep\" &&\n \"sourceFormat\" in parsed &&\n isSemgrepPlatformFormat(parsed.sourceFormat);\n function wasReset(content: SavedSubmission) {\n return content.requests.some(\n ({ repository }) => repository.reset_marker !== destination.reset_marker,\n );\n }\n async function confirmReset() {\n // A newer pending request may have been written while the catalog response\n // was in flight. Confirm the reset after observing this immutable request.\n const confirmed = await discoverDestination();\n if (\n confirmed.id !== destination.id ||\n confirmed.repo_connector_id !== destination.repo_connector_id ||\n confirmed.reset_marker !== destination.reset_marker\n )\n throw new CodexSecurityError(\n \"The repository changed while preparing this publication. Review the destination again.\",\n );\n }\n function suppliedSemgrepScopeDigest() {\n const scope = semgrepPlatformReportScope(report, options.provider);\n return hash(\n \"sha256\",\n canonicalJson(\n scope?.format\n ? [\n scope.deployment,\n canonicalNumber(scope.projectId),\n scope.ref,\n scope.product,\n ]\n : null,\n ),\n );\n }\n function readSaved(\n content: SavedSubmission | null | undefined,\n ): SavedSubmission {\n if (\n !content ||\n content.accountId !== credentials.account_id ||\n !Array.isArray(content.requests) ||\n content.requests.length === 0\n )\n throw new Error(\"Saved import account or requests do not match.\");\n content.requests = content.requests.map(validateImportRequest);\n const actual = submissionFindings(content.requests);\n for (const finding of actual)\n checkRetainedTrivyProvider(options.provider, finding);\n if (\n content.requests.some(\n (batch) =>\n batch.repository.id !== destination.id ||\n batch.repository.repo_connector_id !==\n destination.repo_connector_id ||\n canonicalJson(batch.source) !== canonicalJson(source),\n )\n )\n throw new Error(\"Saved import destination does not match.\");\n checkFindingProvider({ ...parsed, findings: actual }, options.provider);\n const expected = repositoryFindings(parsed, content.repositorySeverities);\n if (canonicalJson(actual) !== canonicalJson(expected.map(wireFinding)))\n throw new CodexSecurityError(\n \"Saved import evidence does not match the selected input.\",\n );\n const scope = content.semgrepPartialScopeDigest;\n if (\n scope !== undefined &&\n !wasReset(content) &&\n scope !== suppliedSemgrepScopeDigest()\n )\n throw new CodexSecurityError(\n \"The supplied Semgrep report scope does not match the approved request.\",\n );\n return content;\n }\n async function readPending() {\n const bytes = await readOptionalFile(pendingPath);\n return bytes === undefined ? undefined : readSaved(JSON.parse(bytes));\n }\n async function readCompletedPublication(requests: FindingImportRequest[]) {\n const bytes = await readOptionalFile(join(state, key + \".result.json\"));\n if (bytes === undefined) return;\n const result = JSON.parse(bytes) as ExternalPublicationResult;\n if (\n (result.status === \"complete\" || result.status === \"partial\") &&\n result.receipts.length === requests.length &&\n result.receipts.every((r, i) => r.id === requests[i]!.request_id)\n )\n return {\n receipts: result.receipts.map((r, i) =>\n validatePublicationReceipt(r, requests[i]!),\n ),\n verified: result.verified,\n };\n }\n await validatePreparedOutputDir(state, undefined, true).catch(\n nullIfMissingFile,\n );\n const saved = await readPending();\n if (saved && wasReset(saved)) {\n await underPublishLock(async () => {\n const current = await readPending();\n if (current && sameSubmission(current, saved)) {\n await confirmReset();\n if (record && current.receipts?.length) {\n await record(\n {\n cloudApiUrl,\n accountId: credentials.account_id,\n destination,\n requests: current.requests,\n findings: [],\n },\n acknowledgedReceipts(current),\n );\n }\n await removePending();\n }\n });\n throw new CloudImportError(\n 409,\n \"The repository was reset after this submission. The saved request was retired without uploading. Review the destination and run the command again to approve a fresh publication.\",\n );\n }\n if (saved?.inspectorProjectMapRequired && !inspectorProjectMap)\n throw new CodexSecurityError(\n \"Supply the verified Inspector project binding again to resume.\",\n );\n\n // Existing repository submissions keep their original request bodies and receipts.\n const privatePath = join(state, `${key}.private-import.json`);\n const readPrivate = async () =>\n parsePrivateCheckpoint(await readOptionalFile(privatePath));\n const privateSaved = await readPrivate();\n const usePrivateImport =\n !saved && (canStartJob || privateSaved !== undefined);\n async function preparePrivateAttempt() {\n const context = await privateClient.context();\n if (source.source_key.trim() !== source.source_key)\n throw new CodexSecurityError(\n \"A private source key cannot have leading or trailing whitespace.\",\n );\n const report = selectPrivateReport(\n parsed.findings,\n source.provider,\n context,\n privateSaved?.contextVersion === context.context_version\n ? privateSaved.format\n : undefined,\n );\n const binding = {\n format: report.format,\n apiBaseUrl,\n accountId: credentials.account_id,\n source,\n repository: {\n id: destination.id,\n repo_connector_id: destination.repo_connector_id,\n },\n sha256: report.digest,\n contextVersion: context.context_version,\n };\n return { context, report, binding };\n }\n function acceptsJob(\n context: PrivateImportContext,\n format: PrivateImportFormat,\n ) {\n return context.can_create_import_jobs && context.formats.includes(format);\n }\n // Use an earlier catalog URL only after the account, connector, repository,\n // inbox context and exact upload digest all match the immutable checkpoint.\n const privateAttempt = usePrivateImport\n ? await preparePrivateAttempt()\n : undefined;\n const previous =\n privateAttempt &&\n readPrivateCheckpoint(privateSaved, privateAttempt.binding);\n const retryOfJobId =\n unsuccessfulJob(previous?.receipt) &&\n canStartJob &&\n privateAttempt?.context.can_upload &&\n acceptsJob(privateAttempt.context, privateAttempt.report.format)\n ? previous?.jobId\n : undefined;\n const resumed = previous !== undefined && retryOfJobId === undefined;\n const privateApproval = resumed ? previous : undefined;\n const privateUrl = privateApproval?.approvedRepositoryUrl;\n const approvedPlatform =\n saved?.approvedRepositoryPlatform ??\n privateApproval?.approvedRepositoryPlatform;\n\n // The findings-only checkpoint key lets projected and native callers resume one immutable\n // request. Supplemental report claims are outside that digest and must still match its source.\n const approvedUrl =\n saved?.approvedRepositoryUrl ??\n saved?.trivyRepositoryUrl ??\n privateUrl ??\n destination.url;\n const sourceFor = (url: string, platform?: \"other\") =>\n hostedRepositoryMatcher(\n platform ? { ...report, sourceRepositoryPlatform: platform } : report,\n options.provider,\n declaredUrl,\n { url },\n readerSources,\n );\n if (\n readerSources.some(({ platform, url }) => {\n const source = normalizeHostedGitRepositoryUrl(\n url,\n approvedUrl,\n platform !== undefined,\n );\n return (\n cloudSourceKey(source, platform) !==\n cloudSourceKey(approvedUrl, platform)\n );\n })\n )\n throw new CodexSecurityError(\n \"The reader's source repository does not match the selected Cloud repository.\",\n );\n await resolved.recheckFileRepository?.(approvedUrl, approvedPlatform);\n const hostedSource = hosted\n ? sourceFor(approvedUrl, approvedPlatform)\n : undefined;\n const matchesHostedRepository = hostedSource?.matches;\n function requireApprovedSource(url: string, platform?: \"other\") {\n const binding =\n platform && hostedSource?.github\n ? sourceFor(url, platform)\n : hostedSource;\n if (binding && !binding.matches(url))\n throw new CodexSecurityError(\n \"The source project does not match the selected Cloud repository.\",\n );\n }\n requireApprovedSource(approvedUrl);\n\n const trivyTarget =\n saved?.trivyRepositoryUrl ?? privateUrl ?? destination.url;\n function requireTrivyRemote(url: string, id?: string) {\n if (trivyRemoteKey(url, trivyTarget) !== catalogKey(trivyTarget)) {\n const label =\n id === undefined ? \"Source report\" : `Finding ${JSON.stringify(id)}`;\n throw new CodexSecurityError(\n `${label} belongs to ${JSON.stringify(url)}, which does not match the selected Cloud repository ${JSON.stringify(trivyTarget)}. Verify the source repository mapping before publishing.`,\n );\n }\n }\n for (const url of trivyReportUrls ?? []) requireTrivyRemote(url);\n\n function checkRepositories(\n { findings, report }: Pick<ExternalFindings, \"findings\" | \"report\">,\n historical = Boolean(saved),\n ) {\n const { provider } = options;\n checkTrivyReportProvider(provider, report);\n // A catalog casing or spelling change keeps the original source comparison target.\n const approved = hosted ? saved?.approvedRepositoryUrl : undefined;\n const sameCatalog =\n approved !== undefined &&\n cloudSourceKey(approved, \"github\") ===\n cloudSourceKey(destination.url, \"github\");\n const comparisonUrl = trivyReportUrls\n ? trivyTarget\n : sameCatalog\n ? approved\n : (privateUrl ?? destination.url);\n const key = sameCatalog\n ? (url: string) =>\n cloudSourceKey(\n url,\n saved?.approvedRepositoryPlatform === \"other\"\n ? undefined\n : \"github\",\n )\n : catalogKey;\n function requireDestination(id: string, url: string | null | undefined) {\n if (\n url &&\n (matchesHostedRepository\n ? !matchesHostedRepository(url) ||\n !matchesHostedRepository(comparisonUrl)\n : key(url) !== key(comparisonUrl))\n )\n throw new CodexSecurityError(\n `Finding ${JSON.stringify(id)} belongs to ${JSON.stringify(url)}, which does not match the selected Cloud repository ${JSON.stringify(destination.url)}. Verify the source repository mapping before publishing.`,\n );\n }\n if (provider === \"armorcode\")\n requireDestination(\"ArmorCode source\", declaredUrl);\n if (report?.[\"format\"] === guardianSelectionFormat)\n requireDestination(\n \"Guardian source\",\n declaredScannerRepositoryUrl(report[\"repositoryUrl\"], \"Guardian\"),\n );\n // An immutable retry may refer to an earlier repository name. Additional\n // file declarations outside its saved findings authorize no new writes.\n if (!historical)\n for (const { url } of fileRepositories?.() ?? [])\n requireDestination(\n \"Source report\",\n provider === \"snyk\"\n ? normalizeHostedGitRepositoryUrl(url, destination.url, true)\n : url,\n );\n // Historical checkpoints already fixed the provider and request bytes.\n // Recheck any projected source against the destination discovered for this retry.\n const checkNative = (...providers: (typeof provider)[]) =>\n !historical ||\n trivyReportUrls !== undefined ||\n providers.includes(provider);\n if (checkNative(\"sonar\")) {\n for (const url of sonarRepositoryUrls(\n provider,\n findings,\n report,\n \"cloud\",\n ))\n requireDestination(\"Sonar source\", url);\n }\n const checkmarx = checkmarxSelection(\n provider,\n findings,\n report,\n \"cloud\",\n historical,\n );\n requireDestination(\"Checkmarx source\", checkmarx.reportUrl);\n const blackDuck = checkNative(\"blackduck\")\n ? blackDuckReportRepositories(provider, findings, \"cloud\")\n : undefined;\n const checkmarxRepository = checkmarx.repositories();\n for (const [scanner, repositories] of [\n [\"veracode\", veracodeReportRepositories],\n [\"continuum\", continuumReportRepositories],\n ] as const) {\n if (!checkNative(scanner)) continue;\n for (const [id, source] of repositories(provider, findings, \"cloud\"))\n requireDestination(id, source.url);\n }\n if (checkNative(\"blackduck\", \"inspector\", \"veracode\")) {\n const binding = inspectorReportRepository(\n provider,\n findings,\n \"cloud\",\n inspectorProjectMap,\n );\n if (binding) requireDestination(binding.findingId, binding.url);\n }\n const checkOnlyProjected = !checkNative(\n \"armorcode\",\n \"blackduck\",\n \"inspector\",\n \"veracode\",\n \"checkmarx\",\n \"continuum\",\n \"sonar\",\n );\n for (const finding of findings) {\n const { source_finding_id: id, evidence } = finding;\n const guardian = guardianFindingRepository(finding, \"cloud\");\n if (guardian) {\n requireDestination(id, guardian);\n requireDestination(id, evidence.details?.repository?.url);\n }\n checkRetainedTrivyProvider(provider, finding);\n if (trivyReportUrls) {\n const remote = trivyRepositoryUrl(\n retainedTrivyReport(finding),\n trivyTarget,\n );\n if (remote) requireTrivyRemote(remote, id);\n }\n const blackDuckUrl = blackDuck\n ? blackDuck.get(id)?.url\n : projectedBlackDuckRepositoryUrl(finding, \"cloud\");\n const hasProjection =\n !!blackDuckUrl || checkmarx.projections.has(finding);\n if (checkOnlyProjected && !hasProjection) continue;\n let urls = [\n blackDuckUrl,\n checkmarxRepository(finding)?.url,\n evidence.details?.repository?.url,\n ];\n if (provider === \"armorcode\") {\n urls.push(armorCodeRepositoryUrl(evidence.source_data, \"cloud\"));\n } else if (provider === \"wiz\") {\n const native =\n hasProjection ||\n (!historical && isWizPackageFinding(evidence.source_data));\n urls.push(\n native\n ? wizFindingRepository(evidence, \"cloud\")?.url\n : wizCsvRepositoryUrl(evidence),\n );\n } else if (provider === \"snyk\") {\n urls = urls.concat(\n snykRepositoryUrls(evidence.source_data, {\n cloudRepositoryUrl: destination.url,\n }),\n );\n } else if (provider === \"endor\") {\n urls = urls.concat(\n endorRepositoryUrls(\n evidence.source_data,\n !blackDuck && !blackDuckUrl,\n ),\n );\n } else if (provider === \"github\") {\n if (!historical) urls.push(retainedGitHubRepository(finding));\n urls.push(dependabotRepository(finding));\n }\n for (const url of urls) requireDestination(id, url);\n }\n }\n if (!saved) {\n for (const finding of parsed.findings) {\n if (\n options.provider !== \"semgrep\" &&\n isSemgrepPlatformEvidence(finding, options.provider)\n )\n throw new CodexSecurityError(\n \"Semgrep Platform evidence requires the semgrep provider.\",\n );\n if (options.provider !== \"snyk\" && isSnykRestFinding(finding))\n throw new CodexSecurityError(\n \"Snyk REST evidence requires the snyk provider.\",\n );\n }\n }\n if (!privateAttempt) checkRepositories(parsed);\n if (privateAttempt) {\n const client = privateClient;\n const { context, report, binding } = privateAttempt;\n function requireAccess(value: typeof context, saved: typeof previous) {\n if (\n !value.can_read ||\n (!saved && !canStartJob) ||\n (!saved?.jobId &&\n ((!saved?.fileId && !value.can_upload) ||\n !acceptsJob(value, report.format)))\n )\n throw new CodexSecurityError(\n \"Private findings import is unavailable for this account or report format.\",\n );\n }\n checkRepositories(parsed, resumed);\n requireAccess(context, previous);\n const privateImport = {\n format: report.format,\n contextVersion: binding.contextVersion,\n sha256: report.digest,\n bytes: Buffer.byteLength(report.bytes),\n ...(retryOfJobId ? { retryOfJobId } : {}),\n };\n const preview: ExternalPublicationPreview = {\n ...parsed,\n cloudApiUrl: `${apiBaseUrl}/finding-imports`,\n accountId: credentials.account_id,\n destination,\n source,\n resumed,\n requests: [],\n privateImport,\n };\n return withReceipts(preview, {\n preview: structuredClone(preview),\n publish: () =>\n underPublishLock(async () => {\n const current = await client.context();\n if (current.context_version !== binding.contextVersion)\n throw new CodexSecurityError(\n \"The private inbox changed. Run the command again to review the new destination.\",\n );\n const stored = readPrivateCheckpoint(await readPrivate(), binding);\n if (previous && !stored)\n throw new CodexSecurityError(\n \"The saved private import changed. Run the command again to preview this report.\",\n );\n // Only a preview of this terminal job can start a new attempt.\n const retrying =\n retryOfJobId !== undefined && stored?.receipt?.id === retryOfJobId;\n const active = retrying ? undefined : stored;\n requireAccess(current, active);\n if (await readPending())\n throw new CodexSecurityError(\n \"A repository submission is pending. Review its saved request before continuing.\",\n );\n const checkpoint = active ?? {\n ...binding,\n approvedRepositoryUrl: destination.url,\n approvedRepositoryPlatform:\n hostedSource?.github === false ? (\"other\" as const) : undefined,\n uploadRequestId: randomUUID(),\n jobRequestId: randomUUID(),\n jobApiVersion: retrying ? stored?.jobApiVersion : jobApiVersion,\n fileId: undefined,\n jobId: undefined,\n receipt: undefined,\n previousReceipt: retrying ? stored?.receipt : undefined,\n };\n const result: ExternalPublicationResult = {\n cloudApiUrl: preview.cloudApiUrl,\n status: \"interrupted\",\n read: parsed.read,\n ready: parsed.findings.length,\n report: parsed.report,\n excluded: parsed.excluded,\n receipts: [],\n counts: { created: 0, updated: 0, unchanged: 0, error: 0 },\n failures: [],\n unacknowledged: parsed.findings.length,\n verified: 0,\n };\n function acknowledge(job: PrivateImportJob) {\n const { created, updated, unchanged, error } = job.counts;\n const processed = created + updated + unchanged + error;\n if (\n job.counts.discovered !== processed + job.counts.unprocessed ||\n job.counts.discovered > result.ready ||\n (job.status === \"completed\" &&\n (processed !== result.ready ||\n job.counts.total !== result.ready))\n )\n throw new CodexSecurityError(\n \"Cloud returned counts that do not match the selected report.\",\n );\n result.privateJob = job;\n result.counts = { created, updated, unchanged, error };\n result.unacknowledged = result.ready - processed;\n result.status =\n job.status === \"completed\" && !error && !parsed.excluded.length\n ? \"complete\"\n : \"partial\";\n if (job.error) result.error = job.error.message;\n else delete result.error;\n }\n try {\n const savedReceipt =\n checkpoint.receipt ?? checkpoint.previousReceipt;\n if (savedReceipt) acknowledge(savedReceipt);\n if (!active) await writeAtomicJson(privatePath, checkpoint);\n if (!checkpoint.fileId) {\n progress({ phase: \"uploading\", completed: 0 });\n checkpoint.fileId = await client.upload({\n requestId: checkpoint.uploadRequestId,\n contextVersion: binding.contextVersion,\n ...report,\n recovering: active !== undefined,\n });\n await writeAtomicJson(privatePath, checkpoint);\n }\n progress({ phase: \"verifying\", completed: 0 });\n const job = await client.job(\n {\n requestId: checkpoint.jobRequestId,\n contextVersion: binding.contextVersion,\n fileId: checkpoint.fileId,\n format: report.format,\n source,\n repository: binding.repository,\n jobId: checkpoint.jobId,\n jobApiVersion: checkpoint.jobApiVersion,\n },\n async (id) => {\n checkpoint.jobId = id;\n await writeAtomicJson(privatePath, checkpoint);\n },\n );\n acknowledge(job);\n checkpoint.jobId = job.id;\n checkpoint.receipt = job;\n await writeAtomicJson(privatePath, checkpoint);\n return result;\n } catch (error) {\n result.status = \"interrupted\";\n result.error =\n error instanceof Error ? error.message : String(error);\n result.savedSubmission = privatePath;\n throw new ExternalPublicationError(result.error, result, error);\n }\n }),\n });\n }\n\n // The original selection and request bytes govern a retry even if discovery changes.\n const severities = saved ? saved.repositorySeverities : repositorySeverities;\n const direct = repositorySelection(\n parsed,\n severities,\n resolved.sourcePositions,\n );\n if (!direct.findings.length) throw new NoPublishableFindingsError(direct);\n let requests = saved?.requests;\n if (!requests) {\n let preparedCount = 0;\n progress({\n phase: \"preparing\",\n completed: 0,\n total: direct.findings.length,\n });\n const previousReports = await readInBatches(\n direct.findings,\n async (finding): Promise<SourceReportSummary | undefined> => {\n const query = new URLSearchParams({\n provider: source.provider,\n source_key: source.source_key,\n source_finding_id: finding.source_finding_id,\n limit: \"2\",\n });\n const summaries = validateSourceReports(\n await request(`${sourceReportsPath}?${query}`),\n );\n if (summaries.has_more || summaries.data.length > 1)\n throw new CodexSecurityError(\n \"Cloud returned more than one report for a source identity.\",\n );\n const previous = summaries.data[0];\n if (\n previous &&\n (previous.source_finding_id !== finding.source_finding_id ||\n previous.source.provider !== source.provider ||\n previous.source.source_key !== source.source_key ||\n previous.repo_id !== destination.id ||\n previous.repo_connector_id !== destination.repo_connector_id)\n )\n throw new CodexSecurityError(\n \"Cloud returned a different source identity.\",\n );\n progress({\n phase: \"preparing\",\n completed: ++preparedCount,\n total: direct.findings.length,\n });\n return previous;\n },\n );\n requests = [];\n let current: FindingImportRequest | undefined;\n let currentBytes = 0;\n for (const [index, finding] of direct.findings.entries()) {\n const previous = previousReports[index];\n const environmentId =\n previous?.environment_id ?? destination.import_environment_id;\n if (environmentId == null)\n throw new CodexSecurityError(\n \"Configure an authorized Cloud environment for this repository before importing findings.\",\n );\n const item = {\n client_id: `item-${index + 1}`,\n source_finding_id: finding.source_finding_id,\n expected_version: previous?.version ?? 0,\n evidence: finding.evidence,\n };\n const itemBytes = Buffer.byteLength(JSON.stringify(item));\n if (\n current &&\n (current.repository.environment_id !== environmentId ||\n current.items.length === 100 ||\n currentBytes + 1 + itemBytes > MAX_REQUEST_BYTES)\n ) {\n requests.push(validateImportRequest(current));\n current = undefined;\n }\n if (!current) {\n current = {\n request_id: randomUUID(),\n repository: {\n id: destination.id,\n repo_connector_id: destination.repo_connector_id,\n environment_id: environmentId,\n reset_marker: destination.reset_marker,\n },\n source,\n items: [],\n };\n currentBytes = Buffer.byteLength(JSON.stringify(current));\n } else {\n currentBytes++;\n }\n current.items.push(item);\n currentBytes += itemBytes;\n }\n if (current) requests.push(validateImportRequest(current));\n }\n const bindSemgrepScope =\n !saved &&\n options.provider === \"semgrep\" &&\n report.findings.some(\n (finding) =>\n !isSemgrepPlatformEvidence(finding, \"semgrep\") &&\n (scopedSemgrepReport ||\n hasRetainedSemgrepScope(finding.evidence.source_data?.[\"finding\"])),\n );\n const submission: SavedSubmission = {\n accountId: credentials.account_id,\n ...(trivyReportUrls && { trivyRepositoryUrl: trivyTarget }),\n requests,\n receipts: saved?.receipts,\n repositorySeverities: severities,\n semgrepPartialScopeDigest: bindSemgrepScope\n ? suppliedSemgrepScopeDigest()\n : saved?.semgrepPartialScopeDigest,\n approvedRepositoryUrl: hosted ? approvedUrl : undefined,\n };\n if (\n saved?.approvedRepositoryPlatform ||\n (hostedSource && !hostedSource.github)\n )\n submission.approvedRepositoryPlatform = \"other\";\n if (inspectorProjectMap) submission.inspectorProjectMapRequired = true;\n const preview: ExternalPublicationPreview = {\n ...direct,\n findings: submissionFindings(requests),\n cloudApiUrl,\n cloudUrl: cloudFindingsUrl(environment, destination.id),\n accountId: credentials.account_id,\n destination,\n source,\n resumed: saved !== undefined,\n requests,\n };\n return withReceipts(preview, {\n preview: cloneImportPreview(preview),\n async publish(beforeRetire) {\n progress({ phase: \"waiting\", completed: 0 });\n const result = (\n acknowledged: FindingImportReceipt[],\n verified: number,\n ): ExternalPublicationResult => {\n const counts = { created: 0, updated: 0, unchanged: 0, error: 0 };\n const failures: ExternalPublicationResult[\"failures\"] = [];\n for (const [index, receipt] of acknowledged.entries()) {\n for (const outcome of Object.keys(counts) as (keyof typeof counts)[])\n counts[outcome] += receipt.counts[outcome] ?? 0;\n const ids = new Map(\n requests[index]!.items.map((item) => [\n item.client_id,\n item.source_finding_id,\n ]),\n );\n for (const item of receipt.results)\n if (item.error)\n failures.push({\n source_finding_id: ids.get(item.client_id)!,\n ...item.error,\n });\n }\n return {\n cloudApiUrl,\n cloudUrl: preview.cloudUrl,\n status:\n direct.excluded.length || counts.error ? \"partial\" : \"complete\",\n read: parsed.read,\n ...(parsed.report === undefined\n ? {}\n : snapshotNormalizedFindings({ report: parsed.report })),\n ready: direct.findings.length,\n excluded: direct.excluded,\n receipts: acknowledged,\n counts,\n failures,\n unacknowledged:\n direct.findings.length -\n Object.values(counts).reduce((sum, count) => sum + count, 0),\n verified,\n };\n };\n function interruptedPreview(\n message: string,\n cause?: unknown,\n savedSubmission?: string,\n ) {\n // The expected file is gone or another publisher owns the lock. Use only\n // the acknowledgements this caller saw when it prepared the request.\n return new ExternalPublicationError(\n message,\n {\n ...result(acknowledgedReceipts(submission), 0),\n status: \"interrupted\",\n error: message,\n ...(savedSubmission === undefined ? {} : { savedSubmission }),\n },\n cause,\n );\n }\n let acquired = false;\n return await underPublishLock(async () => {\n acquired = true;\n // Re-read under the lock to keep checkpoints from another publisher.\n let pending = await readPending().catch((error: unknown) => {\n if (!submission.receipts?.length) throw error;\n throw interruptedPreview(errorMessage(error), error);\n });\n const current = pending ?? submission;\n const adoptProjectMap =\n submission.inspectorProjectMapRequired &&\n current.inspectorProjectMapRequired === undefined;\n if (adoptProjectMap) current.inspectorProjectMapRequired = true;\n if (current.approvedRepositoryUrl)\n requireApprovedSource(\n current.approvedRepositoryUrl,\n current.approvedRepositoryPlatform,\n );\n if (!pending || !sameSubmission(current, submission)) {\n const message = pending\n ? \"Another publication prepared this input. Run the command again to review and resume that saved request.\"\n : \"The saved publication changed after preview. Review its result before publishing again.\";\n if (saved) {\n const completed = await readCompletedPublication(requests);\n if (completed)\n return result(completed.receipts, completed.verified);\n throw interruptedPreview(message);\n }\n if (pending) throw new CodexSecurityError(message);\n if ((await readOptionalFile(privatePath)) !== undefined)\n throw new CodexSecurityError(\n \"A private import already owns this selection. Review its saved job before continuing.\",\n );\n }\n // A preview can pin the catalog URL. Tighten its SCM comparison only\n // once the caller confirms publication, including when resuming a request.\n const adoptStrictRepository =\n submission.approvedRepositoryPlatform === \"other\" &&\n !current.approvedRepositoryPlatform;\n if (adoptStrictRepository) current.approvedRepositoryPlatform = \"other\";\n const cached = (current.receipts ?? []).map(validateImportReceipt);\n if (cached.length > requests.length)\n throw new CodexSecurityError(\n \"Saved publication has more receipts than requests.\",\n );\n const acknowledged: FindingImportReceipt[] = [];\n let verified = 0;\n try {\n if (!pending || adoptProjectMap || adoptStrictRepository) {\n await writeAtomicJson(pendingPath, current);\n pending = current;\n }\n progress({\n phase: \"uploading\",\n completed: 0,\n total: direct.findings.length,\n });\n let acknowledgedCount = 0;\n for (const [batchIndex, batch] of requests.entries()) {\n const receipt = validatePublicationReceipt(\n cached[batchIndex] ??\n (await request(`${importPrefix}/finding_imports`, batch)),\n batch,\n );\n acknowledged.push(receipt);\n acknowledgedCount += receipt.item_count;\n progress({\n phase: \"uploading\",\n completed: acknowledgedCount,\n total: direct.findings.length,\n });\n if (batchIndex >= cached.length) {\n // Acknowledged batches must not consume another POST quota on retry.\n // Readback can still resume after this checkpoint without replaying writes.\n await writeAtomicJson(pendingPath, {\n ...current,\n receipts: acknowledged,\n });\n }\n }\n // Verify readable source records without mistaking a newer concurrent\n // observation for failure of the original, immutable import receipt.\n const readbacks = acknowledged.flatMap((receipt, batchIndex) => {\n const batch = requests[batchIndex]!;\n const batchItems = new Map(\n batch.items.map((item) => [item.client_id, item]),\n );\n return receipt.results\n .filter((item) => item.outcome !== \"error\")\n .map((item) => ({\n item,\n expected: batchItems.get(item.client_id)!,\n batch,\n }));\n });\n progress({\n phase: \"verifying\",\n completed: 0,\n total: readbacks.length,\n });\n await readInBatches(readbacks, async ({ item, expected, batch }) => {\n const report = validateSourceReport(\n await request(\n `${sourceReportsPath}/${encodeURIComponent(item.source_report_id!)}`,\n ),\n );\n if (\n report.id !== item.source_report_id ||\n report.canonical_finding_id !== item.canonical_finding_id ||\n report.version < item.version! ||\n (report.version === item.version &&\n (report.observation_id !== item.observation_id ||\n !matchesRepositoryEvidence(\n expected.evidence,\n report.evidence,\n ))) ||\n report.source_finding_id !== expected.source_finding_id ||\n report.repo_id !== destination.id ||\n report.repo_connector_id !== destination.repo_connector_id ||\n report.environment_id !== batch.repository.environment_id ||\n canonicalJson(report.source) !== canonicalJson(source)\n )\n throw new CodexSecurityError(\n \"Cloud readback did not match the saved finding identity.\",\n );\n progress({\n phase: \"verifying\",\n completed: ++verified,\n total: readbacks.length,\n });\n });\n const completed = result(acknowledged, verified);\n await writeAtomicJson(join(state, `${key}.result.json`), {\n ...completed,\n report: reportForJson(completed.report),\n });\n await beforeRetire?.(completed);\n await removePending();\n return completed;\n } catch (error) {\n if (error instanceof CloudImportError && error.status === 409) {\n try {\n await beforeRetire?.(result(acknowledged, verified));\n await removePending();\n pending = undefined;\n } catch (recordError) {\n // Keep acknowledged batches resumable when their receipts are not durable.\n error = recordError;\n }\n }\n const message = `${error instanceof Error ? error.message : String(error)} ${error instanceof CloudImportError && error.status === 409 ? \"The old submission was retired. Rediscover and approve a fresh publication.\" : pending ? `Repeat the same command to resume the saved request. Saved submission: ${pendingPath}` : \"No resumable request was saved. Correct the error and review the input before retrying.\"}`;\n throw new ExternalPublicationError(\n message,\n {\n ...result(acknowledged, verified),\n status: \"interrupted\",\n error: message,\n ...(pending ? { savedSubmission: pendingPath } : {}),\n },\n error,\n );\n }\n }).catch((error: unknown) => {\n if (acquired || !dependencies.signal?.aborted) throw error;\n const message = saved\n ? `Publication canceled while waiting. Repeat the same command to resume the saved request. Saved submission: ${pendingPath}`\n : \"Publication canceled while waiting. No resumable request was saved by this invocation.\";\n throw interruptedPreview(\n message,\n error,\n saved ? pendingPath : undefined,\n );\n });\n },\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"external-findings-publish.js","sourceRoot":"","sources":["../src/external-findings-publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,E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AC,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;qBACrD,EACD,KAAK,CACN,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;gBAC1B,IAAI,QAAQ,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO;oBAAE,MAAM,KAAK,CAAC;gBAC3D,MAAM,OAAO,GAAG,KAAK;oBACnB,CAAC,CAAC,8GAA8G,WAAW,EAAE;oBAC7H,CAAC,CAAC,wFAAwF,CAAC;gBAC7F,MAAM,kBAAkB,CACtB,OAAO,EACP,KAAK,EACL,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAChC,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { readScannerJson } from \"./scanner-import.js\";\nimport { hash, randomUUID } from \"node:crypto\";\nimport { chmodSync } from \"node:fs\";\nimport { lstat, mkdir, open, readFile, rename, rm } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { nullIfMissingFile } from \"./targets.js\";\nimport { setTimeout as delay } from \"node:timers/promises\";\nimport { isProxy } from \"node:util/types\";\nimport {\n privateImportClient,\n privateJobVersions,\n selectPrivateReport,\n type PrivateImportFormat,\n readPrivateCheckpoint,\n parsePrivateCheckpoint,\n type PrivateImportContext,\n unsuccessfulJob,\n type PrivateImportJob,\n} from \"./private-finding-import.js\";\nimport { readCloudCredentials } from \"./cloud-publish.js\";\nimport type { LocalExternalImportOptions } from \"./external-findings-import.js\";\nimport { armorCodeRepositoryUrl } from \"./armorcode-findings.js\";\nimport { declaredScannerRepositoryUrl } from \"./scanner-repository-url.js\";\nimport { tenableReportFormat } from \"./tenable-findings.js\";\nimport { crowdstrikeReportFormat } from \"./crowdstrike-findings.js\";\nimport {\n guardianFindingId,\n guardianFindingRepository,\n guardianSelectionFormat,\n} from \"./semgrep-guardian-findings.js\";\nimport { cloudBaseUrl, cloudFindingsUrl } from \"./cloud-endpoint.js\";\nimport { CodexSecurityError, errorMessage } from \"./errors.js\";\nimport {\n codexSecurityStateDirectory,\n createWindowsOutputDirectory,\n validatePreparedOutputDir,\n sqliteDatabaseOpener,\n} from \"./runtime.js\";\nimport {\n EXTERNAL_FINDINGS_PROVIDERS,\n readExternalFindings,\n requireCloudReader,\n semgrepSarifRepositories,\n snykFileRepositories,\n type CloudFindingsReader,\n} from \"./external-findings-read.js\";\nimport { canonicalJson, isRecord } from \"./record.js\";\nimport { notify } from \"./value.js\";\nimport { wizCsvRepositoryUrl } from \"./wiz-csv.js\";\nimport { isWizPackageFinding, wizFindingRepository } from \"./wiz-findings.js\";\nimport { getOpenGrepSourcePositions } from \"./opengrep-findings.js\";\nimport { dependabotRepository } from \"./github-dependabot-findings.js\";\nimport { retainedGitHubRepository } from \"./github-findings.js\";\nimport {\n normalizeSemgrepFindings,\n readSemgrepReport,\n} from \"./semgrep-findings.js\";\nimport { normalizeSnykFile, snykRepositoryUrls } from \"./snyk-findings.js\";\nimport {\n type SnykIssuesFindings,\n isSnykRestFinding,\n isSnykRestFormat,\n snykRestImportRepository,\n snykRestRepositoryMatches,\n} from \"./snyk-rest-findings.js\";\nimport {\n hasRetainedSemgrepScope,\n isSemgrepPlatformEvidence,\n isSemgrepPlatformFormat,\n semgrepPlatformFormat,\n semgrepPlatformFindingBinding,\n semgrepPlatformRepositoryReference,\n semgrepPlatformReportScope,\n} from \"./semgrep-platform-findings.js\";\nimport {\n hostedRepositoryUrlKey,\n normalizeHostedGitRepositoryUrl,\n} from \"./hosted-git-repository.js\";\nimport { trivyRemoteKey, trivyRepositoryUrl } from \"./trivy-findings.js\";\nimport { hostedRepositoryUrl } from \"./hosted-scanner-http.js\";\nimport { endorRepositoryUrls } from \"./endor-findings.js\";\nimport {\n blackDuckReportRepositories,\n projectedBlackDuckRepositoryUrl,\n} from \"./blackduck-findings.js\";\nimport { checkmarxSelection } from \"./checkmarx-repository.js\";\nimport { continuumReportRepositories } from \"./continuum-findings.js\";\nimport { veracodeReportRepositories } from \"./veracode-findings.js\";\nimport { inspectorReportRepository } from \"./inspector-findings.js\";\nimport { sonarRepositoryUrls } from \"./sonar-findings.js\";\nimport {\n checkRetainedTrivyProvider,\n checkTrivyReportProvider,\n isTrivyReportHeader,\n retainedTrivyReport,\n trivyBatchSourceUrls,\n validateTrivyRepositoryUrl,\n} from \"./trivy-import.js\";\nimport {\n NoPublishableFindingsError,\n reportForJson,\n snapshotSourceRepositories,\n type ExternalSourceRepository,\n snapshotImportOptions,\n cloneImportPreview,\n snapshotNormalizedFindings,\n type ExternalFindings,\n} from \"./external-findings.js\";\nimport {\n canonicalNumber,\n cloudRepositoryUrlKey,\n validateImportRequest,\n validateExternalEvidence,\n validateExternalReport,\n validateImportReceipt,\n validateRepositories,\n validateSourceReports,\n validateSourceReport,\n} from \"./external-import-contract.js\";\nimport type {\n FindingImportRequest,\n FindingImportReceipt,\n ImportRepository,\n Provider,\n SourceReportSummary,\n} from \"./external-import-models.js\";\n\nconst MAX_REQUEST_BYTES = 5 * 1024 * 1024;\n\n/** Source and destination for evidence already normalized to the Cloud contract. */\nexport interface NormalizedExternalPublicationOptions {\n repository: string;\n provider: FindingImportRequest[\"source\"][\"provider\"];\n sourceKey: string;\n /** Full Inspector project ARNs mapped to independently verified repository URLs. */\n inspectorProjectMap?: ReadonlyMap<string, string>;\n}\n\n/** File readers accepted by the Cloud publisher. */\nexport interface ExternalPublicationOptions extends LocalExternalImportOptions {\n provider: CloudFindingsReader;\n}\n\n/** Optional transport, account, cancellation, and progress hooks. */\nexport interface ExternalPublicationDependencies {\n /** Independently verified source repositories supplied by the reader. */\n sourceRepositories?: readonly ExternalSourceRepository[];\n environment?: NodeJS.ProcessEnv;\n fetch?: (url: string, options: RequestInit) => Promise<Response>;\n credentials?: () => Promise<{ access_token: string; account_id: string }>;\n signal?: AbortSignal;\n onProgress?: (event: ExternalPublicationProgress) => void;\n}\n\nexport interface ExternalPublicationProgress {\n phase:\n | \"reading\"\n | \"discovering\"\n | \"preparing\"\n | \"waiting\"\n | \"uploading\"\n | \"verifying\";\n completed: number;\n total?: number;\n}\n\n/** Counts describe acknowledged receipts, even when later transport or readback fails. */\nexport interface ExternalPublicationResult {\n cloudApiUrl: string;\n cloudUrl?: string;\n status: \"complete\" | \"partial\" | \"interrupted\";\n read: number;\n report?: ExternalFindings[\"report\"];\n ready: number;\n excluded: ExternalFindings[\"excluded\"];\n receipts: FindingImportReceipt[];\n counts: Required<FindingImportReceipt[\"counts\"]>;\n failures: { source_finding_id: string; code: string; message: string }[];\n unacknowledged: number;\n verified: number;\n error?: string;\n savedSubmission?: string;\n /** Private jobs expose aggregate outcomes before assessment or publication. */\n privateJob?: PrivateImportJob;\n}\n\n/** Preserve accepted work in CLI JSON output when publication cannot finish. */\nexport class ExternalPublicationError extends CodexSecurityError {\n constructor(\n message: string,\n public readonly result: ExternalPublicationResult,\n cause: unknown,\n ) {\n super(message, { cause });\n }\n}\n\ninterface SavedSubmission {\n accountId: string;\n trivyRepositoryUrl?: string;\n requests: FindingImportRequest[];\n receipts?: FindingImportReceipt[];\n repositorySeverities?: string[];\n semgrepPartialScopeDigest?: string;\n /** Catalog URL when this source selection was approved, before any repository rename. */\n approvedRepositoryUrl?: string;\n approvedRepositoryPlatform?: \"other\";\n inspectorProjectMapRequired?: true;\n}\n\nexport interface ExternalPublicationPreview extends ExternalFindings {\n cloudApiUrl: string;\n cloudUrl?: string;\n accountId: string;\n destination: ImportRepository;\n source: FindingImportRequest[\"source\"];\n resumed: boolean;\n requests: FindingImportRequest[];\n privateImport?: {\n format: PrivateImportFormat;\n contextVersion: string;\n sha256: string;\n bytes: number;\n retryOfJobId?: string;\n };\n}\n\n/** Bind reviewed evidence to its account, repository, connector and destination version. */\nexport function cloudReviewDigest(\n preview: ExternalPublicationPreview,\n checkout: string,\n findings?: readonly { id: string; version: number }[],\n) {\n return hash(\n \"sha256\",\n canonicalJson({\n checkout,\n api: preview.cloudApiUrl,\n account: preview.accountId,\n repository: preview.destination.id,\n connector: preview.destination.repo_connector_id,\n url: preview.destination.url,\n reset: preview.destination.reset_marker,\n source: preview.source,\n privateImport: preview.privateImport,\n ...(findings && { findings, excluded: preview.excluded }),\n items: preview.requests.flatMap((request) =>\n request.items.map((item) => [\n item.source_finding_id,\n item.expected_version,\n request.repository.environment_id,\n item.evidence,\n ]),\n ),\n }),\n );\n}\n\nexport interface PreparedExternalPublication {\n preview: ExternalPublicationPreview;\n publish(): Promise<ExternalPublicationResult>;\n}\n\n/** @internal Persist only the acknowledgements made by the selected Cloud destination. */\ntype RecordPublicationReceipts = (\n scope: Pick<\n ExternalPublicationPreview,\n \"accountId\" | \"cloudApiUrl\" | \"destination\" | \"requests\" | \"findings\"\n >,\n receipts: FindingImportReceipt[],\n privateJobId?: string,\n) => Promise<void>;\n\n/** @internal Keep a stored submission scoped to the finding versions that were approved. */\nexport interface WorkbenchPublication {\n checkout: string;\n findings: readonly { id: string; version: number }[];\n record: RecordPublicationReceipts;\n}\n\ntype BeforeRetire = (result: ExternalPublicationResult) => Promise<void>;\n\n// Limit read concurrency to avoid one network round trip per finding in series.\n// Wait for the entire batch on failure so callers never outlive their read tasks.\nasync function readInBatches<T, U>(\n items: T[],\n read: (item: T) => Promise<U>,\n): Promise<U[]> {\n const output: U[] = [];\n for (let start = 0; start < items.length; start += 4) {\n const batch = await Promise.allSettled(\n items.slice(start, start + 4).map(read),\n );\n for (const result of batch) {\n if (result.status === \"rejected\") throw result.reason;\n output.push(result.value);\n }\n }\n return output;\n}\n\nfunction matchesRepositoryEvidence(\n expected: ExternalFindings[\"findings\"][number][\"evidence\"],\n stored: ExternalFindings[\"findings\"][number][\"evidence\"],\n): boolean {\n const storedWire = canonicalJson(stored);\n if (canonicalJson(expected) === storedWire) return true;\n // A repository can store a literal first-component colon with an explicit\n // relative prefix. Match only that spelling in typed locations and their manifests.\n const qualified = new Map<string, string>();\n const locations = expected.locations?.map((location, index) => {\n const { path } = location;\n const actual = stored.locations?.[index]?.path;\n if (actual !== `./${path}` || !/^[^/:\\\\@]+:[^/\\\\]/u.test(path))\n return location;\n qualified.set(path, actual);\n return { ...location, path: actual };\n });\n if (!qualified.size) return false;\n const packages = expected.packages?.map((item) => {\n const path = item.manifest_path && qualified.get(item.manifest_path);\n return path ? { ...item, manifest_path: path } : item;\n });\n return canonicalJson({ ...expected, locations, packages }) === storedWire;\n}\n\nfunction isCompleteUnscoredOpenGrepReport(report: ExternalFindings) {\n let rows = report.excluded.length;\n for (const { evidence } of report.findings) {\n const traces = evidence.source_data?.[\"results\"];\n if (\n evidence.details?.scanner_origin !== \"OpenGrep\" ||\n evidence.severity !== \"unknown\" ||\n !Array.isArray(traces)\n )\n return false;\n rows += traces.length;\n }\n return rows === report.read;\n}\n\nfunction repositoryFindings(\n report: ExternalFindings,\n severities: readonly string[] | undefined,\n) {\n return severities\n ? report.findings.filter(({ evidence }) =>\n severities.includes(evidence.severity),\n )\n : report.findings;\n}\n\nfunction repositorySelection(\n report: ExternalFindings,\n severities: readonly string[] | undefined,\n sourcePositions: PublicationSelection[\"sourcePositions\"],\n): ExternalFindings {\n const findings = repositoryFindings(report, severities);\n if (findings.length === report.findings.length) return report;\n const excluded = [...report.excluded];\n const skipped = new Set(excluded.map(({ position }) => position));\n function exclude(position: number, id: string | null, severity: string) {\n excluded.push({\n position,\n source_finding_id: id,\n reason: `The repository publisher does not accept severity ${JSON.stringify(severity)}. A local import or an available private inbox can retain this finding.`,\n });\n }\n // Serialized OpenGrep selections retain every trace but lose the reader's\n // position map. All these traces have unknown severity, so the remaining\n // source rows are provably excluded even when their individual IDs are lost.\n if (!sourcePositions && isCompleteUnscoredOpenGrepReport(report)) {\n const id =\n report.findings.length === 1\n ? report.findings[0]!.source_finding_id\n : null;\n for (let row = 1; row <= report.read; row++)\n if (!skipped.has(row)) exclude(row, id, \"unknown\");\n } else {\n const retained = new Set(findings);\n let position = 0;\n for (const finding of report.findings) {\n do {\n position++;\n } while (skipped.has(position));\n if (retained.has(finding)) continue;\n const { source_finding_id, evidence } = finding;\n for (const row of sourcePositions?.get(source_finding_id) ?? [position])\n exclude(row, source_finding_id, evidence.severity);\n }\n }\n return {\n ...report,\n findings,\n excluded: excluded.sort((a, b) => a.position - b.position),\n };\n}\n\nfunction sameSubmission(\n left: SavedSubmission,\n right: SavedSubmission,\n): boolean {\n return (\n left.accountId === right.accountId &&\n left.trivyRepositoryUrl === right.trivyRepositoryUrl &&\n left.inspectorProjectMapRequired === right.inspectorProjectMapRequired &&\n canonicalJson(left.requests) === canonicalJson(right.requests)\n );\n}\n\nfunction wireFinding({\n source_finding_id,\n evidence,\n}: ExternalFindings[\"findings\"][number]) {\n return { source_finding_id, evidence };\n}\n\nfunction submissionFindings(\n requests: readonly FindingImportRequest[],\n): ExternalFindings[\"findings\"] {\n return requests.flatMap((batch) => batch.items.map(wireFinding));\n}\n\nasync function readOptionalFile(path: string): Promise<string | undefined> {\n return (await readFile(path, \"utf8\").catch(nullIfMissingFile)) ?? undefined;\n}\n\nexport function externalPublicationStateDirectory(\n environment: NodeJS.ProcessEnv,\n): string {\n return join(\n codexSecurityStateDirectory(environment),\n \"external-finding-publications\",\n );\n}\n\nexport async function writeAtomicJson(\n path: string,\n value: unknown,\n): Promise<void> {\n const temporary = `${path}.${randomUUID()}.tmp`;\n try {\n const file = await open(temporary, \"wx\", 0o600);\n try {\n await file.writeFile(JSON.stringify(value));\n await file.sync();\n } finally {\n await file.close();\n }\n await rename(temporary, path);\n } finally {\n await rm(temporary, { force: true });\n }\n}\n\nfunction sourcePath(repository: ImportRepository): string {\n return `/repository_connectors/${encodeURIComponent(repository.repo_connector_id)}/repositories/${encodeURIComponent(repository.id)}/source_reports`;\n}\n\nclass CloudImportError extends CodexSecurityError {\n constructor(\n public readonly status: number,\n message: string,\n ) {\n super(message);\n }\n}\n\nfunction validatePublicationReceipt(\n value: unknown,\n batch: FindingImportRequest,\n): FindingImportReceipt {\n const receipt = validateImportReceipt(value);\n const remaining = new Set(batch.items.map((item) => item.client_id));\n if (\n receipt.id !== batch.request_id ||\n canonicalJson(receipt.repository) !== canonicalJson(batch.repository) ||\n canonicalJson(receipt.source) !== canonicalJson(batch.source) ||\n receipt.item_count !== batch.items.length ||\n receipt.results.length !== batch.items.length ||\n receipt.results.some((item) => !remaining.delete(item.client_id))\n )\n throw new CodexSecurityError(\n \"Cloud returned a receipt for a different publication.\",\n );\n const actual = { created: 0, updated: 0, unchanged: 0, error: 0 };\n for (const result of receipt.results) {\n actual[result.outcome]++;\n if (result.outcome === \"error\") {\n if (\n !result.error ||\n result.source_report_id !== null ||\n result.observation_id !== null ||\n result.canonical_finding_id !== null ||\n result.version !== null\n )\n throw new CodexSecurityError(\n \"Cloud returned inconsistent item error fields.\",\n );\n } else if (\n result.error !== null ||\n !result.source_report_id ||\n !result.observation_id ||\n !result.canonical_finding_id ||\n result.version === null\n )\n throw new CodexSecurityError(\n \"Cloud returned an incomplete saved finding.\",\n );\n }\n if (canonicalJson(receipt.counts) !== canonicalJson(actual))\n throw new CodexSecurityError(\n \"Cloud returned inconsistent publication counts.\",\n );\n return receipt;\n}\n\nfunction acknowledgedReceipts({ receipts = [], requests }: SavedSubmission) {\n if (receipts.length > requests.length)\n throw new CodexSecurityError(\n \"Saved publication has more receipts than requests.\",\n );\n return receipts.map((receipt, index) =>\n validatePublicationReceipt(receipt, requests[index]!),\n );\n}\n\nasync function withImportLock<T>(\n state: string,\n key: string,\n signal: AbortSignal | undefined,\n operation: () => Promise<T>,\n): Promise<T> {\n if (process.platform === \"win32\")\n await createWindowsOutputDirectory(state, true);\n else await mkdir(state, { recursive: true, mode: 0o700 });\n await validatePreparedOutputDir(state, undefined, true);\n const path = join(state, key + \".lock.sqlite\");\n const metadata = await lstat(path).catch(nullIfMissingFile);\n if (metadata && !metadata.isFile())\n throw new CodexSecurityError(\"The publication lock is not a regular file.\");\n const guard = sqliteDatabaseOpener()(path);\n try {\n if (process.platform !== \"win32\") chmodSync(path, 0o600);\n guard.exec(\"PRAGMA busy_timeout = 0\");\n for (;;) {\n signal?.throwIfAborted();\n try {\n guard.exec(\"BEGIN EXCLUSIVE\");\n break;\n } catch (error) {\n const sqliteError = error as { code?: string; errcode?: number };\n if (sqliteError.errcode !== 5 && sqliteError.code !== \"SQLITE_BUSY\")\n throw error;\n await delay(50, undefined, { signal });\n }\n }\n return await operation();\n } finally {\n guard.close();\n }\n}\n\ntype ResolvedPublicationInput = PublicationSelection & {\n recheckFileRepository?: (\n approvedUrl: string,\n platform?: \"other\",\n ) => Promise<unknown>;\n};\n\ntype PreparePublicationInput =\n | ResolvedPublicationInput\n | ((destination: ImportRepository) => Promise<ResolvedPublicationInput>);\n\nfunction hostedSourceReferences(\n readerSources: readonly ExternalSourceRepository[],\n url?: string,\n sourcePlatform?: string,\n): readonly ExternalSourceRepository[] {\n // The catalog supplies a GitHub identity only when the reader has no SCM mapping.\n const sources =\n readerSources.length || !url\n ? readerSources\n : [{ url, platform: \"github\" as const }];\n return sourcePlatform === \"other\"\n ? sources.filter(({ platform }) => platform !== \"github\")\n : sources;\n}\n\nfunction checkFindingProvider(\n input: ExternalFindings,\n provider: Provider,\n): void {\n function checkFormat(format: unknown) {\n if (format === tenableReportFormat)\n requireCloudReader({ provider: \"tenable\" });\n if (format === crowdstrikeReportFormat)\n requireCloudReader({ provider: \"crowdstrike\" });\n if (format === guardianSelectionFormat && provider !== \"semgrep\")\n throw new CodexSecurityError(\n \"Use the semgrep provider for Guardian findings.\",\n );\n }\n checkFormat(input.report?.[\"format\"]);\n for (const { source_finding_id, evidence } of input.findings) {\n if (guardianFindingId.test(source_finding_id))\n checkFormat(guardianSelectionFormat);\n checkFormat(evidence.source_data?.[\"format\"]);\n }\n}\n\nexport async function prepareExternalPublication(\n path: string,\n options: ExternalPublicationOptions,\n dependencies: ExternalPublicationDependencies = {},\n): Promise<PreparedExternalPublication> {\n const settings = snapshotImportOptions(options);\n requireCloudReader(settings);\n const readerSources = snapshotSourceRepositories(\n dependencies.sourceRepositories,\n );\n const provider = EXTERNAL_FINDINGS_PROVIDERS[settings.provider];\n let input: PreparePublicationInput;\n let fileRepositories: (() => readonly ExternalSourceRepository[]) | undefined;\n if (settings.provider === \"semgrep\" || settings.provider === \"snyk\") {\n const semgrep = settings.provider === \"semgrep\";\n const report = await (semgrep\n ? readSemgrepReport(path)\n : readScannerJson(path));\n const normalize = async (url?: string, platform?: \"other\") => {\n const references = hostedSourceReferences(\n readerSources,\n url,\n semgrep ? platform : undefined,\n );\n const semgrepOptions = {\n sourceRepositoryUrl: settings.sourceRepositoryUrl,\n sourceRepositories: references,\n };\n const findings = semgrep\n ? normalizeSemgrepFindings(report, semgrepOptions, \"cloud\")\n : await normalizeSnykFile(report, \"cloud\", references);\n return normalizedPublicationInput(findings, provider);\n };\n const hosted =\n isRecord(report) &&\n (semgrep\n ? isSemgrepPlatformFormat(report[\"format\"]) ||\n report[\"format\"] === guardianSelectionFormat\n : isSnykRestFormat(report[\"format\"]));\n if (!semgrep && !hosted)\n fileRepositories = () => snykFileRepositories(report);\n input = hosted\n ? async (destination) => {\n try {\n const projection = await normalize(destination.url);\n if (!semgrep) return projection;\n return {\n ...projection,\n recheckFileRepository: async (approvedUrl, platform) => {\n if (platform === \"other\")\n await normalize(approvedUrl, platform);\n },\n };\n } catch (error) {\n const project = report[\"project\"];\n const candidate =\n report[\"sourceRepositoryUrl\"] ??\n settings.sourceRepositoryUrl ??\n (semgrep && isRecord(project) ? project[\"url\"] : undefined);\n if (typeof candidate !== \"string\" || candidate === destination.url)\n throw error;\n // A renamed repository can require its old spelling to identify the saved request.\n // Only an approved checkpoint can later authorize that spelling.\n const projection = await normalize(\n normalizeHostedGitRepositoryUrl(candidate, destination.url, true),\n );\n return {\n ...projection,\n recheckFileRepository: (approvedUrl, platform) => {\n if (approvedUrl === destination.url) throw error;\n return normalize(approvedUrl, platform);\n },\n };\n }\n }\n : await normalize();\n } else {\n const parsed = await readExternalFindings(path, settings);\n input = normalizedPublicationInput(parsed.findings, provider);\n if (\n provider === \"endor\" ||\n (provider === \"continuum\" && parsed.findings.report)\n )\n fileRepositories = () => parsed.sourceRepositories ?? [];\n }\n return preparePublicationInput(\n input,\n { ...settings, provider },\n dependencies,\n readerSources,\n undefined,\n settings.sourceRepositoryUrl,\n fileRepositories,\n );\n}\n\n/** Prepare normalized provider evidence without reading a vendor export. */\nexport async function prepareNormalizedExternalPublication(\n input: ExternalFindings,\n options: NormalizedExternalPublicationOptions,\n dependencies: ExternalPublicationDependencies = {},\n): Promise<PreparedExternalPublication> {\n return prepareNormalizedPublication(input, options, dependencies);\n}\n\n/** @internal The workbench persists acknowledgements before a repository checkpoint is retired. */\nexport async function prepareNormalizedPublication(\n input: ExternalFindings,\n options: NormalizedExternalPublicationOptions,\n dependencies: ExternalPublicationDependencies,\n workbench?: WorkbenchPublication | \"preview\",\n): Promise<PreparedExternalPublication> {\n const settings = snapshotImportOptions(options);\n requireCloudReader(settings);\n return preparePublicationInput(\n normalizedPublicationInput(input, settings.provider),\n settings,\n dependencies,\n snapshotSourceRepositories(dependencies.sourceRepositories),\n workbench,\n );\n}\n\nfunction cloudSourceKey(\n url: string,\n platform: ExternalSourceRepository[\"platform\"],\n) {\n return hostedRepositoryUrlKey(\n url,\n platform === \"github\",\n platform === \"gitlab\",\n \"cloud\",\n );\n}\n\n/** Verify every source in a hosted selection, including SDK inputs containing typed-only rows. */\nfunction hostedRepositoryMatcher(\n input: ExternalFindings & Partial<SnykIssuesFindings>,\n provider: NormalizedExternalPublicationOptions[\"provider\"],\n declaredUrl: string | undefined,\n destination: Pick<ImportRepository, \"url\">,\n readerSources: readonly ExternalSourceRepository[],\n): { github: boolean; matches: (url: string) => boolean } | undefined {\n const references = hostedSourceReferences(\n readerSources,\n destination.url,\n input.sourceRepositoryPlatform,\n );\n if (provider === \"snyk\") {\n const declaredSource =\n input.sourceRepositoryUrl !== undefined ||\n input.sourceRepositoryPlatform !== undefined ||\n declaredUrl !== undefined ||\n readerSources.length > 0;\n const binding = snykRestImportRepository(\n input,\n provider,\n [\n ...readerSources.map(({ url }) => url),\n ...(declaredUrl === undefined ? [] : [declaredUrl]),\n ],\n references,\n undefined,\n declaredSource ? destination.url : undefined,\n );\n if (binding)\n return {\n github: binding.platform === \"github\",\n matches: (url) => snykRestRepositoryMatches(binding, url),\n };\n }\n if (provider !== \"semgrep\") return;\n\n const declared =\n input.sourceRepositoryUrl === undefined\n ? undefined\n : hostedRepositoryUrl(\n input.sourceRepositoryUrl,\n \"Semgrep source repository\",\n );\n const reportScope = semgrepPlatformReportScope(input, provider, references);\n const hasNativeSource =\n reportScope !== undefined ||\n input.findings.some((finding) =>\n isSemgrepPlatformEvidence(finding, provider),\n );\n const claims = new Set<string>();\n let original =\n input.report?.[\"format\"] === guardianSelectionFormat\n ? declaredScannerRepositoryUrl(input.report[\"repositoryUrl\"], \"Guardian\")\n : undefined;\n const nativeRows = [];\n for (const finding of input.findings) {\n const typed = finding.evidence.details?.repository?.url;\n if (typed) claims.add(typed);\n const guardian = guardianFindingRepository(finding, \"cloud\");\n if (guardian) {\n original ??= guardian;\n claims.add(guardian);\n continue;\n }\n const sarif = semgrepSarifRepositories(finding, hasNativeSource);\n for (const { url } of sarif)\n claims.add(hostedRepositoryUrl(url, \"Semgrep source repository\"));\n nativeRows.push({ finding, sarif });\n }\n for (const { finding, sarif } of nativeRows) {\n const native = semgrepPlatformFindingBinding(\n finding,\n provider,\n references,\n reportScope,\n [{ url: projectedBlackDuckRepositoryUrl(finding, \"cloud\") }, ...sarif],\n \"cloud\",\n )?.url;\n if (native) {\n original ??= native;\n claims.add(native);\n }\n }\n const source =\n original ??\n declared ??\n declaredUrl ??\n (readerSources.length || input.sourceRepositoryPlatform !== undefined\n ? destination.url\n : undefined);\n if (source === undefined) return;\n const { platform } = semgrepPlatformRepositoryReference(source, references);\n const expected = cloudSourceKey(source, platform);\n const matches = (url: string) => cloudSourceKey(url, platform) === expected;\n if (declared !== undefined) claims.add(declared);\n if (declaredUrl !== undefined) claims.add(declaredUrl);\n for (const reader of readerSources)\n claims.add(\n normalizeHostedGitRepositoryUrl(\n reader.url,\n source,\n reader.platform !== undefined,\n ),\n );\n for (const url of claims)\n if (!matches(hostedRepositoryUrl(url, \"Semgrep source repository\")))\n throw new CodexSecurityError(\n \"The finding does not match the original Semgrep project repository.\",\n );\n return { github: platform === \"github\", matches };\n}\n\ninterface PublicationSelection {\n current: ExternalFindings;\n sourcePositions?: ReadonlyMap<string, readonly number[]>;\n}\n\nfunction ownData(value: unknown, key: string) {\n return isRecord(value) && !isProxy(value)\n ? (Object.getOwnPropertyDescriptor(value, key)?.value as unknown)\n : undefined;\n}\n\nfunction publicationIdentity(\n parsed: ExternalFindings,\n provider?: NormalizedExternalPublicationOptions[\"provider\"],\n) {\n // For Trivy, the independently checked header binds the repository. Files\n // and normalized rows use the same checkpoint when their findings agree.\n if (\n parsed.report === undefined ||\n (provider === \"trivy\" && isTrivyReportHeader(parsed.report))\n )\n return parsed.findings;\n return { findings: parsed.findings, report: reportForJson(parsed.report) };\n}\n\nfunction validatePublicationFindings(parsed: ExternalFindings) {\n validateExternalReport(parsed.report);\n const ids = new Set<string>();\n for (const finding of parsed.findings) {\n const id = finding.source_finding_id;\n if (!id.trim() || id.includes(\"\\0\") || Buffer.byteLength(id) > 512)\n throw new CodexSecurityError(\n \"Source finding id must contain 1–512 UTF-8 bytes and no NUL characters.\",\n );\n if (ids.has(id))\n throw new CodexSecurityError(\n `Duplicate source finding id ${JSON.stringify(id)}.`,\n );\n ids.add(id);\n finding.evidence = validateExternalEvidence(finding.evidence);\n }\n}\n\nfunction normalizedPublicationInput(\n input: ExternalFindings & Partial<SnykIssuesFindings>,\n provider: NormalizedExternalPublicationOptions[\"provider\"],\n): PublicationSelection {\n const current = snapshotNormalizedFindings(\n input,\n undefined,\n \"cloud\",\n provider,\n );\n if (current.snykRestContext !== undefined) {\n if (provider !== \"snyk\")\n throw new CodexSecurityError(\n \"Snyk REST evidence requires the snyk provider.\",\n );\n if (!isSnykRestFormat(current.snykRestContext?.[\"format\"]))\n throw new CodexSecurityError(\n \"Expected a versioned Snyk REST report context.\",\n );\n }\n const markedSemgrep =\n \"sourceFormat\" in current && isSemgrepPlatformFormat(current.sourceFormat);\n if (markedSemgrep && provider !== \"semgrep\")\n throw new CodexSecurityError(\n \"Semgrep Platform evidence requires the semgrep provider.\",\n );\n if (markedSemgrep || \"semgrepPlatformScope\" in current)\n semgrepPlatformReportScope(current, provider);\n validatePublicationFindings(current);\n checkFindingProvider(current, provider);\n return {\n current,\n sourcePositions: getOpenGrepSourcePositions(ownData(input, \"findings\")),\n };\n}\n\n// A normalized hosted input can omit native fields that the authenticated\n// repository and the retained source response establish for each occurrence.\nfunction hostedPublicationFindings(\n current: ExternalFindings & Partial<SnykIssuesFindings>,\n provider: Provider,\n destination: ImportRepository,\n readerSources: readonly ExternalSourceRepository[],\n): ExternalFindings {\n if (provider === \"snyk\") {\n const first = current.findings.find(isSnykRestFinding);\n if (!first && current.snykRestContext === undefined) return current;\n const url =\n current.snykRestContext?.[\"sourceRepositoryUrl\"] ??\n current.sourceRepositoryUrl ??\n first?.evidence.source_data?.[\"sourceRepositoryUrl\"];\n snykRestImportRepository(\n current,\n provider,\n [],\n hostedSourceReferences(\n readerSources,\n typeof url === \"string\" ? url : destination.url,\n current.sourceRepositoryPlatform,\n ),\n (finding, source) => {\n finding.evidence.source_data = source;\n },\n );\n return current;\n }\n if (provider !== \"semgrep\") return current;\n const first = current.findings.find((finding) =>\n isSemgrepPlatformEvidence(finding, provider),\n );\n if (!first) return current;\n const retained = first.evidence.source_data;\n const project = retained?.[\"project\"];\n const url =\n current.sourceRepositoryUrl ??\n retained?.[\"sourceRepositoryUrl\"] ??\n (isRecord(project) ? project[\"url\"] : undefined);\n const references = hostedSourceReferences(\n readerSources,\n typeof url === \"string\"\n ? normalizeHostedGitRepositoryUrl(url, destination.url, true)\n : destination.url,\n current.sourceRepositoryPlatform,\n );\n const scope = semgrepPlatformReportScope(current, provider, references);\n const findings = current.findings.map((finding) => {\n const data = finding.evidence.source_data;\n const original =\n isRecord(data?.[\"finding\"]) &&\n isSemgrepPlatformEvidence(finding, provider);\n if (!original && data?.[\"format\"] !== semgrepPlatformFormat) return finding;\n const binding = semgrepPlatformFindingBinding(\n finding,\n provider,\n references,\n scope,\n undefined,\n \"cloud\",\n );\n return binding?.sourceData &&\n (original || binding.sourceData[\"format\"] !== semgrepPlatformFormat)\n ? {\n ...finding,\n evidence: {\n ...finding.evidence,\n ...binding.migration,\n source_data: binding.sourceData,\n },\n }\n : finding;\n });\n return { ...current, findings };\n}\n\nasync function preparePublicationInput(\n supplied: PreparePublicationInput,\n options: NormalizedExternalPublicationOptions,\n dependencies: ExternalPublicationDependencies,\n readerSources: readonly ExternalSourceRepository[],\n workbench?: WorkbenchPublication | \"preview\",\n declaredUrl?: string,\n fileRepositories?: () => readonly ExternalSourceRepository[],\n): Promise<PreparedExternalPublication> {\n const record = workbench !== \"preview\" && workbench?.record;\n function withReceipts(\n scope: ExternalPublicationPreview,\n prepared: {\n preview: ExternalPublicationPreview;\n publish(beforeRetire?: BeforeRetire): Promise<ExternalPublicationResult>;\n },\n ): PreparedExternalPublication {\n return {\n preview: prepared.preview,\n async publish() {\n if (!record) return prepared.publish();\n let recorded = false;\n const persist = async (result: ExternalPublicationResult) => {\n if (recorded) return;\n recorded = true;\n const job = result.privateJob;\n const privateJobId =\n job?.status === \"completed\" &&\n !result.counts.error &&\n !result.unacknowledged\n ? job.id\n : undefined;\n if (!privateJobId && !result.receipts.length) return;\n try {\n await record(scope, result.receipts, privateJobId);\n } catch (error) {\n throw new ExternalPublicationError(\n `Cloud returned receipts, but the workbench could not record them: ${errorMessage(error)}`,\n result,\n error,\n );\n }\n };\n let result: ExternalPublicationResult;\n try {\n result = await prepared.publish(persist);\n } catch (error) {\n if (error instanceof ExternalPublicationError)\n await persist(error.result);\n throw error;\n }\n await persist(result);\n return result;\n },\n };\n }\n const { inspectorProjectMap } = options;\n const progress = (event: ExternalPublicationProgress): void =>\n notify(() => dependencies.onProgress?.(event));\n if (\n !options.sourceKey.trim() ||\n options.sourceKey.includes(\"\\0\") ||\n Buffer.byteLength(options.sourceKey) > 512\n ) {\n throw new CodexSecurityError(\n \"The source key must contain 1–512 UTF-8 bytes and no NUL characters. Use a stable scanner organization/project/branch namespace across imports.\",\n );\n }\n const environment = dependencies.environment ?? process.env;\n dependencies.signal?.throwIfAborted();\n progress({ phase: \"reading\", completed: 0 });\n const trivyReportUrls =\n options.provider === \"trivy\" && typeof supplied !== \"function\"\n ? trivyBatchSourceUrls(\n supplied.current,\n supplied.current.findings.length > 0,\n )\n : undefined;\n if (trivyReportUrls) validateTrivyRepositoryUrl(options.repository);\n const catalogKey = trivyReportUrls\n ? (url: string) => cloudSourceKey(url, \"github\")\n : cloudRepositoryUrlKey;\n const state = externalPublicationStateDirectory(environment);\n function checkSelection(input: PublicationSelection) {\n const parsed = input.current;\n checkTrivyReportProvider(options.provider, parsed.report);\n for (const finding of parsed.findings)\n checkRetainedTrivyProvider(options.provider, finding);\n if (!parsed.findings.length) throw new NoPublishableFindingsError(parsed);\n }\n if (typeof supplied !== \"function\") checkSelection(supplied);\n progress({ phase: \"discovering\", completed: 0 });\n const apiBaseUrl = cloudBaseUrl(environment);\n const cloudApiUrl = `${apiBaseUrl}/external`;\n // Validate the configured return destination before authentication or uploads.\n cloudFindingsUrl(environment, options.repository);\n const credentials = await (\n dependencies.credentials ??\n (() => readCloudCredentials(environment, dependencies.signal))\n )();\n let canStartJob = false;\n let repositorySeverities: string[] | undefined;\n const jobVersionHeader = \"Codex-Security-Private-Import-Job-Version\";\n const providerJobVersion = privateJobVersions[options.provider];\n // Older services recognize an exact v2 request for AWS. Only ask for v3\n // when publishing a provider introduced by that contract.\n const requestedJobVersion = String(providerJobVersion ?? 2);\n let jobApiVersion: typeof providerJobVersion;\n async function request(\n endpoint: string,\n body?: FindingImportRequest,\n ): Promise<unknown> {\n dependencies.signal?.throwIfAborted();\n // Allow upload and response transport around the server's publication budget.\n const timeout = AbortSignal.timeout(body ? 60_000 : 30_000);\n const repositoryCatalog = endpoint.startsWith(\"/repositories?\");\n const response = await (dependencies.fetch ?? globalThis.fetch)(\n `${cloudApiUrl}${endpoint}`,\n {\n method: body ? \"POST\" : \"GET\",\n headers: {\n Authorization: `Bearer ${credentials.access_token}`,\n \"ChatGPT-Account-ID\": credentials.account_id,\n Accept: \"application/json\",\n ...(repositoryCatalog\n ? { [jobVersionHeader]: requestedJobVersion }\n : {}),\n ...(body ? { \"Content-Type\": \"application/json\" } : {}),\n },\n ...(body ? { body: JSON.stringify(body) } : {}),\n redirect: \"error\",\n signal: dependencies.signal\n ? AbortSignal.any([dependencies.signal, timeout])\n : timeout,\n },\n );\n if (!response.ok) {\n const payload = (await response.json().catch(() => null)) as {\n error?: { message?: string };\n } | null;\n const retryAfter = response.headers.get(\"Retry-After\");\n const detail = payload?.error?.message ?? response.statusText;\n let message = `Cloud import failed (HTTP ${response.status}).`;\n if (detail) message += ` ${detail}`;\n if (repositoryCatalog && response.status === 404) {\n if (!/[.!?]$/u.test(message)) message += \".\";\n message +=\n \" Cloud import is not available for this account or deployment.\";\n }\n if (retryAfter) message += ` Retry-After: ${retryAfter}.`;\n throw new CloudImportError(response.status, message);\n }\n if (repositoryCatalog) {\n const advertised = (header: string) =>\n response.headers\n .get(header)\n ?.split(\",\")\n .map((item) => item.trim());\n repositorySeverities = advertised(\n \"Codex-Security-Repository-Import-Severities\",\n );\n canStartJob =\n advertised(\"Codex-Security-Private-Import-Providers\")?.includes(\n options.provider,\n ) ?? false;\n jobApiVersion =\n response.headers.get(jobVersionHeader) === requestedJobVersion\n ? providerJobVersion\n : undefined;\n }\n return response.json();\n }\n async function discoverDestination(): Promise<ImportRepository> {\n const destinations: ImportRepository[] = [];\n let page: string | null = null;\n const seenPages = new Set<string>();\n do {\n const result = validateRepositories(\n await request(\n `/repositories?limit=20&repository=${encodeURIComponent(options.repository)}${page ? `&page=${encodeURIComponent(page)}` : \"\"}`,\n ),\n );\n destinations.push(\n ...result.data.filter(\n (item) =>\n item.id === options.repository ||\n catalogKey(item.url) === catalogKey(options.repository),\n ),\n );\n page = result.next;\n if (\n result.has_more !== (page !== null) ||\n (page !== null && seenPages.has(page))\n )\n throw new CodexSecurityError(\n \"Cloud returned invalid repository pagination.\",\n );\n if (page !== null) seenPages.add(page);\n } while (page !== null);\n if (destinations.length !== 1)\n throw new CodexSecurityError(\n destinations.length\n ? \"The repository matches multiple connectors. Select an unambiguous Cloud repository.\"\n : \"The destination repository is not available to this Cloud account. Copy its repository URL or ID from Codex Security Cloud and check that you are signed into the intended account.\",\n );\n const destination = destinations[0]!;\n if (trivyReportUrls) validateTrivyRepositoryUrl(destination.url);\n return destination;\n }\n const destination = await discoverDestination();\n const deferred = typeof supplied === \"function\";\n const resolved = deferred ? await supplied(destination) : supplied;\n if (deferred) checkSelection(resolved);\n const report: ExternalFindings & Partial<SnykIssuesFindings> =\n resolved.current;\n const source = { provider: options.provider, source_key: options.sourceKey };\n const importPrefix = source.provider === \"sonar\" ? \"/v2\" : \"\";\n const sourceReportsPath = importPrefix + sourcePath(destination);\n const hosted = options.provider === \"snyk\" || options.provider === \"semgrep\";\n const parsed = hostedPublicationFindings(\n report,\n options.provider,\n destination,\n readerSources,\n );\n const key = hash(\n \"sha256\",\n canonicalJson([\n \"external-findings/2\",\n apiBaseUrl,\n credentials.account_id,\n destination.id,\n destination.repo_connector_id,\n source,\n publicationIdentity(parsed, options.provider),\n ...(workbench === \"preview\"\n ? [\"preview\"]\n : workbench\n ? [workbench.checkout, workbench.findings]\n : []),\n ]),\n );\n const pendingPath = join(state, key + \".pending.json\");\n const underPublishLock = <T>(operation: () => Promise<T>) =>\n withImportLock(state, key, dependencies.signal, operation);\n const removePending = () => rm(pendingPath, { force: true });\n const privateClient = privateImportClient(\n apiBaseUrl,\n credentials,\n dependencies.fetch ?? globalThis.fetch,\n dependencies.signal,\n );\n const scopedSemgrepReport =\n options.provider === \"semgrep\" &&\n \"sourceFormat\" in parsed &&\n isSemgrepPlatformFormat(parsed.sourceFormat);\n function wasReset(content: SavedSubmission) {\n return content.requests.some(\n ({ repository }) => repository.reset_marker !== destination.reset_marker,\n );\n }\n async function confirmReset() {\n // A newer pending request may have been written while the catalog response\n // was in flight. Confirm the reset after observing this immutable request.\n const confirmed = await discoverDestination();\n if (\n confirmed.id !== destination.id ||\n confirmed.repo_connector_id !== destination.repo_connector_id ||\n confirmed.reset_marker !== destination.reset_marker\n )\n throw new CodexSecurityError(\n \"The repository changed while preparing this publication. Review the destination again.\",\n );\n }\n function suppliedSemgrepScopeDigest() {\n const scope = semgrepPlatformReportScope(report, options.provider);\n return hash(\n \"sha256\",\n canonicalJson(\n scope?.format\n ? [\n scope.deployment,\n canonicalNumber(scope.projectId),\n scope.ref,\n scope.product,\n ]\n : null,\n ),\n );\n }\n function readSaved(\n content: SavedSubmission | null | undefined,\n ): SavedSubmission {\n if (\n !content ||\n content.accountId !== credentials.account_id ||\n !Array.isArray(content.requests) ||\n content.requests.length === 0\n )\n throw new Error(\"Saved import account or requests do not match.\");\n content.requests = content.requests.map(validateImportRequest);\n const actual = submissionFindings(content.requests);\n for (const finding of actual)\n checkRetainedTrivyProvider(options.provider, finding);\n if (\n content.requests.some(\n (batch) =>\n batch.repository.id !== destination.id ||\n batch.repository.repo_connector_id !==\n destination.repo_connector_id ||\n canonicalJson(batch.source) !== canonicalJson(source),\n )\n )\n throw new Error(\"Saved import destination does not match.\");\n checkFindingProvider({ ...parsed, findings: actual }, options.provider);\n const expected = repositoryFindings(parsed, content.repositorySeverities);\n if (canonicalJson(actual) !== canonicalJson(expected.map(wireFinding)))\n throw new CodexSecurityError(\n \"Saved import evidence does not match the selected input.\",\n );\n const scope = content.semgrepPartialScopeDigest;\n if (\n scope !== undefined &&\n !wasReset(content) &&\n scope !== suppliedSemgrepScopeDigest()\n )\n throw new CodexSecurityError(\n \"The supplied Semgrep report scope does not match the approved request.\",\n );\n return content;\n }\n async function readPending() {\n const bytes = await readOptionalFile(pendingPath);\n return bytes === undefined ? undefined : readSaved(JSON.parse(bytes));\n }\n async function readCompletedPublication(requests: FindingImportRequest[]) {\n const bytes = await readOptionalFile(join(state, key + \".result.json\"));\n if (bytes === undefined) return;\n const result = JSON.parse(bytes) as ExternalPublicationResult;\n if (\n (result.status === \"complete\" || result.status === \"partial\") &&\n result.receipts.length === requests.length &&\n result.receipts.every((r, i) => r.id === requests[i]!.request_id)\n )\n return {\n receipts: result.receipts.map((r, i) =>\n validatePublicationReceipt(r, requests[i]!),\n ),\n verified: result.verified,\n };\n }\n await validatePreparedOutputDir(state, undefined, true).catch(\n nullIfMissingFile,\n );\n const saved = await readPending();\n if (saved && wasReset(saved)) {\n await underPublishLock(async () => {\n const current = await readPending();\n if (current && sameSubmission(current, saved)) {\n await confirmReset();\n if (record && current.receipts?.length) {\n await record(\n {\n cloudApiUrl,\n accountId: credentials.account_id,\n destination,\n requests: current.requests,\n findings: [],\n },\n acknowledgedReceipts(current),\n );\n }\n await removePending();\n }\n });\n throw new CloudImportError(\n 409,\n \"The repository was reset after this submission. The saved request was retired without uploading. Review the destination and run the command again to approve a fresh publication.\",\n );\n }\n if (saved?.inspectorProjectMapRequired && !inspectorProjectMap)\n throw new CodexSecurityError(\n \"Supply the verified Inspector project binding again to resume.\",\n );\n\n // Existing repository submissions keep their original request bodies and receipts.\n const privatePath = join(state, `${key}.private-import.json`);\n const readPrivate = async () =>\n parsePrivateCheckpoint(await readOptionalFile(privatePath));\n const privateSaved = await readPrivate();\n const usePrivateImport =\n !saved && (canStartJob || privateSaved !== undefined);\n async function preparePrivateAttempt() {\n const context = await privateClient.context();\n if (source.source_key.trim() !== source.source_key)\n throw new CodexSecurityError(\n \"A private source key cannot have leading or trailing whitespace.\",\n );\n const report = selectPrivateReport(\n parsed.findings,\n source.provider,\n context,\n privateSaved?.contextVersion === context.context_version\n ? privateSaved.format\n : undefined,\n );\n const binding = {\n format: report.format,\n apiBaseUrl,\n accountId: credentials.account_id,\n source,\n repository: {\n id: destination.id,\n repo_connector_id: destination.repo_connector_id,\n },\n sha256: report.digest,\n contextVersion: context.context_version,\n };\n return { context, report, binding };\n }\n function acceptsJob(\n context: PrivateImportContext,\n format: PrivateImportFormat,\n ) {\n return context.can_create_import_jobs && context.formats.includes(format);\n }\n // Use an earlier catalog URL only after the account, connector, repository,\n // inbox context and exact upload digest all match the immutable checkpoint.\n const privateAttempt = usePrivateImport\n ? await preparePrivateAttempt()\n : undefined;\n const previous =\n privateAttempt &&\n readPrivateCheckpoint(privateSaved, privateAttempt.binding);\n const retryOfJobId =\n unsuccessfulJob(previous?.receipt) &&\n canStartJob &&\n privateAttempt?.context.can_upload &&\n acceptsJob(privateAttempt.context, privateAttempt.report.format)\n ? previous?.jobId\n : undefined;\n const resumed = previous !== undefined && retryOfJobId === undefined;\n const privateApproval = resumed ? previous : undefined;\n const privateUrl = privateApproval?.approvedRepositoryUrl;\n const approvedPlatform =\n saved?.approvedRepositoryPlatform ??\n privateApproval?.approvedRepositoryPlatform;\n\n // The findings-only checkpoint key lets projected and native callers resume one immutable\n // request. Supplemental report claims are outside that digest and must still match its source.\n const approvedUrl =\n saved?.approvedRepositoryUrl ??\n saved?.trivyRepositoryUrl ??\n privateUrl ??\n destination.url;\n const sourceFor = (url: string, platform?: \"other\") =>\n hostedRepositoryMatcher(\n platform ? { ...report, sourceRepositoryPlatform: platform } : report,\n options.provider,\n declaredUrl,\n { url },\n readerSources,\n );\n if (\n readerSources.some(({ platform, url }) => {\n const source = normalizeHostedGitRepositoryUrl(\n url,\n approvedUrl,\n platform !== undefined,\n );\n return (\n cloudSourceKey(source, platform) !==\n cloudSourceKey(approvedUrl, platform)\n );\n })\n )\n throw new CodexSecurityError(\n \"The reader's source repository does not match the selected Cloud repository.\",\n );\n await resolved.recheckFileRepository?.(approvedUrl, approvedPlatform);\n const hostedSource = hosted\n ? sourceFor(approvedUrl, approvedPlatform)\n : undefined;\n const matchesHostedRepository = hostedSource?.matches;\n function requireApprovedSource(url: string, platform?: \"other\") {\n const binding =\n platform && hostedSource?.github\n ? sourceFor(url, platform)\n : hostedSource;\n if (binding && !binding.matches(url))\n throw new CodexSecurityError(\n \"The source project does not match the selected Cloud repository.\",\n );\n }\n requireApprovedSource(approvedUrl);\n\n const trivyTarget =\n saved?.trivyRepositoryUrl ?? privateUrl ?? destination.url;\n function requireTrivyRemote(url: string, id?: string) {\n if (trivyRemoteKey(url, trivyTarget) !== catalogKey(trivyTarget)) {\n const label =\n id === undefined ? \"Source report\" : `Finding ${JSON.stringify(id)}`;\n throw new CodexSecurityError(\n `${label} belongs to ${JSON.stringify(url)}, which does not match the selected Cloud repository ${JSON.stringify(trivyTarget)}. Verify the source repository mapping before publishing.`,\n );\n }\n }\n for (const url of trivyReportUrls ?? []) requireTrivyRemote(url);\n\n function checkRepositories(\n { findings, report }: Pick<ExternalFindings, \"findings\" | \"report\">,\n historical = Boolean(saved),\n ) {\n const { provider } = options;\n checkTrivyReportProvider(provider, report);\n // A catalog casing or spelling change keeps the original source comparison target.\n const approved = hosted ? saved?.approvedRepositoryUrl : undefined;\n const sameCatalog =\n approved !== undefined &&\n cloudSourceKey(approved, \"github\") ===\n cloudSourceKey(destination.url, \"github\");\n const comparisonUrl = trivyReportUrls\n ? trivyTarget\n : sameCatalog\n ? approved\n : (privateUrl ?? destination.url);\n const key = sameCatalog\n ? (url: string) =>\n cloudSourceKey(\n url,\n saved?.approvedRepositoryPlatform === \"other\"\n ? undefined\n : \"github\",\n )\n : catalogKey;\n function requireDestination(id: string, url: string | null | undefined) {\n if (\n url &&\n (matchesHostedRepository\n ? !matchesHostedRepository(url) ||\n !matchesHostedRepository(comparisonUrl)\n : key(url) !== key(comparisonUrl))\n )\n throw new CodexSecurityError(\n `Finding ${JSON.stringify(id)} belongs to ${JSON.stringify(url)}, which does not match the selected Cloud repository ${JSON.stringify(destination.url)}. Verify the source repository mapping before publishing.`,\n );\n }\n if (provider === \"armorcode\")\n requireDestination(\"ArmorCode source\", declaredUrl);\n if (report?.[\"format\"] === guardianSelectionFormat)\n requireDestination(\n \"Guardian source\",\n declaredScannerRepositoryUrl(report[\"repositoryUrl\"], \"Guardian\"),\n );\n // An immutable retry may refer to an earlier repository name. Additional\n // file declarations outside its saved findings authorize no new writes.\n if (!historical)\n for (const { url } of fileRepositories?.() ?? [])\n requireDestination(\n \"Source report\",\n provider === \"snyk\"\n ? normalizeHostedGitRepositoryUrl(url, destination.url, true)\n : url,\n );\n // Historical checkpoints already fixed the provider and request bytes.\n // Recheck any projected source against the destination discovered for this retry.\n const checkNative = (...providers: (typeof provider)[]) =>\n !historical ||\n trivyReportUrls !== undefined ||\n providers.includes(provider);\n if (checkNative(\"sonar\")) {\n for (const url of sonarRepositoryUrls(\n provider,\n findings,\n report,\n \"cloud\",\n ))\n requireDestination(\"Sonar source\", url);\n }\n const checkmarx = checkmarxSelection(\n provider,\n findings,\n report,\n \"cloud\",\n historical,\n );\n requireDestination(\"Checkmarx source\", checkmarx.reportUrl);\n const blackDuck = checkNative(\"blackduck\")\n ? blackDuckReportRepositories(provider, findings, \"cloud\")\n : undefined;\n const checkmarxRepository = checkmarx.repositories();\n for (const [scanner, repositories] of [\n [\"veracode\", veracodeReportRepositories],\n [\"continuum\", continuumReportRepositories],\n ] as const) {\n if (!checkNative(scanner)) continue;\n for (const [id, source] of repositories(provider, findings, \"cloud\"))\n requireDestination(id, source.url);\n }\n if (checkNative(\"blackduck\", \"inspector\", \"veracode\")) {\n const binding = inspectorReportRepository(\n provider,\n findings,\n \"cloud\",\n inspectorProjectMap,\n );\n if (binding) requireDestination(binding.findingId, binding.url);\n }\n const checkOnlyProjected = !checkNative(\n \"armorcode\",\n \"blackduck\",\n \"inspector\",\n \"veracode\",\n \"checkmarx\",\n \"continuum\",\n \"sonar\",\n );\n for (const finding of findings) {\n const { source_finding_id: id, evidence } = finding;\n const guardian = guardianFindingRepository(finding, \"cloud\");\n if (guardian) {\n requireDestination(id, guardian);\n requireDestination(id, evidence.details?.repository?.url);\n }\n checkRetainedTrivyProvider(provider, finding);\n if (trivyReportUrls) {\n const remote = trivyRepositoryUrl(\n retainedTrivyReport(finding),\n trivyTarget,\n );\n if (remote) requireTrivyRemote(remote, id);\n }\n const blackDuckUrl = blackDuck\n ? blackDuck.get(id)?.url\n : projectedBlackDuckRepositoryUrl(finding, \"cloud\");\n const hasProjection =\n !!blackDuckUrl || checkmarx.projections.has(finding);\n if (checkOnlyProjected && !hasProjection) continue;\n let urls = [\n blackDuckUrl,\n checkmarxRepository(finding)?.url,\n evidence.details?.repository?.url,\n ];\n if (provider === \"armorcode\") {\n urls.push(armorCodeRepositoryUrl(evidence.source_data, \"cloud\"));\n } else if (provider === \"wiz\") {\n const native =\n hasProjection ||\n (!historical && isWizPackageFinding(evidence.source_data));\n urls.push(\n native\n ? wizFindingRepository(evidence, \"cloud\")?.url\n : wizCsvRepositoryUrl(evidence),\n );\n } else if (provider === \"snyk\") {\n urls = urls.concat(\n snykRepositoryUrls(evidence.source_data, {\n cloudRepositoryUrl: destination.url,\n }),\n );\n } else if (provider === \"endor\") {\n urls = urls.concat(\n endorRepositoryUrls(\n evidence.source_data,\n !blackDuck && !blackDuckUrl,\n ),\n );\n } else if (provider === \"github\") {\n if (!historical) urls.push(retainedGitHubRepository(finding));\n urls.push(dependabotRepository(finding));\n }\n for (const url of urls) requireDestination(id, url);\n }\n }\n if (!saved) {\n for (const finding of parsed.findings) {\n if (\n options.provider !== \"semgrep\" &&\n isSemgrepPlatformEvidence(finding, options.provider)\n )\n throw new CodexSecurityError(\n \"Semgrep Platform evidence requires the semgrep provider.\",\n );\n if (options.provider !== \"snyk\" && isSnykRestFinding(finding))\n throw new CodexSecurityError(\n \"Snyk REST evidence requires the snyk provider.\",\n );\n }\n }\n if (!privateAttempt) checkRepositories(parsed);\n if (privateAttempt) {\n const client = privateClient;\n const { context, report, binding } = privateAttempt;\n function requireAccess(value: typeof context, saved: typeof previous) {\n if (\n !value.can_read ||\n (!saved && !canStartJob) ||\n (!saved?.jobId &&\n ((!saved?.fileId && !value.can_upload) ||\n !acceptsJob(value, report.format)))\n )\n throw new CodexSecurityError(\n \"Private findings import is unavailable for this account or report format.\",\n );\n }\n checkRepositories(parsed, resumed);\n requireAccess(context, previous);\n const privateImport = {\n format: report.format,\n contextVersion: binding.contextVersion,\n sha256: report.digest,\n bytes: Buffer.byteLength(report.bytes),\n ...(retryOfJobId ? { retryOfJobId } : {}),\n };\n const preview: ExternalPublicationPreview = {\n ...parsed,\n cloudApiUrl: `${apiBaseUrl}/finding-imports`,\n accountId: credentials.account_id,\n destination,\n source,\n resumed,\n requests: [],\n privateImport,\n };\n return withReceipts(preview, {\n preview: structuredClone(preview),\n publish: () =>\n underPublishLock(async () => {\n const current = await client.context();\n if (current.context_version !== binding.contextVersion)\n throw new CodexSecurityError(\n \"The private inbox changed. Run the command again to review the new destination.\",\n );\n const stored = readPrivateCheckpoint(await readPrivate(), binding);\n if (previous && !stored)\n throw new CodexSecurityError(\n \"The saved private import changed. Run the command again to preview this report.\",\n );\n // Only a preview of this terminal job can start a new attempt.\n const retrying =\n retryOfJobId !== undefined && stored?.receipt?.id === retryOfJobId;\n const active = retrying ? undefined : stored;\n requireAccess(current, active);\n if (await readPending())\n throw new CodexSecurityError(\n \"A repository submission is pending. Review its saved request before continuing.\",\n );\n const checkpoint = active ?? {\n ...binding,\n approvedRepositoryUrl: destination.url,\n approvedRepositoryPlatform:\n hostedSource?.github === false ? (\"other\" as const) : undefined,\n uploadRequestId: randomUUID(),\n jobRequestId: randomUUID(),\n jobApiVersion: retrying ? stored?.jobApiVersion : jobApiVersion,\n fileId: undefined,\n jobId: undefined,\n receipt: undefined,\n previousReceipt: retrying ? stored?.receipt : undefined,\n };\n const result: ExternalPublicationResult = {\n cloudApiUrl: preview.cloudApiUrl,\n status: \"interrupted\",\n read: parsed.read,\n ready: parsed.findings.length,\n report: parsed.report,\n excluded: parsed.excluded,\n receipts: [],\n counts: { created: 0, updated: 0, unchanged: 0, error: 0 },\n failures: [],\n unacknowledged: parsed.findings.length,\n verified: 0,\n };\n function acknowledge(job: PrivateImportJob) {\n const { created, updated, unchanged, error } = job.counts;\n const processed = created + updated + unchanged + error;\n if (\n job.counts.discovered !== processed + job.counts.unprocessed ||\n job.counts.discovered > result.ready ||\n (job.status === \"completed\" &&\n (processed !== result.ready ||\n job.counts.total !== result.ready))\n )\n throw new CodexSecurityError(\n \"Cloud returned counts that do not match the selected report.\",\n );\n result.privateJob = job;\n result.counts = { created, updated, unchanged, error };\n result.unacknowledged = result.ready - processed;\n result.status =\n job.status === \"completed\" && !error && !parsed.excluded.length\n ? \"complete\"\n : \"partial\";\n if (job.error) result.error = job.error.message;\n else delete result.error;\n }\n try {\n const savedReceipt =\n checkpoint.receipt ?? checkpoint.previousReceipt;\n if (savedReceipt) acknowledge(savedReceipt);\n if (!active) await writeAtomicJson(privatePath, checkpoint);\n if (!checkpoint.fileId) {\n progress({ phase: \"uploading\", completed: 0 });\n checkpoint.fileId = await client.upload({\n requestId: checkpoint.uploadRequestId,\n contextVersion: binding.contextVersion,\n ...report,\n recovering: active !== undefined,\n });\n await writeAtomicJson(privatePath, checkpoint);\n }\n progress({ phase: \"verifying\", completed: 0 });\n const job = await client.job(\n {\n requestId: checkpoint.jobRequestId,\n contextVersion: binding.contextVersion,\n fileId: checkpoint.fileId,\n format: report.format,\n source,\n repository: binding.repository,\n jobId: checkpoint.jobId,\n jobApiVersion: checkpoint.jobApiVersion,\n },\n async (id) => {\n checkpoint.jobId = id;\n await writeAtomicJson(privatePath, checkpoint);\n },\n );\n acknowledge(job);\n checkpoint.jobId = job.id;\n checkpoint.receipt = job;\n await writeAtomicJson(privatePath, checkpoint);\n return result;\n } catch (error) {\n result.status = \"interrupted\";\n result.error =\n error instanceof Error ? error.message : String(error);\n result.savedSubmission = privatePath;\n throw new ExternalPublicationError(result.error, result, error);\n }\n }),\n });\n }\n\n // The original selection and request bytes govern a retry even if discovery changes.\n const severities = saved ? saved.repositorySeverities : repositorySeverities;\n const direct = repositorySelection(\n parsed,\n severities,\n resolved.sourcePositions,\n );\n if (!direct.findings.length) throw new NoPublishableFindingsError(direct);\n let requests = saved?.requests;\n if (!requests) {\n let preparedCount = 0;\n progress({\n phase: \"preparing\",\n completed: 0,\n total: direct.findings.length,\n });\n const previousReports = await readInBatches(\n direct.findings,\n async (finding): Promise<SourceReportSummary | undefined> => {\n const query = new URLSearchParams({\n provider: source.provider,\n source_key: source.source_key,\n source_finding_id: finding.source_finding_id,\n limit: \"2\",\n });\n const summaries = validateSourceReports(\n await request(`${sourceReportsPath}?${query}`),\n );\n if (summaries.has_more || summaries.data.length > 1)\n throw new CodexSecurityError(\n \"Cloud returned more than one report for a source identity.\",\n );\n const previous = summaries.data[0];\n if (\n previous &&\n (previous.source_finding_id !== finding.source_finding_id ||\n previous.source.provider !== source.provider ||\n previous.source.source_key !== source.source_key ||\n previous.repo_id !== destination.id ||\n previous.repo_connector_id !== destination.repo_connector_id)\n )\n throw new CodexSecurityError(\n \"Cloud returned a different source identity.\",\n );\n progress({\n phase: \"preparing\",\n completed: ++preparedCount,\n total: direct.findings.length,\n });\n return previous;\n },\n );\n requests = [];\n let current: FindingImportRequest | undefined;\n let currentBytes = 0;\n for (const [index, finding] of direct.findings.entries()) {\n const previous = previousReports[index];\n const environmentId =\n previous?.environment_id ?? destination.import_environment_id;\n if (environmentId == null)\n throw new CodexSecurityError(\n \"Configure an authorized Cloud environment for this repository before importing findings.\",\n );\n const item = {\n client_id: `item-${index + 1}`,\n source_finding_id: finding.source_finding_id,\n expected_version: previous?.version ?? 0,\n evidence: finding.evidence,\n };\n const itemBytes = Buffer.byteLength(JSON.stringify(item));\n if (\n current &&\n (current.repository.environment_id !== environmentId ||\n current.items.length === 100 ||\n currentBytes + 1 + itemBytes > MAX_REQUEST_BYTES)\n ) {\n requests.push(validateImportRequest(current));\n current = undefined;\n }\n if (!current) {\n current = {\n request_id: randomUUID(),\n repository: {\n id: destination.id,\n repo_connector_id: destination.repo_connector_id,\n environment_id: environmentId,\n reset_marker: destination.reset_marker,\n },\n source,\n items: [],\n };\n currentBytes = Buffer.byteLength(JSON.stringify(current));\n } else {\n currentBytes++;\n }\n current.items.push(item);\n currentBytes += itemBytes;\n }\n if (current) requests.push(validateImportRequest(current));\n }\n const bindSemgrepScope =\n !saved &&\n options.provider === \"semgrep\" &&\n report.findings.some(\n (finding) =>\n !isSemgrepPlatformEvidence(finding, \"semgrep\") &&\n (scopedSemgrepReport ||\n hasRetainedSemgrepScope(finding.evidence.source_data?.[\"finding\"])),\n );\n const submission: SavedSubmission = {\n accountId: credentials.account_id,\n ...(trivyReportUrls && { trivyRepositoryUrl: trivyTarget }),\n requests,\n receipts: saved?.receipts,\n repositorySeverities: severities,\n semgrepPartialScopeDigest: bindSemgrepScope\n ? suppliedSemgrepScopeDigest()\n : saved?.semgrepPartialScopeDigest,\n approvedRepositoryUrl: hosted ? approvedUrl : undefined,\n };\n if (\n saved?.approvedRepositoryPlatform ||\n (hostedSource && !hostedSource.github)\n )\n submission.approvedRepositoryPlatform = \"other\";\n if (inspectorProjectMap) submission.inspectorProjectMapRequired = true;\n const preview: ExternalPublicationPreview = {\n ...direct,\n findings: submissionFindings(requests),\n cloudApiUrl,\n cloudUrl: cloudFindingsUrl(environment, destination.id),\n accountId: credentials.account_id,\n destination,\n source,\n resumed: saved !== undefined,\n requests,\n };\n return withReceipts(preview, {\n preview: cloneImportPreview(preview),\n async publish(beforeRetire) {\n progress({ phase: \"waiting\", completed: 0 });\n const result = (\n acknowledged: FindingImportReceipt[],\n verified: number,\n ): ExternalPublicationResult => {\n const counts = { created: 0, updated: 0, unchanged: 0, error: 0 };\n const failures: ExternalPublicationResult[\"failures\"] = [];\n for (const [index, receipt] of acknowledged.entries()) {\n for (const outcome of Object.keys(counts) as (keyof typeof counts)[])\n counts[outcome] += receipt.counts[outcome] ?? 0;\n const ids = new Map(\n requests[index]!.items.map((item) => [\n item.client_id,\n item.source_finding_id,\n ]),\n );\n for (const item of receipt.results)\n if (item.error)\n failures.push({\n source_finding_id: ids.get(item.client_id)!,\n ...item.error,\n });\n }\n return {\n cloudApiUrl,\n cloudUrl: preview.cloudUrl,\n status:\n direct.excluded.length || counts.error ? \"partial\" : \"complete\",\n read: parsed.read,\n ...(parsed.report === undefined\n ? {}\n : snapshotNormalizedFindings({ report: parsed.report })),\n ready: direct.findings.length,\n excluded: direct.excluded,\n receipts: acknowledged,\n counts,\n failures,\n unacknowledged:\n direct.findings.length -\n Object.values(counts).reduce((sum, count) => sum + count, 0),\n verified,\n };\n };\n function interruptedPreview(\n message: string,\n cause?: unknown,\n savedSubmission?: string,\n ) {\n // The expected file is gone or another publisher owns the lock. Use only\n // the acknowledgements this caller saw when it prepared the request.\n return new ExternalPublicationError(\n message,\n {\n ...result(acknowledgedReceipts(submission), 0),\n status: \"interrupted\",\n error: message,\n ...(savedSubmission === undefined ? {} : { savedSubmission }),\n },\n cause,\n );\n }\n let acquired = false;\n return await underPublishLock(async () => {\n acquired = true;\n // Re-read under the lock to keep checkpoints from another publisher.\n let pending = await readPending().catch((error: unknown) => {\n if (!submission.receipts?.length) throw error;\n throw interruptedPreview(errorMessage(error), error);\n });\n const current = pending ?? submission;\n const adoptProjectMap =\n submission.inspectorProjectMapRequired &&\n current.inspectorProjectMapRequired === undefined;\n if (adoptProjectMap) current.inspectorProjectMapRequired = true;\n if (current.approvedRepositoryUrl)\n requireApprovedSource(\n current.approvedRepositoryUrl,\n current.approvedRepositoryPlatform,\n );\n if (!pending || !sameSubmission(current, submission)) {\n const message = pending\n ? \"Another publication prepared this input. Run the command again to review and resume that saved request.\"\n : \"The saved publication changed after preview. Review its result before publishing again.\";\n if (saved) {\n const completed = await readCompletedPublication(requests);\n if (completed)\n return result(completed.receipts, completed.verified);\n throw interruptedPreview(message);\n }\n if (pending) throw new CodexSecurityError(message);\n if ((await readOptionalFile(privatePath)) !== undefined)\n throw new CodexSecurityError(\n \"A private import already owns this selection. Review its saved job before continuing.\",\n );\n }\n // A preview can pin the catalog URL. Tighten its SCM comparison only\n // once the caller confirms publication, including when resuming a request.\n const adoptStrictRepository =\n submission.approvedRepositoryPlatform === \"other\" &&\n !current.approvedRepositoryPlatform;\n if (adoptStrictRepository) current.approvedRepositoryPlatform = \"other\";\n const cached = (current.receipts ?? []).map(validateImportReceipt);\n if (cached.length > requests.length)\n throw new CodexSecurityError(\n \"Saved publication has more receipts than requests.\",\n );\n const acknowledged: FindingImportReceipt[] = [];\n let verified = 0;\n try {\n if (!pending || adoptProjectMap || adoptStrictRepository) {\n await writeAtomicJson(pendingPath, current);\n pending = current;\n }\n progress({\n phase: \"uploading\",\n completed: 0,\n total: direct.findings.length,\n });\n let acknowledgedCount = 0;\n for (const [batchIndex, batch] of requests.entries()) {\n const receipt = validatePublicationReceipt(\n cached[batchIndex] ??\n (await request(`${importPrefix}/finding_imports`, batch)),\n batch,\n );\n acknowledged.push(receipt);\n acknowledgedCount += receipt.item_count;\n progress({\n phase: \"uploading\",\n completed: acknowledgedCount,\n total: direct.findings.length,\n });\n if (batchIndex >= cached.length) {\n // Acknowledged batches must not consume another POST quota on retry.\n // Readback can still resume after this checkpoint without replaying writes.\n await writeAtomicJson(pendingPath, {\n ...current,\n receipts: acknowledged,\n });\n }\n }\n // Verify readable source records without mistaking a newer concurrent\n // observation for failure of the original, immutable import receipt.\n const readbacks = acknowledged.flatMap((receipt, batchIndex) => {\n const batch = requests[batchIndex]!;\n const batchItems = new Map(\n batch.items.map((item) => [item.client_id, item]),\n );\n return receipt.results\n .filter((item) => item.outcome !== \"error\")\n .map((item) => ({\n item,\n expected: batchItems.get(item.client_id)!,\n batch,\n }));\n });\n progress({\n phase: \"verifying\",\n completed: 0,\n total: readbacks.length,\n });\n await readInBatches(readbacks, async ({ item, expected, batch }) => {\n const report = validateSourceReport(\n await request(\n `${sourceReportsPath}/${encodeURIComponent(item.source_report_id!)}`,\n ),\n );\n if (\n report.id !== item.source_report_id ||\n report.canonical_finding_id !== item.canonical_finding_id ||\n report.version < item.version! ||\n (report.version === item.version &&\n (report.observation_id !== item.observation_id ||\n !matchesRepositoryEvidence(\n expected.evidence,\n report.evidence,\n ))) ||\n report.source_finding_id !== expected.source_finding_id ||\n report.repo_id !== destination.id ||\n report.repo_connector_id !== destination.repo_connector_id ||\n report.environment_id !== batch.repository.environment_id ||\n canonicalJson(report.source) !== canonicalJson(source)\n )\n throw new CodexSecurityError(\n \"Cloud readback did not match the saved finding identity.\",\n );\n progress({\n phase: \"verifying\",\n completed: ++verified,\n total: readbacks.length,\n });\n });\n const completed = result(acknowledged, verified);\n await writeAtomicJson(join(state, `${key}.result.json`), {\n ...completed,\n report: reportForJson(completed.report),\n });\n await beforeRetire?.(completed);\n await removePending();\n return completed;\n } catch (error) {\n if (error instanceof CloudImportError && error.status === 409) {\n try {\n await beforeRetire?.(result(acknowledged, verified));\n await removePending();\n pending = undefined;\n } catch (recordError) {\n // Keep acknowledged batches resumable when their receipts are not durable.\n error = recordError;\n }\n }\n const message = `${error instanceof Error ? error.message : String(error)} ${error instanceof CloudImportError && error.status === 409 ? \"The old submission was retired. Rediscover and approve a fresh publication.\" : pending ? `Repeat the same command to resume the saved request. Saved submission: ${pendingPath}` : \"No resumable request was saved. Correct the error and review the input before retrying.\"}`;\n throw new ExternalPublicationError(\n message,\n {\n ...result(acknowledged, verified),\n status: \"interrupted\",\n error: message,\n ...(pending ? { savedSubmission: pendingPath } : {}),\n },\n error,\n );\n }\n }).catch((error: unknown) => {\n if (acquired || !dependencies.signal?.aborted) throw error;\n const message = saved\n ? `Publication canceled while waiting. Repeat the same command to resume the saved request. Saved submission: ${pendingPath}`\n : \"Publication canceled while waiting. No resumable request was saved by this invocation.\";\n throw interruptedPreview(\n message,\n error,\n saved ? pendingPath : undefined,\n );\n });\n },\n });\n}\n"]}
|