Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

feat(import): support AWS Continuum code findings (#2264)

Michael D'Angelobc538d434afa
diff --git a/docs/scanner-imports/README.md b/docs/scanner-imports/README.md
index d72dcb32f..d71be20ba 100644
--- a/docs/scanner-imports/README.md
+++ b/docs/scanner-imports/README.md
@@ -15,6 +15,7 @@ guide. Otherwise, ask for a supported report. A fresh scan produces new results.
| Guide | Supported input |
| ----------------------------------------------------------- | ------------------------------------------------------------------------------- |
| [Amazon Inspector](inspector.md) | Inspector2 `ListFindings` JSON for one Code Security repository |
+| [AWS Continuum](continuum.md) | Code finding summaries or a detailed finding verified for one repository |
| [Black Duck SCA](blackduck.md) | BOM component vulnerabilities for one project version |
| [Endor Labs](endor.md) | Finding JSON from `endorctl`, or SARIF with finding UUIDs |
| [GitHub code scanning](github-code-scanning.md) | Alerts selected for one repository and Git ref |
diff --git a/docs/scanner-imports/continuum.md b/docs/scanner-imports/continuum.md
new file mode 100644
index 000000000..4a37d5aed
--- /dev/null
+++ b/docs/scanner-imports/continuum.md
@@ -0,0 +1,70 @@
+# Import AWS Continuum code findings
+
+Import a saved JSON response from AWS Continuum for Code Vulnerabilities.
+Use a detailed finding for investigation or a list of summaries for an
+overview of one repository.
+
+## Export findings for one repository
+
+Use an AWS CLI with the `continuum` commands, signed in to the account and
+Region where the environment lives. Set `ENVIRONMENT_ID` to that environment.
+Check its code sources against the repository you intend to import into. For
+an S3 source, verify which repository supplied the scanned archive.
+[AWS Continuum code sources](https://docs.aws.amazon.com/continuum/latest/userguide/cv-getting-started.html)
+
+**One finding.** Check the finding against its scanned code source, then set
+`FINDING_ID` to its Continuum finding ID. For a finding from another scanner,
+you can also verify the repository in the originating scanner. The detail
+response can include code locations, descriptions, mitigation and AWS
+validation evidence.
+[AWS CLI get-code-finding](https://docs.aws.amazon.com/cli/latest/reference/continuum/get-code-finding.html)
+
+```sh
+out=$(mktemp -d) &&
+ aws continuum get-code-finding --environment-id "$ENVIRONMENT_ID" \
+ --finding-id "$FINDING_ID" --output json > "$out/continuum.tmp" &&
+ mv "$out/continuum.tmp" "$out/continuum.json"
+```
+
+**All summaries.** For bulk import, use an environment dedicated to one
+repository and verify that the export belongs to that repository. Start on
+the first page with automatic pagination enabled. Keep the JSON object with
+its `items` array. In a mixed environment, export verified findings with
+`get-code-finding`.
+[AWS CLI list-code-findings](https://docs.aws.amazon.com/cli/latest/reference/continuum/list-code-findings.html)
+
+```sh
+out=$(mktemp -d) &&
+ aws continuum list-code-findings --environment-id "$ENVIRONMENT_ID" \
+ --output json > "$out/continuum.tmp" &&
+ mv "$out/continuum.tmp" "$out/continuum.json"
+```
+
+## Preview and import
+
+[Enable external imports](README.md#preview-a-report). From the matching
+checkout, preview the export with the verified Git URL and a stable source key
+for the environment and repository.
+
+```sh
+codex-security publish findings "$out/continuum.json" \
+ --to local --repository . --provider continuum \
+ --source-repository-url https://github.com/example/project \
+ --source-key "continuum/$ENVIRONMENT_ID/example/project" \
+ --dry-run --format json
+```
+
+Check the destination, finding ARNs, reported paths and exclusions. In
+multi-repository environments, customer-supplied paths can start with a
+repository name. The reader preserves that prefix. Follow
+the shared steps to save locally or publish to a Cloud deployment that
+accepts the `continuum` provider. [Save or publish and verify](README.md#save-or-publish-and-verify)
+
+The finding ARN identifies the same occurrence in either export. With the
+same source key, importing a detail response after its summary updates the
+existing record. A subsequent summary replaces that richer evidence. Reuse
+`get-code-finding` for updates when you need the details.
+Both scanner-generated and customer-supplied code findings retain their AWS
+fields in `evidence.source_data.finding`. Continuum status and validation
+are vendor evidence. New findings start with a Codex assessment of
+`not_assessed`.
diff --git a/docs/scanner-imports/schema-guide.md b/docs/scanner-imports/schema-guide.md
index 3bbda2319..a8bfaa55b 100644
--- a/docs/scanner-imports/schema-guide.md
+++ b/docs/scanner-imports/schema-guide.md
@@ -26,6 +26,7 @@ changes.
| Report | What identifies one record |
| ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Amazon Inspector](inspector.md), [Endor Labs](endor.md), [SonarQube Cloud](sonar.md) | Inspector finding ARN, Endor Finding UUID or Sonar issue key. Endor native JSON and SARIF use the same UUID. |
+| [AWS Continuum](continuum.md) | Continuum finding ARN. A list summary and a detailed response for that ARN update the same record. |
| [Wiz](wiz.md) | Package occurrence ID, or a SAST, repository-secret or IaC occurrence ID prefixed with its family. Normalized JSONL uses the supplied ID. |
| [GitHub Dependabot](github-dependabot.md), [code scanning](github-code-scanning.md) | Host, repository, alert family and alert number. Code scanning also includes the selected ref. Two alerts citing one GHSA remain separate. |
| [GitHub advisories](github-security-advisories.md) | Host, repository or global scope, and GHSA ID. This identifies a disclosure. Check installed packages separately. |
diff --git a/plugins/codex-security/skills/publish-findings/SKILL.md b/plugins/codex-security/skills/publish-findings/SKILL.md
index d82abdea4..e8d956cff 100644
--- a/plugins/codex-security/skills/publish-findings/SKILL.md
+++ b/plugins/codex-security/skills/publish-findings/SKILL.md
@@ -35,6 +35,10 @@ Local records remain unassessed source evidence, separate from `findings list` a
Use `--provider inspector` and `--source-repository-url` with a complete Inspector2 ListFindings export for one Code Security repository. If it contains only a project ARN and name, pass the full `--inspector-project-arn ARN` verified for that Git URL in the SCM integration. Supply the same ARN when resuming a pending Cloud submission. Self-managed GitLab is supported locally.
+## AWS Continuum code findings
+
+Use `--provider continuum` and `--source-repository-url` for an AWS Continuum for Code Vulnerabilities export. Verify which repository owns each selected finding. Use `aws continuum get-code-finding` for a selected ID, or `list-code-findings` with automatic pagination when every row belongs to the requested repository. Reuse the same source key for that environment and repository. [Continuum import guide](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/continuum.md)
+
## Black Duck SCA project-version vulnerabilities
Use `--provider blackduck` for a BOM-6 vulnerable-components export from one project version. Supply `--source-repository-url` after verifying the project version maps to that repository. Keep the same source key on replay and preview the destination before importing.
diff --git a/sdk/typescript/README.md b/sdk/typescript/README.md
index c35d53f87..79af5fefc 100644
--- a/sdk/typescript/README.md
+++ b/sdk/typescript/README.md
@@ -674,6 +674,11 @@ Omit `issueKeys` to collect the project's open security issues. An empty list is
If you know the source repository, pass its Git URL in `options.sourceRepositoryUrl`
to check the Sonar binding before fetching issues.
Pure normalizers and file readers remain available.
+For AWS Continuum code findings, use `readContinuumFindings(path, sourceRepositoryUrl)`
+with a saved list or detail response, or `normalizeContinuumFindings(input, sourceRepositoryUrl)`
+with parsed JSON. Verify the repository for the selected findings before passing its Git URL.
+[Continuum import guide](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/continuum.md)
+
Use `normalizeSelectedSemgrepPlatformFindings` for selected SAST findings from saved
Semgrep Web API responses. See the [Semgrep SDK example](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/semgrep.md#import-selected-semgrep-platform-sast-findings-with-the-sdk).
This does not affect scan publishing or the existing GitHub alert collector.
diff --git a/sdk/typescript/schemas/external-findings.schema.json b/sdk/typescript/schemas/external-findings.schema.json
index 0b49fc3dd..54f05f1b9 100644
--- a/sdk/typescript/schemas/external-findings.schema.json
+++ b/sdk/typescript/schemas/external-findings.schema.json
@@ -387,7 +387,8 @@
"inspector",
"blackduck",
"veracode",
- "sonar"
+ "sonar",
+ "continuum"
],
"title": "Provider",
"type": "string"
diff --git a/sdk/typescript/scripts/package-dist-files.mjs b/sdk/typescript/scripts/package-dist-files.mjs
index 54c01c2be..b1282ffbd 100644
--- a/sdk/typescript/scripts/package-dist-files.mjs
+++ b/sdk/typescript/scripts/package-dist-files.mjs
@@ -31,6 +31,7 @@ const distModules = [
"reader-selection",
"scanner-import",
"inspector-findings",
+ "continuum-findings",
"snyk-findings",
"scanner-repository-url",
"semgrep-findings",
diff --git a/sdk/typescript/src/continuum-findings.ts b/sdk/typescript/src/continuum-findings.ts
new file mode 100644
index 000000000..2c9839943
--- /dev/null
+++ b/sdk/typescript/src/continuum-findings.ts
@@ -0,0 +1,278 @@
+import { CodexSecurityError } from "./errors.js";
+import type { ExternalFinding, ExternalFindings } from "./external-findings.js";
+import {
+ type ExternalImportTarget,
+ validateExternalEvidence,
+} from "./external-import-contract.js";
+import type { Provider } from "./external-import-models.js";
+import { isRecord } from "./record.js";
+import {
+ array,
+ normalizeRecords,
+ readScannerJson,
+ record,
+ repositoryFilePath,
+ requiredText,
+ strings,
+ text,
+} from "./scanner-import.js";
+import {
+ declaredScannerRepositoryUrl,
+ repositoryScopeValidator,
+} from "./scanner-repository-url.js";
+
+const format = "aws-continuum-code-findings/v1";
+const findingArn =
+ /^(arn:[a-z0-9-]+:continuum:[a-z0-9-]+:\d{12}:environments\/([a-z0-9]+))\/code-findings\/([a-z0-9]+)$/u;
+
+function identity(value: unknown) {
+ const row = record(value, "Continuum finding");
+ const arn = requiredText(row["findingArn"], "Continuum finding ARN");
+ const match = findingArn.exec(arn);
+ if (
+ !match ||
+ row["environmentId"] !== match[2] ||
+ row["findingId"] !== match[3]
+ )
+ throw new Error(
+ "Expected a Continuum finding ARN matching its environmentId and findingId.",
+ );
+ return { arn, scope: match[1]! };
+}
+
+function retainedRepository(
+ provider: Provider,
+ finding: ExternalFinding,
+ target: ExternalImportTarget,
+) {
+ const {
+ source_finding_id: id,
+ evidence: { source_data: data },
+ } = finding;
+ const native = data?.["finding"];
+ const marked = data?.["format"] === format;
+ const nativeArn =
+ isRecord(native) && findingArn.test(text(native["findingArn"]) ?? "");
+ if (provider !== "continuum") {
+ if (
+ marked ||
+ (data?.["sourceRepositoryUrl"] &&
+ nativeArn &&
+ native["findingArn"] === id)
+ )
+ throw new CodexSecurityError(
+ "Retained AWS Continuum evidence requires the continuum provider.",
+ );
+ return;
+ }
+ if (!marked && !nativeArn && !findingArn.test(id)) return;
+ const { arn, scope } = identity(native);
+ if (arn !== id)
+ throw new Error(
+ "Continuum source finding ID does not match the retained finding ARN.",
+ );
+ return {
+ url: declaredScannerRepositoryUrl(
+ data?.["sourceRepositoryUrl"],
+ "Continuum",
+ target,
+ ),
+ scope,
+ };
+}
+
+export const continuumReportRepositories = repositoryScopeValidator(
+ { provider: "continuum", label: "AWS Continuum", scope: "environment" },
+ retainedRepository,
+);
+
+function codeLocations(
+ row: Record<string, unknown>,
+ vulnerabilities: Record<string, unknown>[],
+) {
+ const locations: { path: string; line: number | null }[] = [];
+ const seen = new Set<string>();
+ let endLine: number | null = null;
+ let snippet: string | null = null;
+ function add(
+ value: unknown,
+ start: unknown,
+ end: unknown,
+ fragment: unknown,
+ ) {
+ const path = repositoryFilePath(value);
+ if (!path) return;
+ const line =
+ typeof start === "number" && Number.isSafeInteger(start) && start > 0
+ ? start
+ : null;
+ const key = JSON.stringify([path, line]);
+ if (!seen.has(key)) {
+ seen.add(key);
+ locations.push({ path, line });
+ }
+ // The flat location and first nested location can describe the same range.
+ if (locations[0]!.path === path && locations[0]!.line === line) {
+ if (
+ line !== null &&
+ typeof end === "number" &&
+ Number.isSafeInteger(end) &&
+ end >= line
+ )
+ endLine ??= end;
+ snippet ??= text(fragment);
+ }
+ }
+ add(
+ row["filePath"],
+ row["lineNumber"],
+ row["endLine"],
+ row["vulnerableCode"],
+ );
+ for (const vulnerability of vulnerabilities) {
+ for (const value of array(
+ vulnerability["locations"] ?? [],
+ "Continuum vulnerability locations",
+ )) {
+ const location = record(value, "Continuum vulnerability location");
+ add(
+ location["filePath"],
+ location["startLine"],
+ location["endLine"],
+ vulnerability["code"],
+ );
+ }
+ }
+ return { locations, code: { end_line: endLine, snippet } };
+}
+
+export function normalizeContinuumFindings(
+ input: unknown,
+ sourceRepositoryUrl: string,
+ target: ExternalImportTarget = "cloud",
+): ExternalFindings {
+ const repository = declaredScannerRepositoryUrl(
+ sourceRepositoryUrl,
+ "Continuum",
+ target,
+ );
+ const document = record(input, "Continuum report");
+ if (
+ Object.hasOwn(document, "nextToken") ||
+ Object.hasOwn(document, "NextToken")
+ )
+ throw new Error(
+ "Continuum export has a continuation token; supply the complete paginated CLI output.",
+ );
+ if (!("items" in document || "findingArn" in document))
+ throw new Error(
+ "Expected a Continuum ListCodeFindings or GetCodeFinding response.",
+ );
+ const summary = "items" in document;
+ const rows = summary
+ ? array(document["items"], "Continuum items")
+ : [document];
+ const scopes = new Set<string>();
+ const output = normalizeRecords(
+ rows,
+ (value) => {
+ const row = record(value, "Continuum finding");
+ if (
+ row["type"] !== "CONTINUUM_CODE_VULN" &&
+ row["type"] !== "CUSTOMER_CODE_VULN"
+ )
+ throw new Error(
+ "Expected a Continuum code vulnerability finding type.",
+ );
+ const severity = requiredText(
+ row["severity"],
+ "Continuum severity",
+ ).toLowerCase();
+ const vulnerabilities = array(
+ row["vulnerabilities"] ?? [],
+ "Continuum vulnerabilities",
+ ).map((item) => record(item, "Continuum vulnerability"));
+ const { locations, code } = codeLocations(row, vulnerabilities);
+ const source = requiredText(row["source"], "Continuum source");
+ const status = requiredText(row["status"], "Continuum status");
+ const validation = record(
+ row["validation"] ?? {},
+ "Continuum validation",
+ );
+ const all = [row, ...vulnerabilities];
+ const advisoryIds = [
+ ...new Set(strings(all.map((item) => item["cveId"]))),
+ ];
+ const packageFinding =
+ advisoryIds.length > 0 ||
+ all.some(
+ (v) =>
+ Array.isArray(v["affectedPackages"]) &&
+ v["affectedPackages"].length > 0,
+ );
+ const posture =
+ row["ocsfClass"] === "APPLICATION_SECURITY_POSTURE_FINDING" ||
+ row["posture"] != null;
+ const codeFinding =
+ !summary &&
+ !posture &&
+ !packageFinding &&
+ (code.snippet !== null ||
+ locations.some((location) => location.line !== null));
+ return validateExternalEvidence(
+ {
+ title: requiredText(row["title"], "Continuum title"),
+ severity:
+ severity === "fatal"
+ ? "critical"
+ : severity === "other"
+ ? "unknown"
+ : severity,
+ description: text(row["detailedDescription"]) ?? text(row["summary"]),
+ locations,
+ advisory_ids: advisoryIds,
+ source_scan_id: text(row["scanRunId"]),
+ ...(codeFinding && {
+ details: {
+ kind: "sast",
+ repository: { url: repository },
+ scanner_origin: source,
+ scanner_verdict: text(validation["verdict"]),
+ source_status: status,
+ weakness_ids: strings(row["cweIds"]),
+ remediation_instructions: text(row["mitigation"]),
+ code,
+ },
+ }),
+ source_data: {
+ format,
+ sourceRepositoryUrl: repository,
+ finding: structuredClone(row),
+ },
+ },
+ target,
+ );
+ },
+ (value) => {
+ const { arn, scope } = identity(value);
+ scopes.add(scope);
+ return arn;
+ },
+ target,
+ );
+ if (scopes.size > 1)
+ throw new Error("Continuum findings must belong to the same environment.");
+ return output;
+}
+
+export async function readContinuumFindings(
+ path: string,
+ sourceRepositoryUrl: string,
+ target: ExternalImportTarget = "cloud",
+): Promise<ExternalFindings> {
+ return normalizeContinuumFindings(
+ await readScannerJson(path),
+ sourceRepositoryUrl,
+ target,
+ );
+}
diff --git a/sdk/typescript/src/external-findings-local.ts b/sdk/typescript/src/external-findings-local.ts
index 6c3bcf750..d99f79291 100644
--- a/sdk/typescript/src/external-findings-local.ts
+++ b/sdk/typescript/src/external-findings-local.ts
@@ -37,6 +37,7 @@ import {
isGitSsh,
parseGitRemote,
} from "./git-remote.js";
+import { continuumReportRepositories } from "./continuum-findings.js";
import { veracodeReportRepositories } from "./veracode-findings.js";
import { inspectorReportRepository } from "./inspector-findings.js";
import { declaredScannerRepositoryUrl } from "./scanner-repository-url.js";
@@ -526,6 +527,7 @@ async function requireMatchingRepository(
));
const boundProvider =
provider === "sonar" ||
+ provider === "continuum" ||
provider === "inspector" ||
provider === "blackduck" ||
provider === "veracode";
@@ -752,13 +754,18 @@ export async function prepareLocalImport(
"local",
sameRepositories,
);
- for (const source of veracodeReportRepositories(
- options.provider,
- current.findings,
- "local",
- sameRepositories,
- ).values()) {
- sources.set(source.url, source);
+ for (const repositories of [
+ veracodeReportRepositories,
+ continuumReportRepositories,
+ ]) {
+ for (const source of repositories(
+ options.provider,
+ current.findings,
+ "local",
+ sameRepositories,
+ ).values()) {
+ sources.set(source.url, source);
+ }
}
const strictSources = new Map<string, Provider>();
const known = new Set<string>(parsedSources.map(({ url }) => url));
diff --git a/sdk/typescript/src/external-findings-publish.ts b/sdk/typescript/src/external-findings-publish.ts
index c695b1ca9..849f14ab2 100644
--- a/sdk/typescript/src/external-findings-publish.ts
+++ b/sdk/typescript/src/external-findings-publish.ts
@@ -55,6 +55,7 @@ import {
blackDuckReportRepositories,
projectedBlackDuckRepositoryUrl,
} from "./blackduck-findings.js";
+import { continuumReportRepositories } from "./continuum-findings.js";
import { veracodeReportRepositories } from "./veracode-findings.js";
import { inspectorReportRepository } from "./inspector-findings.js";
import { sonarRepositoryUrls } from "./sonar-findings.js";
@@ -1757,8 +1758,12 @@ async function preparePublicationInput(
const repositories = replay
? undefined
: blackDuckReportRepositories(options.provider, findings, "cloud");
- if (!saved || options.provider === "veracode") {
- for (const [id, source] of veracodeReportRepositories(
+ for (const [provider, repositories] of [
+ ["veracode", veracodeReportRepositories],
+ ["continuum", continuumReportRepositories],
+ ] as const) {
+ if (saved && options.provider !== provider) continue;
+ for (const [id, source] of repositories(
options.provider,
findings,
"cloud",
@@ -1788,6 +1793,7 @@ async function preparePublicationInput(
!projected &&
options.provider !== "inspector" &&
options.provider !== "veracode" &&
+ options.provider !== "continuum" &&
options.provider !== "sonar"
)
continue;
diff --git a/sdk/typescript/src/external-findings-read.ts b/sdk/typescript/src/external-findings-read.ts
index 803a16d48..46e0ce102 100644
--- a/sdk/typescript/src/external-findings-read.ts
+++ b/sdk/typescript/src/external-findings-read.ts
@@ -15,6 +15,7 @@ import { readGitHubFindings } from "./github-findings.js";
import { readSonarFindings } from "./sonar-findings.js";
import { readVeracodeFindings } from "./veracode-findings.js";
import { readBlackDuckFindings } from "./blackduck-findings.js";
+import { readContinuumFindings } from "./continuum-findings.js";
import { readInspectorFindings } from "./inspector-findings.js";
import { isRecord } from "./record.js";
import {
@@ -36,6 +37,7 @@ export const EXTERNAL_FINDINGS_PROVIDERS = {
blackduck: "blackduck",
veracode: "veracode",
sonar: "sonar",
+ continuum: "continuum",
} as const satisfies Record<string, Provider>;
export type ExternalFindingsReader = keyof typeof EXTERNAL_FINDINGS_PROVIDERS;
@@ -150,12 +152,14 @@ export async function readExternalFindings(
return { findings: await readGitHubFindings(path, target) };
if (
options.provider === "inspector" ||
+ options.provider === "continuum" ||
options.provider === "blackduck" ||
options.provider === "veracode"
) {
const url = options.sourceRepositoryUrl ?? "";
const read = {
inspector: readInspectorFindings,
+ continuum: readContinuumFindings,
blackduck: readBlackDuckFindings,
veracode: readVeracodeFindings,
}[options.provider];
diff --git a/sdk/typescript/src/external-import-models.ts b/sdk/typescript/src/external-import-models.ts
index 857da64d8..c2c0d7be4 100644
--- a/sdk/typescript/src/external-import-models.ts
+++ b/sdk/typescript/src/external-import-models.ts
@@ -14,7 +14,8 @@ export type Provider =
| "inspector"
| "blackduck"
| "veracode"
- | "sonar";
+ | "sonar"
+ | "continuum";
export type SourceKey = string;
export type ClientId = string;
export type SourceFindingId = string;
diff --git a/sdk/typescript/src/index.ts b/sdk/typescript/src/index.ts
index dd034cd03..5f1ea4c34 100644
--- a/sdk/typescript/src/index.ts
+++ b/sdk/typescript/src/index.ts
@@ -345,6 +345,10 @@ export {
normalizeBlackDuckFindings,
readBlackDuckFindings,
} from "./blackduck-findings.js";
+export {
+ normalizeContinuumFindings,
+ readContinuumFindings,
+} from "./continuum-findings.js";
export {
normalizeInspectorFindings,
readInspectorFindings,
diff --git a/sdk/typescript/src/scanner-repository-url.ts b/sdk/typescript/src/scanner-repository-url.ts
index eb348109c..5ab68791f 100644
--- a/sdk/typescript/src/scanner-repository-url.ts
+++ b/sdk/typescript/src/scanner-repository-url.ts
@@ -49,7 +49,7 @@ export function declaredScannerRepositoryUrl(
return source;
}
-/** A native application or project version maps to one source repository per report. */
+/** Check the repository declared for each retained native scope. */
export function repositoryScopeValidator(
scanner: { provider: Provider; label: string; scope: string },
retainedRepository: (
@@ -79,7 +79,7 @@ export function repositoryScopeValidator(
const { source_finding_id: id, evidence } = finding;
const retained = retainedRepository(provider, finding, target);
const declared = evidence.details?.repository?.url;
- // A Black Duck BOM binds its entire report. A Veracode application binds its native rows.
+ // A Black Duck BOM binds its entire report. Other scopes bind their native rows.
if (wholeReport || retained?.scope) {
if (declared) sources.add(declared);
if (retained) sources.add(retained.url);
diff --git a/sdk/typescript/tests-ts/continuum-findings.test.ts b/sdk/typescript/tests-ts/continuum-findings.test.ts
new file mode 100644
index 000000000..06814b60e
--- /dev/null
+++ b/sdk/typescript/tests-ts/continuum-findings.test.ts
@@ -0,0 +1,163 @@
+import { expect, test } from "bun:test";
+import { writeFile } from "node:fs/promises";
+import { gzipSync } from "node:zlib";
+import { prepareNormalizedLocalImport } from "../src/external-findings-local.js";
+import { normalizeContinuumFindings } from "../src/continuum-findings.js";
+import {
+ createAndReplayFinding,
+ localReportFixture,
+ updateStoredFinding,
+} from "./external-findings-local-helpers.js";
+import {
+ continuumDetail,
+ continuumRepository,
+ continuumSummary,
+} from "./support/continuum-import-fixtures.js";
+
+const normalize = (input: unknown) =>
+ normalizeContinuumFindings(input, continuumRepository);
+
+test("a Continuum list and a detailed finding share the AWS occurrence ARN", () => {
+ const first = continuumSummary();
+ const second = continuumSummary("two");
+ const list = normalize({ items: [first, second] });
+ expect(list.excluded).toEqual([]);
+ expect(
+ list.findings.map(({ source_finding_id }) => source_finding_id),
+ ).toEqual([first.findingArn, second.findingArn]);
+ expect(list.findings[0]!.evidence).toMatchObject({
+ title: first.title,
+ severity: "critical",
+ locations: [{ path: first.filePath, line: null }],
+ source_data: { sourceRepositoryUrl: continuumRepository, finding: first },
+ });
+
+ expect(list.findings[0]!.evidence.details).toBeUndefined();
+
+ const detail = continuumDetail();
+ expect(normalize(detail)).toMatchObject({
+ read: 1,
+ excluded: [],
+ findings: [
+ {
+ source_finding_id: first.findingArn,
+ evidence: {
+ severity: "critical",
+ description: detail.detailedDescription,
+ locations: [
+ { path: first.filePath, line: 3 },
+ { path: "src/other.ts", line: 12 },
+ ],
+ details: {
+ repository: { url: continuumRepository },
+ source_status: "CONFIRMED",
+ scanner_verdict: "TRUE_POSITIVE",
+ weakness_ids: ["CWE-20"],
+ remediation_instructions: detail.mitigation,
+ code: { end_line: 5, snippet: detail.vulnerableCode },
+ },
+ source_data: { finding: detail },
+ },
+ },
+ ],
+ });
+});
+
+test("preserves dependency and posture evidence without classifying it as a code flaw", () => {
+ const summary = continuumSummary();
+ const dependency = {
+ ...summary,
+ ocsfClass: "VULNERABILITY_FINDING",
+ cveId: "CVE-2099-0001",
+ affectedPackages: [
+ { name: "example", version: "1.0.0", fixedInVersion: "1.0.1" },
+ ],
+ };
+ const posture = {
+ ...summary,
+ ocsfClass: "APPLICATION_SECURITY_POSTURE_FINDING",
+ posture: { status: "Failed", control: "Example control" },
+ };
+ for (const finding of [dependency, posture]) {
+ const result = normalize(finding);
+ expect(result.excluded).toEqual([]);
+ const evidence = result.findings[0]!.evidence;
+ expect(evidence.details).toBeUndefined();
+ expect(evidence.source_data?.["finding"]).toEqual(finding);
+ }
+ expect(normalize(dependency).findings[0]!.evidence.advisory_ids).toEqual([
+ dependency.cveId,
+ ]);
+});
+
+test("unsafe paths stay in native evidence without becoming checkout locations", () => {
+ const detail = {
+ ...continuumDetail(),
+ filePath: "../other/src/example.ts",
+ vulnerabilities: [
+ { locations: [{ filePath: "C:\\other\\example.ts", startLine: 2 }] },
+ ],
+ };
+ expect(normalize(detail)).toMatchObject({
+ excluded: [],
+ findings: [
+ { evidence: { locations: [], source_data: { finding: detail } } },
+ ],
+ });
+});
+
+test("distinguishes an empty export from incomplete, mixed-environment and malformed reports", () => {
+ expect(normalize({ items: [] })).toMatchObject({
+ read: 0,
+ findings: [],
+ excluded: [],
+ });
+ for (const report of [
+ { items: [continuumSummary()], nextToken: "page2" },
+ { items: [continuumSummary()], NextToken: "page2" },
+ { items: [continuumSummary(), continuumSummary("two", "other")] },
+ { findings: [] },
+ ])
+ expect(() => normalize(report)).toThrow();
+
+ const malformed = { ...continuumSummary("two"), environmentId: "wrong" };
+ const result = normalize({ items: [continuumSummary(), malformed] });
+ expect(result.findings).toHaveLength(1);
+ expect(result.excluded).toMatchObject([{ position: 2 }]);
+});
+
+test("local replay enriches one unassessed occurrence when the detailed record arrives", async () => {
+ const options = {
+ provider: "continuum" as const,
+ sourceKey: "continuum/example/project",
+ sourceRepositoryUrl: continuumRepository,
+ };
+ const fixture = await localReportFixture("findings.json", options, {
+ remote: continuumRepository,
+ });
+ try {
+ await fixture.writeJson({ items: [continuumSummary()] });
+ const previous = await createAndReplayFinding(fixture);
+ await writeFile(fixture.file, gzipSync(JSON.stringify(continuumDetail())));
+ const updated = await updateStoredFinding(fixture, previous);
+ const normalized = normalize(continuumDetail());
+ normalized.findings[0]!.evidence.details!.repository!.url =
+ "https://github.com/example/other";
+ await expect(
+ prepareNormalizedLocalImport(
+ normalized,
+ { ...options, repository: fixture.repository },
+ { environment: fixture.environment },
+ ),
+ ).rejects.toThrow(/repository|remote/i);
+ expect(updated.provider).toBe("continuum");
+ expect(updated.evidence.details?.scanner_verdict).toBe("TRUE_POSITIVE");
+ await expect(
+ fixture.prepare({
+ sourceRepositoryUrl: "https://github.com/example/other",
+ }),
+ ).rejects.toThrow(/repository|remote/i);
+ } finally {
+ await fixture.dispose();
+ }
+});
diff --git a/sdk/typescript/tests-ts/external-findings-publish.test.ts b/sdk/typescript/tests-ts/external-findings-publish.test.ts
index ecf21f9d6..71904ee1c 100644
--- a/sdk/typescript/tests-ts/external-findings-publish.test.ts
+++ b/sdk/typescript/tests-ts/external-findings-publish.test.ts
@@ -90,6 +90,10 @@ import {
inspectorPackageFinding,
inspectorRepositoryUrl,
} from "./support/inspector-import-fixtures.js";
+import {
+ continuumDetail,
+ continuumRepository,
+} from "./support/continuum-import-fixtures.js";
import { normalizeBlackDuckFindings } from "../src/blackduck-findings.js";
import { normalizeVeracodeFindings } from "../src/veracode-findings.js";
import {
@@ -1491,6 +1495,52 @@ async function inspectorPublicationFixture(name = inspectorRepositoryUrl) {
return { f, input, project, map, prepare, loseResponse };
}
+test("Continuum Cloud publication checks repository and provider and replays an interrupted request", async () => {
+ const detail = continuumDetail();
+ const f = await fixture(detail, continuumRepository);
+ const selected = {
+ ...options,
+ provider: "continuum" as const,
+ sourceKey: "continuum/example/project",
+ sourceRepositoryUrl: continuumRepository,
+ };
+ const prepare = () => prepareExternalPublication(f.file, selected, f.deps);
+ const first = await prepare();
+ expect(first.preview.requests[0]).toMatchObject({
+ source: { provider: "continuum", source_key: selected.sourceKey },
+ items: [
+ {
+ source_finding_id: detail.findingArn,
+ evidence: { source_data: { finding: detail } },
+ },
+ ],
+ });
+ await expect(
+ prepareNormalizedExternalPublication(
+ first.preview,
+ { ...selected, provider: "wiz" },
+ f.deps,
+ ),
+ ).rejects.toThrow(/continuum provider/i);
+ const relabeled = structuredClone(first.preview);
+ relabeled.findings[0]!.source_finding_id = "another-id";
+ await expect(
+ prepareNormalizedExternalPublication(relabeled, selected, f.deps),
+ ).rejects.toThrow(/source finding ID|occurrence|ARN/i);
+
+ f.state.repositoryUrl = "https://github.com/example/other";
+ await expect(prepare()).rejects.toThrow(/does not match/i);
+ expect(f.posts).toHaveLength(0);
+ f.state.repositoryUrl = continuumRepository;
+
+ f.state.loseResponse = true;
+ await expect(first.publish()).rejects.toThrow("resume the saved request");
+ const retry = await prepare();
+ expect(retry.preview.resumed).toBe(true);
+ expect((await retry.publish()).verified).toBe(1);
+ expect(f.posts).toEqual([f.posts[0]!, f.posts[0]!]);
+});
+
test("Inspector publication checks its source and reuses the finding ARN", async () => {
const { f, input, prepare } = await inspectorPublicationFixture();
const prepared = await prepare();
diff --git a/sdk/typescript/tests-ts/support/continuum-import-fixtures.ts b/sdk/typescript/tests-ts/support/continuum-import-fixtures.ts
new file mode 100644
index 000000000..a4f184507
--- /dev/null
+++ b/sdk/typescript/tests-ts/support/continuum-import-fixtures.ts
@@ -0,0 +1,48 @@
+export const continuumRepository = "https://github.com/example/project";
+
+export function continuumSummary(findingId = "one", environmentId = "example") {
+ return {
+ findingArn: `arn:aws:continuum:us-east-1:000000000000:environments/${environmentId}/code-findings/${findingId}`,
+ findingId,
+ environmentId,
+ source: "example-scanner",
+ sourceFindingId: "upstream-example",
+ type: "CUSTOMER_CODE_VULN",
+ reportedAt: "2026-01-02T00:00:00Z",
+ createdAt: "2026-01-02T00:01:00Z",
+ statusUpdatedAt: "2026-01-02T00:01:00Z",
+ status: "SUBMITTED",
+ severity: "FATAL",
+ title: "Example code finding",
+ filePath: "src/example.ts",
+ };
+}
+
+export function continuumDetail() {
+ const summary = continuumSummary();
+ return {
+ ...summary,
+ status: "CONFIRMED",
+ statusUpdatedAt: "2026-01-02T00:02:00Z",
+ detailedDescription: "Example description",
+ mitigation: "Use the checked example.",
+ cweIds: ["CWE-20"],
+ lineNumber: 3,
+ endLine: 5,
+ vulnerableCode: "readExample(input)",
+ vulnerabilities: [
+ {
+ locations: [
+ { filePath: summary.filePath, startLine: 3, endLine: 5 },
+ { filePath: "src/other.ts", startLine: 12, endLine: 12 },
+ ],
+ },
+ ],
+ validation: {
+ verdict: "TRUE_POSITIVE",
+ evidence: [
+ { file: summary.filePath, line: 3, snippet: "readExample(input)" },
+ ],
+ },
+ };
+}