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(imports): enable external scanner imports by default (#2360)

Michael D'Angelo0ed54be43aab
diff --git a/README.md b/README.md
index 299487e78..9db99f98a 100644
--- a/README.md
+++ b/README.md
@@ -16,8 +16,8 @@ Use its security workflows in Codex, or automate them with the
- Draft `SECURITY.md` policies and save threat models for later review.
- Browse saved scans and findings, identify duplicates, assess severity against
your own rubric, and suggest owners from source and Git history.
-- Import Semgrep, Snyk, and Wiz findings locally or publish them to Codex Security Cloud. [All scanner import guides](docs/scanner-imports/README.md).
-- Export SARIF, JSON, or CSV, and publish findings to Linear or a findings service.
+- Preview third-party scanner findings, save them locally, or publish supported reports to Codex Security Cloud. [Scanner import guides](docs/scanner-imports/README.md).
+- Track findings in Linear, Jira, or GitHub, publish completed scans, or export SARIF, JSON, and CSV. [Integration workflows](docs/plugin-connectors.md).
- Automate scans across repositories or project components, including in CI and
containers.
diff --git a/compose.runner.yaml b/compose.runner.yaml
index ed0ec4afc..a22eed985 100644
--- a/compose.runner.yaml
+++ b/compose.runner.yaml
@@ -11,7 +11,6 @@ services:
environment:
CODEX_API_KEY:
CODEX_SECURITY_EMBEDDINGS_URL:
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS:
CODEX_SECURITY_GIT_HOST:
GH_TOKEN:
GITHUB_TOKEN:
diff --git a/compose.yaml b/compose.yaml
index f6445d6b7..08c843e5f 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -13,7 +13,6 @@ services:
environment:
CODEX_API_KEY:
CODEX_SECURITY_EMBEDDINGS_URL:
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS:
CODEX_SECURITY_GIT_HOST:
GH_TOKEN:
GITHUB_TOKEN:
diff --git a/docker/verify-container-compose.sh b/docker/verify-container-compose.sh
index 5d271451f..299721bc4 100644
--- a/docker/verify-container-compose.sh
+++ b/docker/verify-container-compose.sh
@@ -12,20 +12,20 @@ jq -e '
# Resolve the environment on the host; these checks need no running container.
for compose_file in compose.yaml compose.runner.yaml; do
endpoint="https://embeddings.example.com/custom/v1/embeddings?api-version=synthetic"
- CODEX_SECURITY_EMBEDDINGS_URL="$endpoint" CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1 \
+ CODEX_SECURITY_EMBEDDINGS_URL="$endpoint" \
docker compose --env-file /dev/null -f "$compose_file" config --format json |
jq --exit-status --arg endpoint "$endpoint" \
- '.services["codex-security"].environment | .CODEX_SECURITY_EMBEDDINGS_URL == $endpoint and .CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS == "1"' > /dev/null
+ '.services["codex-security"].environment | .CODEX_SECURITY_EMBEDDINGS_URL == $endpoint' > /dev/null
- env -u CODEX_SECURITY_EMBEDDINGS_URL -u CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS \
+ env -u CODEX_SECURITY_EMBEDDINGS_URL \
docker compose --env-file /dev/null -f "$compose_file" config --format json |
jq --exit-status \
- '.services["codex-security"].environment | .CODEX_SECURITY_EMBEDDINGS_URL == null and .CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS == null' > /dev/null
+ '.services["codex-security"].environment | .CODEX_SECURITY_EMBEDDINGS_URL == null' > /dev/null
- CODEX_SECURITY_EMBEDDINGS_URL="" CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS="" \
+ CODEX_SECURITY_EMBEDDINGS_URL="" \
docker compose --env-file /dev/null -f "$compose_file" config --format json |
jq --exit-status \
- '.services["codex-security"].environment | .CODEX_SECURITY_EMBEDDINGS_URL == "" and .CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS == ""' > /dev/null
+ '.services["codex-security"].environment | .CODEX_SECURITY_EMBEDDINGS_URL == ""' > /dev/null
done
mkdir -p results state
diff --git a/docs/agent-workflows.md b/docs/agent-workflows.md
index 892132a9e..f6210f2fd 100644
--- a/docs/agent-workflows.md
+++ b/docs/agent-workflows.md
@@ -40,10 +40,10 @@ Codex plugin session.
| Track a validated finding | Give [`$track-findings`](../plugins/codex-security/skills/track-findings/SKILL.md) the finding and destination. See [plugin connectors](plugin-connectors.md). | For completed scans, see [publishing to Linear](../sdk/typescript/docs/cli.md#publish-completed-scans-to-linear). |
| Inspect a downloaded skill | [Review the skill before installation](#review-a-skill-before-installation) in a trusted Codex chat. | Use the interactive Codex CLI with the plugin enabled. |
-**Read a saved dependency alert.** With `CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1`,
-run `cs findings imported ./project --format json` to list the repository's
-imported records. Give the relevant record to `$resolve-dependency-alert` when
-you want Codex to check the installed versions and upgrade options.
+**Read a saved dependency alert.** Run `cs findings imported ./project --format json`
+to list the records saved for that checkout. Give the relevant record to
+`$resolve-dependency-alert` to check installed versions and upgrade options.
+To bring in an alert from your scanner, use the [scanner import guides](scanner-imports/README.md).
A scan or triage request produces findings. Ask to fix a specific finding when
you want a patch. A separate fix verification reports `fixed`,
@@ -133,8 +133,9 @@ cs scan --schema --format json
cs scan --help
```
-Use [the CLI reference](../sdk/typescript/docs/cli.md#command-discovery-and-integrations)
-for integrations and output formats.
+Choose a [connected app or CLI integration](plugin-connectors.md) for your
+destination. See the [CLI reference](../sdk/typescript/docs/cli.md#command-discovery-and-integrations)
+for command discovery and output formats.
## Troubleshoot setup
diff --git a/docs/plugin-connectors.md b/docs/plugin-connectors.md
index 644aebd46..69b6ae10c 100644
--- a/docs/plugin-connectors.md
+++ b/docs/plugin-connectors.md
@@ -1,58 +1,70 @@
-# Plugin connectors
+# Codex Security integrations
-Connect an app when you want Codex Security to read findings from a service
-or track them in an issue. Local repository scans work without these apps.
+Use a connected app in Codex to investigate a finding or track it in an issue.
+The [CLI integrations](#cli-integrations) cover importing scanner reports,
+publishing completed scans, and exporting files for other systems.
-| App | Use it to | Setup |
-| -------------------- | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------- |
-| Codex Security Cloud | Read findings, evidence, reports, and scan status in your workspace. | [Connect Cloud in Codex](../sdk/typescript/README.md#read-existing-cloud-findings) |
-| Linear | Read tickets and track findings in a team or project. | [Connect Linear](#linear-setup) |
-| GitHub | Read alerts and repository source, track issues, or draft a security advisory. | [Connect GitHub](#github-setup) |
-| Atlassian | Read Jira Cloud tickets and track findings in a project. | [Connect Jira](#jira-setup) |
+## Plugin connectors
-## Linear setup
+Connect the app you need in the account and workspace that hold the data.
+Local scans and saved-report imports work without an app connection.
-Connect **Linear** in the Codex app directory with the account that can access
-your team. Give Codex a ticket URL to triage, or name the team and optional
-project where you want to track a finding. To use an existing Linear MCP
-connection for reads, specify the account and workspace.
-See [ticket intake](../plugins/codex-security/skills/triage-finding/references/ticket-intake.md#retrieval).
+| App | What you can do in Codex | Setup |
+| -------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
+| Codex Security Cloud | Read saved findings, their evidence, and scan status. | [Connect Cloud in Codex](../sdk/typescript/README.md#read-existing-cloud-findings) |
+| Linear | Read tickets for triage and track findings in a team or project. | [Linear setup](#linear-setup) |
+| GitHub | Read repository source and alerts, and track findings in issues. | [GitHub setup](#github-setup) |
+| Atlassian | Read Jira Cloud issues and track findings in a project. | [Jira setup](#jira-setup) |
-## GitHub setup
+### Linear setup
-Connect **GitHub** in the app directory with access to the repository and the
-type of alert you want to read. Give Codex the repository and an issue or alert
-URL. To use an existing GitHub CLI login for triage, specify the host and
-account. See [GitHub intake](../plugins/codex-security/skills/triage-finding/references/github-rest-intake.md).
-When tracking a finding, specify whether it belongs in an issue or a
-[draft security advisory](../plugins/codex-security/skills/track-findings/references/github-security-advisories.md).
+Connect **Linear** in the Codex app directory. To triage a ticket, give
+Codex its URL or identifier and the workspace. To track a finding, name the
+destination team and optional project. If you want to use an existing Linear
+MCP connection for reads, specify the connection and workspace. [Ticket intake](../plugins/codex-security/skills/triage-finding/references/ticket-intake.md#retrieval)
-## Jira setup
+### GitHub setup
-Connect **Atlassian** in the Codex app directory and authorize the account and
-site that contain your Jira project. If you already use Atlassian Rovo (Legacy), authorize
-the Atlassian app separately. Give Codex an issue key and site, or a Jira Query
-Language (JQL) query to select the tickets to read.
-See [Jira ticket intake](../plugins/codex-security/skills/triage-finding/references/ticket-intake.md#retrieval)
-for using an already signed-in Jira CLI.
+Connect **GitHub** with access to the source repository and the issue or
+alert you want to read. Give Codex its URL. For triage with an existing
+GitHub CLI login, specify the host and account. [GitHub intake](../plugins/codex-security/skills/triage-finding/references/github-rest-intake.md)
+
+To draft a repository security advisory, select the GitHub CLI (`gh`) account.
+The advisory workflow requires one validated finding from a sealed Git revision
+and admin access to its public, non-fork source repository on GitHub.com.
+[Draft advisory workflow](../plugins/codex-security/skills/track-findings/references/github-security-advisories.md)
+
+### Jira setup
+
+Connect **Atlassian** to the Jira Cloud site that holds the project.
+Give Codex the site and issue key for a single issue, or a Jira Query
+Language (JQL) query for a collection. To read through an already
+authenticated Atlassian CLI instead, specify the site and account.
+[Jira ticket intake](../plugins/codex-security/skills/triage-finding/references/ticket-intake.md#retrieval)
## Track a finding
-Give Codex the saved scan directory, the finding ID, and the destination. Ask
-it to check for an existing issue. The account needs read and search access to
-check for duplicates. To create or update an issue, it also needs write access.
-Review the destination, audience, and proposed changes before approving a write.
-If Codex cannot find a ticket you can see, check the signed-in account and the
-selected site, workspace, or repository.
-
-When the plugin and CLI use the same local state directory, both can find issue
-links saved by earlier tracking or publication runs. Codex checks a saved link
-against the tracker before reusing it and searches the destination for other
-matches. You can also track findings from a sealed scan bundle copied from
-another machine. Codex saves new issue associations outside the bundle, even
-if an issue was created but its follow-up read failed. On retry, check that
-issue before approving another write.
-See the [tracking workflow](../plugins/codex-security/skills/track-findings/SKILL.md).
-
-To import a scanner report instead, use the [scanner import guides](scanner-imports/README.md)
-to choose the input format, preview the records, and select a destination.
+Give Codex the sealed scan directory, the finding ID, and the destination.
+The tracking workflow checks saved links and searches the destination for
+duplicates before proposing a write. Review the issue content and audience.
+The account needs search and read access for duplicate checks, plus the
+appropriate create or edit permission for the proposed change.
+[Tracking workflow](../plugins/codex-security/skills/track-findings/SKILL.md)
+
+Issue links are stored outside the sealed scan bundle. If a tracker accepts
+a write but its follow-up read fails, use the returned issue ID to check the
+outcome before retrying. The plugin and CLI share local issue history when
+they use the same state directory. For CLI publication to Linear,
+`--skip-existing` consults that history. [Linear publication](../sdk/typescript/docs/cli.md#publish-completed-scans-to-linear)
+
+## CLI integrations
+
+Use the `codex-security` CLI for these workflows.
+
+| Input | Destination | Workflow |
+| ---------------------------------------------------------------- | ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| A saved third-party scanner report | Local workbench, or Cloud for supported reports | Use `publish findings` with the options in your [scanner guide](scanner-imports/README.md). Add `--to local --dry-run` for an offline preview. |
+| A completed Codex Security scan or a Codex Security findings CSV | Codex Security Cloud | Preview offline with `publish scan --to cloud --dry-run`. Upload uses file-backed ChatGPT credentials. [Cloud publication](../sdk/typescript/docs/cli.md#publish-completed-scans) |
+| A completed scan | Linear | Use `publish scan --to linear` with a destination team. Authenticate through the connected app or a Linear API key. [Linear publication](../sdk/typescript/docs/cli.md#publish-completed-scans-to-linear) |
+| A completed scan | A findings service you operate | Use `publish scan --to custom` with a compatible service's base URL. [Endpoint contract and dry run](../sdk/typescript/docs/findings-service.md#publish-a-scan) |
+| Findings from a completed scan | ServiceNow or a CI system | Export a [ServiceNow AVIT CSV](../sdk/typescript/docs/cli.md#export-findings-for-servicenow) for manual upload or [SARIF for CI](../sdk/typescript/docs/cli.md#use-exports-in-ci). |
diff --git a/docs/scanner-imports/README.md b/docs/scanner-imports/README.md
index d41374d03..dec4817d7 100644
--- a/docs/scanner-imports/README.md
+++ b/docs/scanner-imports/README.md
@@ -1,21 +1,39 @@
# Import external scanner findings
-Preview a scanner report before saving its findings locally or sending them
-to Codex Security Cloud.
+Preview a scanner report with the CLI, then save the findings in the local
+workbench or send a supported report to Codex Security Cloud.
-## Preview a report
+## Choose your scanner
-[Install the CLI](../../README.md#quick-start), then enable imports in the shell
-where you run it or start Codex.
+The `--provider` value selects the reader for a saved report. To see which
+readers your installed CLI supports, run `codex-security publish findings --help`.
+The guides cover local and Cloud imports unless an input is marked local only.
+
+| Guide | `--provider` | Supported input |
+| ----------------------------------------------------------- | ------------ | ----------------------------------------------------------------------------------------------- |
+| [Amazon Inspector](inspector.md) | `inspector` | Inspector2 `ListFindings` JSON for one Code Security repository |
+| [AWS Continuum](continuum.md) | `continuum` | Summaries or selected code finding details for one verified repository |
+| [Black Duck SCA](blackduck.md) | `blackduck` | BOM-6 vulnerable components for one project version |
+| [Checkmarx SAST](checkmarx.md) | `checkmarx` | Checkmarx One CLI JSON or self-managed CxSAST XML for one scan |
+| [Endor Labs](endor.md) | `endor` | Native Finding JSON, or self-contained `endorctl` SARIF with finding UUIDs |
+| [GitHub code scanning](github-code-scanning.md) | `github` | Alerts selected for one repository and Git ref |
+| [GitHub Dependabot](github-dependabot.md) | `github` | Dependency alerts exported from one repository |
+| [GitHub Security Advisories](github-security-advisories.md) | `github` | Selected repository or global advisories |
+| [OpenGrep](opengrep.md) | `opengrep` | Native scan JSON, optionally gzip-compressed |
+| [Semgrep](semgrep.md) | `semgrep` | CLI/CI JSON, SARIF, or Platform Web API reports. Guardian selections support local import only. |
+| [Snyk](snyk.md) | `snyk` | CLI JSON, plugin exports, SARIF, or monitored Code and Open Source issues |
+| [SonarQube Cloud](sonar.md) | `sonar` | Issues selected with the signed-in Sonar CLI, or saved issue-search pages |
+| [Tenable One](tenable.md) | `tenable` | Selected Code Repository inventory findings (local only) |
+| [Trivy](trivy.md) | `trivy` | Native schema-v2 repository or filesystem JSON, optionally gzip-compressed |
+| [Veracode Static Analysis](veracode.md) | `veracode` | Findings API pages for one application's policy flaws |
+| [Wiz](wiz.md) | `wiz` | Native JSON, normalized JSONL, or detailed repository package vulnerability CSV |
-```sh
-export CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1
-```
+## Preview a report
-In PowerShell, use `$env:CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS = '1'`.
-Keep reports and preview output in a private directory outside the checkout.
-For commands that use `mktemp`, set `TMPDIR` there if needed. In CI, redirect
-both stdout and stderr to private files.
+[Install the CLI](../../README.md#quick-start) and open the repository the
+findings apply to. Keep reports and preview output in a private directory
+outside that checkout. For commands that use `mktemp`, set `TMPDIR` there
+if needed. In CI, redirect stdout and stderr to private files.
**In the terminal**, follow your scanner's guide. Run examples that use
`--repository .` from the checkout root. For a saved report, `publish findings`
@@ -30,31 +48,6 @@ Ask it to preview the report with your configured model.
> Preview `../reports/endor-findings.json` for this checkout. Show me which
> Endor findings the CLI would import and which it would skip. Stop there.
-## Choose your scanner
-
-With imports enabled, run `codex-security publish findings --help` to check the
-providers in your installed CLI. The guides cover local and Cloud imports
-unless an input is marked local only.
-
-| Guide | Supported input |
-| ----------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
-| [Amazon Inspector](inspector.md) | Inspector2 `ListFindings` JSON for one Code Security repository |
-| [AWS Continuum](continuum.md) | Summaries or selected code finding details for one verified repository |
-| [Black Duck SCA](blackduck.md) | BOM component vulnerabilities for one project version |
-| [Checkmarx SAST](checkmarx.md) | Checkmarx One CLI JSON or self-managed CxSAST XML for one scan |
-| [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 |
-| [GitHub Dependabot](github-dependabot.md) | Dependency alerts exported from one repository |
-| [GitHub Security Advisories](github-security-advisories.md) | Selected repository or global advisories |
-| [OpenGrep](opengrep.md) | Native scan JSON, optionally gzip-compressed |
-| [Semgrep](semgrep.md) | CLI/CI JSON, SARIF, Platform Web API reports, or selected Guardian findings (local only) |
-| [Snyk](snyk.md) | CLI JSON, plugin exports, SARIF, or monitored Code and Open Source issues |
-| [SonarQube Cloud](sonar.md) | Issues selected with the signed-in Sonar CLI, or saved issue-search pages |
-| [Tenable One](tenable.md) | Selected Code Repository inventory findings (experimental, local only) |
-| [Trivy](trivy.md) | Native schema-v2 repository or filesystem JSON, optionally gzip-compressed |
-| [Veracode Static Analysis](veracode.md) | Findings API pages for one application's policy flaws |
-| [Wiz](wiz.md) | Native JSON, normalized JSONL, or detailed repository package vulnerability CSV |
-
If you selected specific findings, compare the preview with your selection.
Check for missing, duplicate or unexpected occurrences. For OpenGrep, check
`report.errors` as well as exclusions, even when the findings list is empty.
@@ -67,20 +60,18 @@ from the preview for your destination](sonar.md#import-and-verify).
**Save locally.** Remove `--dry-run` and confirm. In automation, use `--yes`
after reviewing the preview.
-**Send to Cloud.** Semgrep Guardian captures support local import only. For other
-supported files, keep the file, provider, source key and scanner options from
-your preview.
-Set `--to cloud` and pass the connected repository URL or Cloud ID to
-`--repository`. Preview again with `--dry-run`. Check the account, endpoint,
-destination, findings, and exclusions. Remove `--dry-run` and confirm. [Cloud setup](../../sdk/typescript/docs/cli.md#preview-and-publish)
-
-Add `--format json` to see which destination your workspace offers.
-When the preview includes `privateImport`, confirming sends the findings to
-your private inbox with the selected repository and connector. GitHub code scanning,
-Dependabot and advisories use the GitHub provider. OpenGrep uses the Semgrep
-provider. For Amazon Inspector or AWS Continuum, the CLI and workspace must
-support v2 import jobs. For Black Duck, Checkmarx, SonarQube Cloud, Trivy or
-Veracode, they must support v3 to use the private inbox.
+**Send to Cloud.** Tenable One reports and Semgrep Guardian selections support
+local import only. For a Cloud-supported report, keep the file, provider,
+source key, and scanner options from your local preview. Change the destination
+to `--to cloud`, and pass the connected repository URL or Cloud ID to
+`--repository`. Preview again with `--dry-run --format json`. [Cloud setup](../../sdk/typescript/docs/cli.md#preview-and-publish)
+
+Check the account, endpoint, repository, selected findings, and exclusions.
+The preview shows where your workspace will store the evidence. A
+`privateImport` entry identifies your private inbox and the suggested
+repository for assessment. Entries in `requests` identify the repository
+environments that will receive the findings. Once you have reviewed the
+destination, remove `--dry-run` and confirm.
### Verify the import
@@ -97,6 +88,10 @@ For a Cloud import, check the receipt for the destination shown in the preview.
| Private inbox (`privateImport`) | Check that `privateJob.status` is `completed` and its counts account for the selected findings, with zero errors or unprocessed rows. Review exclusions. |
| Repository publisher (environments in `requests`) | Check each receipt, the verified and unacknowledged counts, failures, and exclusions. |
+To inspect published findings in Codex, [connect the Cloud app](../../sdk/typescript/README.md#read-existing-cloud-findings)
+and ask for imported findings in the destination repository. For a private import,
+ask for your private import history.
+
If the repository publisher requires a reported severity, the preview excludes
findings whose severity the scanner left unknown. You can keep those findings
in a local import or a private inbox when available.
@@ -105,12 +100,9 @@ If `publish findings` stops and returns `savedSubmission`, [resume from that che
## Troubleshoot Semgrep and Snyk collection
-If `import semgrep` or `import snyk` returns HTTP 429, check `Retry-After`.
-Both collectors retry the same GET once when the requested wait is at most
-10 seconds. They accept whole seconds or an HTTP date and retry immediately
-for zero or a past date. Cancellation stops the wait. A failed request reports
-its HTTP status and up to 64 KiB of the vendor response. After the indicated
-wait, rerun collection and preview the complete successful output.
+If `import semgrep` or `import snyk` stops with HTTP 429, check the vendor's
+`Retry-After` value. Wait for that interval, rerun collection, and preview
+the complete export before importing it.
## Work with imported findings
diff --git a/docs/scanner-imports/blackduck.md b/docs/scanner-imports/blackduck.md
index 1b60b094a..bd89c7b67 100644
--- a/docs/scanner-imports/blackduck.md
+++ b/docs/scanner-imports/blackduck.md
@@ -7,8 +7,7 @@ download URL alone can't establish that link. [Export the collection](#export-th
## Quick start
-[Enable external imports](README.md#preview-a-report), then open the matching
-checkout. Choose a saved report or export one.
+From the matching checkout, choose a saved report or export one.
**Saved report.** Set `report` to the complete BOM-6 collection. For a selection,
use an array of native rows that each identify the same project version.
diff --git a/docs/scanner-imports/checkmarx.md b/docs/scanner-imports/checkmarx.md
index 7dba3291d..2ad5b9761 100644
--- a/docs/scanner-imports/checkmarx.md
+++ b/docs/scanner-imports/checkmarx.md
@@ -7,7 +7,7 @@ self-managed CxSAST scan (XML). Both formats support gzip. If you need the repor
## Preview, import and verify
-[Enable external imports](README.md#preview-a-report). From the matching checkout, preview the report with its verified Git URL.
+From the matching checkout, preview the report with its verified Git URL.
Choose a source key for the product, tenant or instance, project and ref.
Reuse it for later exports from that stream.
@@ -41,8 +41,9 @@ Python 3.10+ interpreter and vendor tools installed outside the scanned source t
CxFlow fetches by ID and exports the full XML even when issue-tracker filters are set.
Session credentials require confirmation for that server. [CxSAST All Scans](https://docs.checkmarx.com/en/34965-46419-viewing-results-from-all-scans.html)
-For a subset, an older CLI, or a custom runtime, supply a native export from
-your usual environment. Keep reports in a private directory outside the checkout.
+If you need a subset or your tools differ from the collector requirements
+above, supply a native export from your usual environment. Keep reports in
+a private directory outside the checkout.
[Supported sign-in and collection settings](../../plugins/codex-security/skills/publish-findings/references/checkmarx-import.md).
## Export one scan manually
diff --git a/docs/scanner-imports/continuum.md b/docs/scanner-imports/continuum.md
index 38553932d..8724c6f26 100644
--- a/docs/scanner-imports/continuum.md
+++ b/docs/scanner-imports/continuum.md
@@ -6,8 +6,7 @@ summaries from an environment dedicated to one repository.
## Quick start
-[Enable external imports](README.md#preview-a-report) and open the matching
-checkout. Set `ENVIRONMENT_ID` to the Continuum environment ID. Verify which
+Open the matching checkout. Set `ENVIRONMENT_ID` to the Continuum environment ID. Verify which
repository supplied the scanned code, including the archive for an S3 source.
For a finding from another scanner, you can also check its repository in that
scanner. [AWS Continuum code sources](https://docs.aws.amazon.com/continuum/latest/userguide/cv-getting-started.html)
@@ -78,9 +77,9 @@ repository name. The reader keeps that prefix. For local repeat imports, a summa
### Publish to your Cloud inbox
-Sign in to a workspace with the GitHub repository connected and private
-Continuum imports enabled. If you need locations, mitigation, or validation
-evidence, publish the detailed `get-code-finding` export first. A later upload
+For an inbox import, sign in to a Cloud workspace with the GitHub repository
+connected and support for Continuum private import jobs. If you need locations,
+mitigation, or validation evidence, publish the detailed `get-code-finding` export first. A later upload
with changed evidence for the same ARN can return `source_order_unknown`.
Preview the file and source key using your connected repository URL.
diff --git a/docs/scanner-imports/endor.md b/docs/scanner-imports/endor.md
index ef7412f3d..efe35fdd5 100644
--- a/docs/scanner-imports/endor.md
+++ b/docs/scanner-imports/endor.md
@@ -15,14 +15,13 @@ Endor supplies only the fully qualified dependency name, the import preserves
that name, including its ecosystem and version. A branch scan uses its REF
context ID. The source version's ref can also identify a tag or commit. If
optional package or advisory details exceed Cloud's field or finding size
-limits, new private imports use `security.findings.v1` to upload the reviewed
+limits, private imports use `security.findings.v1` to upload the reviewed
fields and original Endor record together. The service must support that
format for these findings. Retrying a saved import reuses its original upload.
## Quick start
-[Enable external imports](README.md#preview-a-report). In Endor, verify that
-the project and scan context match your checkout. A project UUID alone doesn't
+In Endor, verify that the project and scan context match your checkout. A project UUID alone doesn't
establish that link. From the checkout root, set the namespace and project
UUID for this default-branch example.
diff --git a/docs/scanner-imports/github-code-scanning.md b/docs/scanner-imports/github-code-scanning.md
index dbc5b3cef..0ec615553 100644
--- a/docs/scanner-imports/github-code-scanning.md
+++ b/docs/scanner-imports/github-code-scanning.md
@@ -5,8 +5,7 @@ alert and the instance GitHub returned for the selected ref.
## Quick start
-[Enable external imports](README.md#preview-a-report). From the matching
-checkout, set the repository and source key. For GitHub Enterprise, export
+In the matching checkout, set the repository and source key. For GitHub Enterprise, export
`GH_HOST` with your hostname first. For a repeat import, use the exact source
key from your previous preview, including case.
diff --git a/docs/scanner-imports/github-dependabot.md b/docs/scanner-imports/github-dependabot.md
index 7eaa8b5cc..1f19a82a4 100644
--- a/docs/scanner-imports/github-dependabot.md
+++ b/docs/scanner-imports/github-dependabot.md
@@ -5,9 +5,9 @@ dependency occurrence. Its advisory describes the vulnerability.
## Quick start
-[Enable external imports](README.md#preview-a-report). From the matching
-checkout, set a private report path outside the checkout. Choose a source key
-for this host, repository and alert family, or reuse your existing Dependabot key.
+In the matching checkout, choose a private report path outside the repository.
+Use the same source key for repeat imports from this host, repository and alert
+family.
```sh
report=/private/path/dependabot.jsonl
diff --git a/docs/scanner-imports/github-security-advisories.md b/docs/scanner-imports/github-security-advisories.md
index c826c56f5..57a54a14f 100644
--- a/docs/scanner-imports/github-security-advisories.md
+++ b/docs/scanner-imports/github-security-advisories.md
@@ -6,8 +6,7 @@ lists the packages and version ranges it affects.
## Quick start
-[Enable external imports](README.md#preview-a-report). From the destination
-checkout, set the repository and source key. For GitHub Enterprise, export
+In the destination checkout, set the repository and source key. For GitHub Enterprise, export
`GH_HOST` with your hostname first. For a repeat import, use the exact
advisories key from your previous preview, including case.
diff --git a/docs/scanner-imports/inspector.md b/docs/scanner-imports/inspector.md
index 29b7de115..659781e5a 100644
--- a/docs/scanner-imports/inspector.md
+++ b/docs/scanner-imports/inspector.md
@@ -6,8 +6,7 @@ findings are excluded.
## Quick start
-[Enable external imports](README.md#preview-a-report) and open the matching
-checkout. Verify the repository's Git URL in your SCM integration. If
+Open the matching checkout. Verify the repository's Git URL in your SCM integration. If
the report identifies the repository only by an Inspector project ARN, verify
that full ARN against the same URL in the SCM integration before importing.
@@ -74,9 +73,9 @@ To save the selected findings in your local workbench, remove `--dry-run` and co
### Publish to your Cloud inbox
-Sign in to a workspace with the GitHub repository connected and private
-Inspector imports enabled. Preview the same file and source key, using your
-connected repository URL. If the local preview required a project ARN, add
+For an inbox import, sign in to a Cloud workspace with the GitHub repository
+connected and support for Inspector private import jobs. Preview the same file
+and source key using the connected repository URL. If the local preview required a project ARN, add
`--inspector-project-arn` with the same verified ARN to the command below.
```sh
diff --git a/docs/scanner-imports/opengrep.md b/docs/scanner-imports/opengrep.md
index 5705248e5..d85e1ff5f 100644
--- a/docs/scanner-imports/opengrep.md
+++ b/docs/scanner-imports/opengrep.md
@@ -5,8 +5,8 @@ parse errors or timeouts. The preview shows both.
## Quick start
-[Enable external imports](README.md#preview-a-report). From the scanned checkout
-root, choose a saved report or run OpenGrep in the same shell.
+Run these commands from the root of the scanned checkout. Use a saved report or
+generate one with OpenGrep.
**Saved report.** Set the path to your OpenGrep JSON file.
diff --git a/docs/scanner-imports/schema-guide.md b/docs/scanner-imports/schema-guide.md
index 97e57bb27..e0ba53c20 100644
--- a/docs/scanner-imports/schema-guide.md
+++ b/docs/scanner-imports/schema-guide.md
@@ -10,8 +10,7 @@ mean and how to interpret the result.
Keep the same provider and source key for later exports of the same vendor
project and finding family. For example, use
`github.com/OWNER/REPO/dependabot` for Dependabot alerts. An updated local import
-under that key replaces evidence for its existing record. A key containing
-today's date would create another record for the same alert.
+under that key replaces evidence for its existing record. A source key that changes with each export creates another record for the same alert.
| Destination | What identifies the record |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
@@ -26,7 +25,7 @@ which changes can give an occurrence a different ID.
| ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [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 identify the same finding. |
-| [Tenable One local pilot](tenable.md) | Exact Tenable `finding_id` within the local checkout and a stable tenant/asset source key. Use the Code Repository asset UUID in the key. |
+| [Tenable One](tenable.md) | Exact Tenable `finding_id` within the local checkout and a stable tenant/asset source key. Use the Code Repository asset UUID in the key. |
| [Checkmarx SAST](checkmarx.md) | Checkmarx One uses the similarity ID and result hash. CxSAST scopes the similarity ID and ordered flow to the project and query. |
| [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. |
@@ -118,12 +117,12 @@ request before the response was lost.
1. If the interrupted result includes `savedSubmission`, keep that checkpoint.
Preview the original export with `--dry-run --format json` using the same
build, state directory, Cloud account, endpoint and import settings.
-2. Check `accountId`, `destination` and `resumed` in the preview. When `resumed`
- is true, confirm the command to continue the saved submission. The
- repository publisher also preserves the original expected versions. When it is false, review the fresh submission before
- confirming. If a repository reset retires the old submission and preparation
- returns an error, run `--dry-run` again and review the new destination and
- environment before confirming.
+2. Check `accountId`, `destination` and `resumed` in the preview. If `resumed`
+ is true, confirmation continues the saved submission. The repository
+ publisher also preserves the original expected versions. If `resumed` is
+ false, review the new submission before confirming. If a repository reset
+ retired the submission, run another dry run to review the new repository
+ and environment.
For a failed or cancelled private job, a fresh preview identifies the previous
job and confirmation starts a new attempt. A lost response from an active job
@@ -136,32 +135,24 @@ export file. For `prepareNormalizedExternalPublication()`, supply the original
`ExternalFindings`. Check `preview.resumed` before calling `publish()`.
Use the same SDK version throughout a submission when possible.
-Older SDK checkpoints saved the destination repository ID without the catalog
-URL. After a repository rename, retry those requests with the original
-normalized findings and report metadata, omitting supplemental source
-repository declarations. A new declaration needs a matching current catalog
-entry or a URL recorded when the request was approved.
-
-If a hosted Semgrep or Snyk request is pending, rerun the original input to
-finish it before submitting updated evidence for any of the same findings.
-Selections with distinct scanner-issued IDs can proceed independently on the
-same deployment, account, repository, connector, provider and source key.
-When an older checkpoint establishes only the source, finish that request
-before submitting another selection for that source. Use the SDK build that
-created the request and include the original report context and caller-added
-fields. Older SDKs included some fields in the checkpoint filename without
-retaining them in the saved request. If the publisher cannot identify the
-deployment of an older request, rerun it on its original deployment. An
-identified repository reset retires the request and requires fresh approval.
-
-After an SDK upgrade, retry with the original input. An older SDK could approve
-different bytes from those its JSON export contained. When the SDK verifies
-the old selection and request bytes, it resumes with the original request IDs
-and skips batches that already have receipts. If it cannot verify the original
-request, it preserves the checkpoint and stops before uploading. A saved JSON
-export can lose information from the original SDK input. If a getter makes it
-impossible to identify which findings were approved, the SDK can also stop a
-new submission for the same source and destination.
+For hosted Semgrep or Snyk imports, finish any pending request before sending
+updated evidence for the same finding IDs. Selections with distinct
+scanner-issued IDs can proceed independently. If the checkpoint records
+only the source, finish that request before starting another for the same
+source and destination.
+
+**Resuming across SDK versions.** Keep the SDK input that produced the
+checkpoint, including report context and caller-added fields. Serializing it
+as JSON can change the values used to identify the approved request. Retry on
+the original deployment. If the SDK can verify the saved selection, it reuses
+the request IDs and skips batches with receipts. Otherwise it preserves the
+checkpoint and stops before uploading. If it cannot identify the approved
+findings, a new submission for the same source and destination can also be blocked.
+
+After a repository rename, a checkpoint that records only the repository ID
+can still be retried with the original normalized findings and report metadata.
+Omit supplemental repository declarations for that retry. A new declaration
+requires a matching catalog entry or a URL recorded in the approval.
See [results and exit codes](../../sdk/typescript/docs/cli.md#results-and-exit-codes)
for cumulative counts and interrupted readback.
diff --git a/docs/scanner-imports/semgrep.md b/docs/scanner-imports/semgrep.md
index 933cd1500..04b94bf58 100644
--- a/docs/scanner-imports/semgrep.md
+++ b/docs/scanner-imports/semgrep.md
@@ -1,7 +1,7 @@
# Import Semgrep findings
-[Enable external imports](README.md#preview-a-report), then choose the report or
-account you have. Each route has a different source of finding IDs.
+Choose the route that matches your report or account. Each route uses a different
+source of finding IDs.
| Starting point | What to collect | Destination |
| ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- |
@@ -233,7 +233,7 @@ repository fields on each selected finding.
without a URL also needs the matching ID and a `repository.name` equal to
the decoded, namespace-qualified URL path, such as `example/project`.
-**Preview the selection.** [Enable external imports](README.md#preview-a-report).
+**Preview the selection.**
In a Node.js project you control outside the scanned checkout, install
`@openai/codex-security` and save this script as `preview-semgrep.mjs`.
Set the deployment, ref, repository URL, source key and finding IDs. Use
@@ -309,7 +309,6 @@ checkout. Each collection gets a new owner-only file. A failed collection
leaves earlier exports available for replay.
```sh
-export CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1
report=$(mktemp ./semgrep-backlog.XXXXXX) &&
codex-security import semgrep example/project --semgrep-deployment example \
--semgrep-ref refs/heads/topic --semgrep-product sast --format json > "$report" &&
diff --git a/docs/scanner-imports/snyk.md b/docs/scanner-imports/snyk.md
index 61c950b5f..b14e17ac1 100644
--- a/docs/scanner-imports/snyk.md
+++ b/docs/scanner-imports/snyk.md
@@ -14,9 +14,8 @@ Both routes support local and Cloud imports.
## Quick start
-[Enable external imports](README.md#preview-a-report). From the checkout root,
-set the destination and choose a key for the repository, branch, original scan
-target and format. Replace `root` with your target if you scanned a
+From the checkout root, set the destination and choose a source key for the
+repository, branch, original scan target and format. Replace `root` with your target if you scanned a
subdirectory such as `services/api`.
```sh
@@ -108,7 +107,7 @@ manifest locations are unsupported.
## Existing issues from Snyk
-[Enable external imports](README.md#preview-a-report) and set
+Set
`SNYK_TOKEN` to a read-authorized token for the selected region. See the
[Snyk API access requirements](https://docs.snyk.io/developer-tools/snyk-api/authentication-for-api)
and [Issues API permissions](https://docs.snyk.io/developer-tools/snyk-api/reference/issues).
diff --git a/docs/scanner-imports/sonar.md b/docs/scanner-imports/sonar.md
index e4cf36f84..8a6f91564 100644
--- a/docs/scanner-imports/sonar.md
+++ b/docs/scanner-imports/sonar.md
@@ -7,8 +7,7 @@ Replay it without signing in to Sonar. If you already have issue-search JSON,
## Quick start
-[Enable external imports](README.md#preview-a-report). From the matching
-checkout, run `sonar auth login` with browse access to the project's Sonar
+From the matching checkout, run `sonar auth login` with browse access to the project's Sonar
organization. [Sonar CLI authentication](https://docs.sonarsource.com/sonarqube-cli/quickstart-guide#step-2-authenticate)
**Preview live issues.** Copy the project and issue keys from Sonar's Issues
diff --git a/docs/scanner-imports/tenable.md b/docs/scanner-imports/tenable.md
index 1805f66d8..c15ba5500 100644
--- a/docs/scanner-imports/tenable.md
+++ b/docs/scanner-imports/tenable.md
@@ -4,7 +4,7 @@ Select a **Code Repository** in Tenable Exposure Management Inventory. Copy its
## Export the selection
-Run the examples from the Codex Security source tree. Set `TENABLE_ACCESS_KEY` and `TENABLE_SECRET_KEY` for a tenant with inventory export access on `cloud.tenable.com`. Use a private report directory outside both checkouts.
+The [download and CSV capture helpers](../../examples/tenable-one/) are part of the Codex Security source repository. Run the Python commands from that repository's root. Set `TENABLE_ACCESS_KEY` and `TENABLE_SECRET_KEY` for a tenant with Inventory Export API access on `cloud.tenable.com`, or [use existing CSV exports](#from-existing-csv-exports). Keep the reports outside both the source repository and the checkout whose findings you are importing.
```sh
umask 077
@@ -34,14 +34,12 @@ Pass additional finding chunks after `--findings`. To retain file locations, add
## Preview, save and read back
-Use the CLI built from this checkout. Choose a stable tenant alias so the same finding can be matched on later imports. [Source build setup](../../sdk/typescript/TESTING.md)
+Use the [installed CLI](../../README.md#quick-start) to preview the selection for the local checkout. Choose a stable tenant alias and keep it with the asset UUID in `--source-key` on repeat imports.
```sh
-export CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1
-cli="$PWD/sdk/typescript/bin/codex-security.mjs"
-node "$cli" publish findings "$reports/selection.json" --provider tenable \
+codex-security publish findings "$reports/selection.json" --provider tenable \
--to local --repository "$checkout" --source-repository-url "$repository_url" \
--source-key "TENANT_ALIAS/$asset_id" --dry-run --format json
```
-Check the preview against your selection. Remove `--dry-run` and confirm to save, then run `node "$cli" findings imported "$checkout" --format json`. The saved record retains Tenable's exact finding ID and state. Its Codex assessment starts as `not_assessed`. With the same source key, changed evidence updates that record and identical evidence preserves its version.
+Check the preview against your selection. Remove `--dry-run` and confirm to save, then run `codex-security findings imported "$checkout" --format json`. The saved record retains Tenable's exact finding ID and state. Its Codex assessment starts as `not_assessed`. With the same source key, changed evidence updates that record and identical evidence preserves its version.
diff --git a/docs/scanner-imports/trivy.md b/docs/scanner-imports/trivy.md
index 32c29a8ed..5647dfb7a 100644
--- a/docs/scanner-imports/trivy.md
+++ b/docs/scanner-imports/trivy.md
@@ -4,7 +4,7 @@ Use a saved Trivy schema-v2 JSON or gzip report from a repository or filesystem
## Preview the report
-[Enable external imports](README.md#preview-a-report). If you need a report,
+If you need a report,
run `trivy fs --scanners vuln --format json --output /private/path/trivy.json .`
from the checkout root. Use a private output directory outside the checkout.
@@ -22,7 +22,7 @@ Check the repository, manifest paths, versions and exclusions in the preview. Ke
A repository scan can omit `--trivy-scan-root` when its remote target and Git metadata corroborate a whole-checkout scan. A filesystem scan always needs the scan root. A filesystem artifact name is a display label. Trivy's Git metadata is the source of its repository claim. When the report or local checkout has no comparable remote, verify the source independently.
-Use credential-free repository URLs. If the importer reports ambiguous or conflicting repository claims, check the remote that supplied `Metadata.RepoURL` (Trivy v0.76.1 prefers `upstream` to `origin`). Regenerate the report with a verified HTTPS URL or an unambiguous SSH remote, preserving its account, host, port and path. An artifact label cannot restore an SSH account that Trivy omitted. Unknown Git hosts may require the same remote spelling. For older Windows reports, regenerate with Trivy v0.36.0 or later so path separators are recorded as `/`.
+Use credential-free repository URLs. If the importer reports ambiguous or conflicting repository claims, compare `Metadata.RepoURL` with the checkout's Git remotes. Regenerate the report with a verified HTTPS URL or an unambiguous SSH remote, preserving its account, host, port and path. An artifact label cannot restore an SSH account that Trivy omitted. Unknown Git hosts may require the same remote spelling. If a Windows report uses backslashes as directory separators, regenerate it with Trivy v0.36.0 or later to get repository paths that use `/`.
## Read the evidence and repeat an import
diff --git a/docs/scanner-imports/veracode.md b/docs/scanner-imports/veracode.md
index ad94249f2..8b293c005 100644
--- a/docs/scanner-imports/veracode.md
+++ b/docs/scanner-imports/veracode.md
@@ -5,8 +5,7 @@ application. Use the application context and `scan_type=STATIC`.
## Quick start
-[Enable external imports](README.md#preview-a-report). Verify that the
-application maps to a single Git repository and open its checkout.
+Verify that the application maps to a single Git repository and open its checkout.
**Saved report.** Set `report` to the complete Findings API page or array of
pages for your selection. Preserve each page's HAL links and pagination fields.
diff --git a/docs/scanner-imports/wiz.md b/docs/scanner-imports/wiz.md
index ab699ce9d..1932e5304 100644
--- a/docs/scanner-imports/wiz.md
+++ b/docs/scanner-imports/wiz.md
@@ -7,8 +7,7 @@ support gzip.
## Quick start
-[Enable external imports](README.md#preview-a-report). This example imports
-repository package vulnerabilities.
+This example imports package vulnerabilities from a repository branch.
**Saved report.** Choose the file for your repository and branch or build.
With a connected Wiz account, list findings for the repository and family,
diff --git a/examples/README.md b/examples/README.md
index 0181a4cfc..f58ede64c 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -8,12 +8,13 @@
| Scan Azure Repos from a central pipeline | [Azure Pipelines with Amazon Bedrock](azure-pipelines/README.md) runs manual full or committed-diff scans. |
| Import Tenable One findings locally | [Tenable One export guide](../docs/scanner-imports/tenable.md) shows how to select code repository findings. |
| Prepare a ServiceNow AVIT export | [AVIT template](servicenow-avit-template.csv). Replace the synthetic application and assignment values before using it as input to [export findings for ServiceNow](../sdk/typescript/docs/cli.md#export-findings-for-servicenow). |
-| Prepare findings for Cloud | [Findings CSV template](findings.csv). Add one row per finding and preview the file as shown below. |
+| Preview a Codex Security findings CSV for Cloud | [Findings CSV template](findings.csv). Add one row per finding and preview the file as shown below. |
## Preview a findings CSV
-Copy the header-only [template](findings.csv). For a local dry run, append this
-synthetic row under its header:
+Use this CSV format with `publish scan --to cloud`. For reports exported by a scanner,
+follow its [provider guide](../docs/scanner-imports/README.md). To try the Cloud CSV
+preview, copy the header-only [template](findings.csv) and append this synthetic row.
```csv
occ_e79cb19591e696572a1c22be,csf_852f90d6e1177502ff113d4a,Archive entry can escape the output directory,The archive writer uses the entry path without checking containment.,high,high,open,,,Validate each destination before writing.,src/extract.py,41,44
diff --git a/plugins/codex-security/.mcp.json b/plugins/codex-security/.mcp.json
index e5e523af4..ca6334d1f 100644
--- a/plugins/codex-security/.mcp.json
+++ b/plugins/codex-security/.mcp.json
@@ -43,7 +43,6 @@
"PYTHONUTF8",
"CODEX_SECURITY_PYTHON_COMMAND",
"CODEX_SECURITY_GIT",
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS",
"CODEX_SECURITY_KNOWLEDGE_BASE",
"CODEX_SECURITY_CONFIG_PATH",
"CODEX_SECURITY_DEEP_SCAN_CONFIG_PATH",
diff --git a/plugins/codex-security/mcp-app/helpers-main.ts b/plugins/codex-security/mcp-app/helpers-main.ts
index e25974558..c2e2d4b1b 100644
--- a/plugins/codex-security/mcp-app/helpers-main.ts
+++ b/plugins/codex-security/mcp-app/helpers-main.ts
@@ -78,14 +78,10 @@ function runHelper(): void {
"Usage: store-findings\nReads a JSON object from stdin with an absolute stateDirectory and payload.entries containing finding and embedding records; payload.repositoryId is optional.",
"list-stored-findings":
"Usage: list-stored-findings\nReads a JSON object from stdin with an absolute stateDirectory, positive payload.limit and non-negative payload.offset.",
- ...(process.env.CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS === "1"
- ? {
- "store-external-findings":
- "Usage: store-external-findings\nReads a JSON object from stdin with an absolute stateDirectory and payload containing repository, provider, sourceKey and findings with source_finding_id and evidence.",
- "list-external-findings":
- "Usage: list-external-findings\nReads a JSON object from stdin with an absolute stateDirectory and payload.repository; payload.id optionally selects one external finding.",
- }
- : {}),
+ "store-external-findings":
+ "Usage: store-external-findings\nReads a JSON object from stdin with an absolute stateDirectory and payload containing repository, provider, sourceKey and findings with source_finding_id and evidence.",
+ "list-external-findings":
+ "Usage: list-external-findings\nReads a JSON object from stdin with an absolute stateDirectory and payload.repository; payload.id optionally selects one external finding.",
"find-potential-duplicates":
"Usage: find-potential-duplicates\nReads a JSON object from stdin with an absolute stateDirectory, payload.findingId and payload.scope containing either repositoryId or allRepositories: true.",
"store-dedupe-groups":
diff --git a/plugins/codex-security/mcp-app/src/workbench/commands.ts b/plugins/codex-security/mcp-app/src/workbench/commands.ts
index c86a732b6..a9f5b9bc1 100644
--- a/plugins/codex-security/mcp-app/src/workbench/commands.ts
+++ b/plugins/codex-security/mcp-app/src/workbench/commands.ts
@@ -28,14 +28,6 @@ export async function workbenchCommand(
input: string,
scanId?: string,
): Promise<unknown> {
- if (
- (command === "store-external-findings" ||
- command === "list-external-findings") &&
- process.env.CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS !== "1"
- )
- throw new Error(
- "External findings imports are disabled. Set CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1 to enable them.",
- );
const request = parseJson(input) as {
stateDirectory: string;
payload: unknown;
diff --git a/plugins/codex-security/mcp-app/tests/support/fake-codex-source.ts b/plugins/codex-security/mcp-app/tests/support/fake-codex-source.ts
index b6ae04195..84a83180d 100644
--- a/plugins/codex-security/mcp-app/tests/support/fake-codex-source.ts
+++ b/plugins/codex-security/mcp-app/tests/support/fake-codex-source.ts
@@ -71,7 +71,7 @@ const profileContents = profileIndex === -1 ? undefined : readFileSync(join(proc
const openaiAuthentication = stdin.includes('CAPTURE_SYNTHETIC_OPENAI_AUTH') ? { OPENAI_API_KEY: process.env.OPENAI_API_KEY, CODEX_API_KEY: process.env.CODEX_API_KEY } : undefined;
const bedrockAuthentication = stdin.includes('CAPTURE_SYNTHETIC_BEDROCK_AUTH') ? Object.fromEntries(JSON.parse(process.env.FAKE_CODEX_BEDROCK_ENV_KEYS).map((name) => [name, process.env[name]])) : undefined;
const codexConfig = stdin.includes('CAPTURE_SYNTHETIC_CODEX_CONFIG') ? readFileSync(join(process.env.CODEX_HOME, 'config.toml'), 'utf8') : undefined;
-const runtimeEnvironment = Object.fromEntries(['PATH', 'HOME', 'PYTHON', 'PYTHONUTF8', 'CODEX_MCP_NODE_PATH', 'CODEX_BROWSER_USE_NODE_PATH', 'CODEX_ELECTRON_RESOURCES_PATH', 'LD_LIBRARY_PATH', 'DYLD_LIBRARY_PATH', 'DYLD_FALLBACK_LIBRARY_PATH', 'CODEX_SECURITY_STATE_DIR', 'CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS', 'RUNNER_TRACKING_ID'].map(name => [name, process.env[name]]));
+const runtimeEnvironment = Object.fromEntries(['PATH', 'HOME', 'PYTHON', 'PYTHONUTF8', 'CODEX_MCP_NODE_PATH', 'CODEX_BROWSER_USE_NODE_PATH', 'CODEX_ELECTRON_RESOURCES_PATH', 'LD_LIBRARY_PATH', 'DYLD_LIBRARY_PATH', 'DYLD_FALLBACK_LIBRARY_PATH', 'CODEX_SECURITY_STATE_DIR', 'RUNNER_TRACKING_ID'].map(name => [name, process.env[name]]));
const toolProbe = stdin.includes('CAPTURE_SYNTHETIC_RG') ? spawnSync('rg', ['--version'], { encoding: 'utf8' }) : undefined;
if (toolProbe && toolProbe.status !== 0) throw toolProbe.error ?? new Error(toolProbe.stderr);
const pythonProbe = stdin.includes('CAPTURE_SYNTHETIC_PYTHON') ? spawnSync(process.env.PYTHON, ['-I', '-c', 'import json,os,sys; print(json.dumps([sys.prefix,os.environ.get("LD_LIBRARY_PATH")]))'], { encoding: 'utf8' }) : undefined;
@@ -166,29 +166,12 @@ export function workerRuntimeEnvironment(root: string, virtualenv?: string) {
DYLD_LIBRARY_PATH: path.join(root, "dylibs"),
DYLD_FALLBACK_LIBRARY_PATH: path.join(root, "fallback-libraries"),
CODEX_SECURITY_STATE_DIR: path.join(root, "state"),
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1",
RUNNER_TRACKING_ID: "synthetic-worker-job",
};
}
-export const externalImports: {
- inherited: string | undefined;
- override?: string;
-}[] = [
- { inherited: undefined },
- { inherited: "1" },
- { inherited: "0" },
- { inherited: "0", override: "1" },
- { inherited: "1", override: "0" },
- { inherited: "" },
-];
-
export function workerScanEnvironment(root: string, index: number) {
- const { override } = externalImports[index]!;
return {
- ...(override === undefined
- ? {}
- : { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: override }),
HOME: path.join(root, `scan home ${index}`),
PATH: path.join(root, `scan tools ${index}`),
NODE_OPTIONS: `--stack-trace-limit=${20 + index}`,
diff --git a/plugins/codex-security/mcp-app/tests/test_deep_scan_executor.ts b/plugins/codex-security/mcp-app/tests/test_deep_scan_executor.ts
index fffc46fc2..22fd182b1 100644
--- a/plugins/codex-security/mcp-app/tests/test_deep_scan_executor.ts
+++ b/plugins/codex-security/mcp-app/tests/test_deep_scan_executor.ts
@@ -20,7 +20,6 @@ import {
workerGitEnvironment,
workerRuntimeEnvironment,
workerScanEnvironment,
- externalImports,
expectedGitEnvironment,
restoreEnv,
} from "./support/fake-codex-source.ts";
@@ -1465,7 +1464,6 @@ async function testWorkerRuntimeSettings() {
"CODEX_SECURITY_PLUGIN_ROOT",
"CODEX_SECURITY_DEEP_SCAN_CONFIG_PATH",
"CODEX_SECURITY_KNOWLEDGE_BASE",
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS",
"OPENAI_API_KEY",
"CODEX_API_KEY",
"SYNTHETIC_GATEWAY_KEY",
@@ -2067,10 +2065,6 @@ env_key = "SYNTHETIC_GATEWAY_KEY"`,
await Promise.all(
executors.map((executor, index) => {
// Snapshot each scan environment independently.
- restoreEnv(
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS",
- externalImports[index].inherited,
- );
process.env.CODEX_MCP_NODE_PATH = nodePaths[index];
Object.assign(process.env, temporaryEnvironments[index]);
process.env.CODEX_SECURITY_STATE_DIR = path.join(
@@ -2192,15 +2186,6 @@ env_key = "SYNTHETIC_GATEWAY_KEY"`,
);
const invocation = await readJson(workerLaunch.markerPath);
assertFlagPair(invocation.argv, "--cd", workerDirectories[index]);
- assert.equal(
- invocation.runtimeEnvironment
- .CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS,
- externalImports[index].override ?? externalImports[index].inherited,
- );
- assert.equal(
- process.env.CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS,
- externalImports.at(-1)!.inherited,
- );
if (
process.platform === "win32" &&
configuration === "" &&
diff --git a/plugins/codex-security/mcp-app/tests/test_external_imports_gate.ts b/plugins/codex-security/mcp-app/tests/test_external_imports_gate.ts
deleted file mode 100644
index 738c7cf8d..000000000
--- a/plugins/codex-security/mcp-app/tests/test_external_imports_gate.ts
+++ /dev/null
@@ -1,149 +0,0 @@
-import assert from "node:assert/strict";
-import { execFile, spawnSync } from "node:child_process";
-import { existsSync } from "node:fs";
-import { join } from "node:path";
-import { DatabaseSync } from "node:sqlite";
-import { after, test } from "node:test";
-import { fileURLToPath } from "node:url";
-import { promisify } from "node:util";
-import { importSource } from "./import-module.ts";
-import { createTemporaryDirectories } from "./support/temporary-directories.ts";
-
-const { workbenchCommand } = (await importSource(
- "src/workbench/commands.ts",
-)) as typeof import("../src/workbench/commands.ts");
-const temporary = createTemporaryDirectories(true);
-after(() => temporary.cleanup());
-const flag = "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS";
-const commands = ["store-external-findings", "list-external-findings"];
-const helper = fileURLToPath(
- new URL(
- "../../../../sdk/typescript/_bundled_plugin/mcp/helpers.mjs",
- import.meta.url,
- ),
-);
-
-function helperEnvironment(value?: string): NodeJS.ProcessEnv {
- const environment = Object.fromEntries(
- Object.entries(process.env).filter(([name]) => name.toUpperCase() !== flag),
- );
- if (value !== undefined) environment[flag] = value;
- return environment;
-}
-
-test("direct external commands require opt-in before parsing input or creating state", async (t) => {
- const previous = process.env[flag];
- t.after(() => {
- if (previous === undefined) delete process.env[flag];
- else process.env[flag] = previous;
- });
- const stateDirectory = join(
- await temporary.create("external-gate-direct-"),
- "state",
- );
- const input = JSON.stringify({ stateDirectory, payload: {} });
- for (const value of [undefined, "0", "true"]) {
- if (value === undefined) delete process.env[flag];
- else process.env[flag] = value;
- for (const command of commands) {
- await assert.rejects(
- workbenchCommand(command, input),
- /CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1/,
- );
- await assert.rejects(
- workbenchCommand(command, "not JSON"),
- /CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1/,
- );
- }
- assert.equal(existsSync(stateDirectory), false);
- }
-});
-
-test("disabled bundled helpers omit external commands and do not create state", async () => {
- const stateDirectory = join(
- await temporary.create("external-gate-disabled-"),
- "state",
- );
- for (const value of [undefined, "0", "true"]) {
- for (const command of commands) {
- const result = spawnSync(process.execPath, [helper, command], {
- env: helperEnvironment(value),
- input: JSON.stringify({ stateDirectory, payload: {} }),
- encoding: "utf8",
- });
- assert.equal(result.status, 2, result.stderr);
- assert.equal(result.stdout, "");
- assert.ok(result.stderr.includes("store-findings"));
- for (const hidden of commands)
- assert.equal(result.stderr.includes(hidden), false);
- }
- assert.equal(existsSync(stateDirectory), false);
- }
- const { stdout } = await promisify(execFile)(
- process.execPath,
- [helper, "store-findings", "--help"],
- { env: helperEnvironment(), timeout: 30_000 },
- );
- assert.ok(stdout.startsWith("Usage: store-findings"));
-});
-
-test("opted-in bundled helpers expose help, store and read external evidence", async () => {
- const root = await temporary.create("external-gate-enabled-");
- const stateDirectory = join(root, "state");
- const repository = join(root, "synthetic-repository");
- const payload = {
- repository,
- provider: "synthetic-scanner",
- sourceKey: "synthetic-project",
- findings: [
- {
- source_finding_id: "finding-one",
- evidence: { title: "Synthetic finding" },
- },
- ],
- };
- for (const command of commands) {
- // Open stdin must not delay an enabled help request.
- const { stdout } = await promisify(execFile)(
- process.execPath,
- [helper, command, "--help"],
- { env: helperEnvironment("1"), timeout: 30_000 },
- );
- assert.ok(stdout.startsWith(`Usage: ${command}`));
- }
- for (const command of commands) {
- const result = spawnSync(process.execPath, [helper, command], {
- env: helperEnvironment("1"),
- input: JSON.stringify({ stateDirectory, payload }),
- encoding: "utf8",
- });
- assert.equal(result.status, 0, result.stderr);
- const stored = JSON.parse(result.stdout);
- assert.equal(stored.findings.length, 1);
- assert.deepEqual(stored.findings[0].evidence, payload.findings[0].evidence);
- assert.equal(stored.findings[0].assessment.state, "not_assessed");
- }
- const disabled = spawnSync(
- process.execPath,
- [helper, "list-external-findings"],
- {
- env: helperEnvironment(),
- input: JSON.stringify({ stateDirectory, payload: { repository } }),
- encoding: "utf8",
- },
- );
- assert.equal(disabled.status, 2, disabled.stderr);
- const database = new DatabaseSync(join(stateDirectory, "workbench.sqlite3"), {
- readOnly: true,
- });
- try {
- assert.equal(
- database
- .prepare("SELECT COUNT(*) AS total FROM external_source_reports")
- .get()!.total,
- 1,
- );
- } finally {
- database.close();
- }
-});
diff --git a/plugins/codex-security/mcp-app/tests/test_mcp_app_smoke.ts b/plugins/codex-security/mcp-app/tests/test_mcp_app_smoke.ts
index 5dcfe4b1d..421550095 100644
--- a/plugins/codex-security/mcp-app/tests/test_mcp_app_smoke.ts
+++ b/plugins/codex-security/mcp-app/tests/test_mcp_app_smoke.ts
@@ -113,7 +113,6 @@ assert.deepEqual(
"PYTHONUTF8",
"CODEX_SECURITY_PYTHON_COMMAND",
"CODEX_SECURITY_GIT",
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS",
"CODEX_SECURITY_KNOWLEDGE_BASE",
"CODEX_SECURITY_CONFIG_PATH",
"CODEX_SECURITY_DEEP_SCAN_CONFIG_PATH",
diff --git a/plugins/codex-security/mcp-app/tests/test_workbench_findings.ts b/plugins/codex-security/mcp-app/tests/test_workbench_findings.ts
index 07da2c4d8..23f751da9 100644
--- a/plugins/codex-security/mcp-app/tests/test_workbench_findings.ts
+++ b/plugins/codex-security/mcp-app/tests/test_workbench_findings.ts
@@ -148,6 +148,8 @@ test("finding helper help exits without reading stdin", async () => {
const commands = [
"store-findings",
"list-stored-findings",
+ "store-external-findings",
+ "list-external-findings",
"find-potential-duplicates",
"store-dedupe-groups",
"list-dedupe-groups",
diff --git a/plugins/codex-security/skills/cloud-findings/SKILL.md b/plugins/codex-security/skills/cloud-findings/SKILL.md
index a33f9a2f7..dcd436b1c 100644
--- a/plugins/codex-security/skills/cloud-findings/SKILL.md
+++ b/plugins/codex-security/skills/cloud-findings/SKILL.md
@@ -20,11 +20,11 @@ Call `defense_factory_bootstrap` before data reads. Reuse its result within the
Use `defense_factory_github_search`, `defense_factory_github_repositories`, or `defense_factory_github_get` to resolve repositories on the connectors returned by bootstrap. Preserve returned repository and connector IDs, including GitHub Enterprise identities. `defense_factory_workflow_repositories` can locate repositories with recorded runs. A local checkout name alone does not identify a Cloud repository. Ask the user to choose when account or repository context is ambiguous; in noninteractive use, stop with the ambiguity and required selection. An explicit request for all accessible repositories may use that broader scope.
-For a finding link, accept the selected Cloud `webOrigin` with the path `/codex/cloud/security/findings/<finding-id>` or the legacy `/codex/security/findings/<finding-id>`. Decode the final path segment once and resolve it through `defense_factory_findings_get`. Preserve combined finding IDs (`commit:…`, `rf_…`, or `pro_…`) returned by Cloud. A commit-finding link under either accepted path may use a bare finding ID; pass that as `commit:<finding-id>`. Do not substitute a grouped issue, scan, or PR ID. For an unsupported origin or path, explain which finding link or ID is needed instead of guessing another record. Use returned Cloud links when available. Every direct detail or evidence read must go through its tool, even for an ID that was previously listed.
+For a finding link, accept the selected Cloud `webOrigin` with the path `/codex/cloud/security/findings/<finding-id>` or the legacy `/codex/security/findings/<finding-id>`. Decode the final path segment once and resolve it through `defense_factory_findings_get`. Pass complete finding IDs returned by Cloud unchanged, including any source prefix. A commit-finding link under either accepted path may use a bare finding ID; pass that as `commit:<finding-id>`. Do not substitute a grouped issue, scan, or PR ID. For an unsupported origin or path, explain which finding link or ID is needed instead of guessing another record. Use returned Cloud links when available. Every direct detail or evidence read must go through its tool, even for an ID that was previously listed.
## List and inspect findings
-When the findings list or detail tool offers `api_version`, select `v2` for requests that include imported scanner findings. The default `v1` view covers native findings. For an imported-only list, also set `source` to `imported` if exposed. Use only provider values advertised by the selected tool. If you filter returned evidence locally, follow every page in the requested scope and say how you filtered it.
+When the findings list or detail tool offers `api_version`, select `v2` for requests that include imported scanner findings. The default `v1` view covers native findings. For an imported-only list, also set `source` to `imported` if exposed. Use `provider` to filter scanner occurrences. To list grouped issues with published evidence from a scanner, use `defense_factory_canonical_findings_list` with `published_evidence_provider`. Scope grouped issues to a repository with its stable ID in `repo_id`. Use the provider values advertised by each tool. If you filter returned evidence locally, follow every page in the requested scope and say how you filtered it.
Use `defense_factory_findings_list` with the discovered repository URL in `repo` and the user's filters; `repo` accepts comma-separated URLs, not repository IDs. Workflow tools use the returned repository ID in `repo_id`. Filters may include severity (`criticality`), lifecycle `status`, `source`, `q`, `path_prefix`, `start_at`, `end_at`, `scan_id`, `review_run_id`, `validated`, `has_patch`, `author`, and `assignee`; use the tool's current schema for available filters and their accepted values. `assignee` accepts comma-separated recorded user emails and is separate from commit authorship. Do not invent an assigned-team filter.
@@ -39,7 +39,7 @@ Keep these records separate in the answer:
- **Periodic fix check:** its recorded time, commit, result, and report.
- **Lifecycle status:** the finding's recorded state; it does not prove that a patch was checked or that a periodic fix check passed.
-Repository-scan and PR-review findings may not supply the same fields as commit findings. Preserve their source evidence and report absent or unknown values as unavailable or unknown, rather than success, failure, or unassigned.
+The fields available for repository-scan, PR-review, and imported findings can differ from those for commit findings. Preserve their source evidence and report absent or unknown values as unavailable or unknown, rather than success, failure, or unassigned.
## Read evidence
@@ -51,6 +51,6 @@ An artifact reference or download link alone is not report content. Unsupported
## Read scan status
-Use `defense_factory_scan_history` for combined commit and repository scan history. It accepts only `limit` (1–100), `cursor`, and `scan_type` (`commit_scan` or `repository_scan`). Follow its pages to locate commit scans; do not claim it has repository, status, or date filters. For repository runs, use `defense_factory_workflow_list` with its `repo_id` and `status` filters, then `defense_factory_workflow_get` for progress and failure details. When history provides a monitoring configuration ID and scan ID, use `defense_factory_monitoring_scan_get` with that configuration as `parameters.path.id` and the scan as `parameters.path.scan_id`.
+Use `defense_factory_scan_history` for combined commit and repository scan history. Use `repo_ids` for repository-scoped history. To include the caller’s private imports in combined history, set `include_private_imports: true` and omit `repo_ids` and `scan_type`. For private imports alone, set `scan_type: private_import` and omit `repo_ids`. Follow the returned cursor for more history. For repository runs, use `defense_factory_workflow_list` with its `repo_id` and `status` filters, then `defense_factory_workflow_get` for progress and failure details. When history provides a monitoring configuration ID and scan ID, use `defense_factory_monitoring_scan_get` with that configuration as `parameters.path.id` and the scan as `parameters.path.scan_id`.
-Commit scans record status, timestamps, and success but may have no detailed failure message or progress stage. Say when those details are unavailable. A failed, canceled, or unfinished scan with zero findings is not a clean scan. Include the source, relevant IDs, scope read, and recorded status in the answer.
+For the current processing phase, request `view: progress` on the workflow or monitoring scan detail tool. Commit scans record status, timestamps, and success. Report when detailed failure information is unavailable. A failed, canceled, or unfinished scan with zero findings is not a clean scan. Include the source, relevant IDs, scope read, and recorded status in the answer.
diff --git a/plugins/codex-security/skills/publish-findings/SKILL.md b/plugins/codex-security/skills/publish-findings/SKILL.md
index 16f34db43..952a4f535 100644
--- a/plugins/codex-security/skills/publish-findings/SKILL.md
+++ b/plugins/codex-security/skills/publish-findings/SKILL.md
@@ -1,12 +1,10 @@
---
name: publish-findings
-description: Requires explicit opt-in with CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1. Preview and import scanner findings, including issues selected in the SonarQube plugin, into the local workbench or Codex Security Cloud.
+description: Preview and import scanner findings, including issues selected in the SonarQube plugin, into the local workbench or Codex Security Cloud.
---
# Publish external findings
-Before acquiring or importing findings, check for `CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1` in the command environment. If it is unset or has another value, stop and ask the user to enable imports.
-
Use `codex-security import sonar` for [live SonarQube Cloud issues](#sonarqube-cloud-issues) or a capture saved by that command. Use `codex-security publish findings` for native scanner exports, including Sonar `/api/issues/search` pages with `--provider sonar`. Select the requested destination. The CLI owns source mapping, persistence, and Cloud authentication and retries. Do not implement another store or uploader or put credentials in command arguments.
## Select the evidence
@@ -17,7 +15,7 @@ Use the same acquisition format for repeated imports. Check the provider's ident
## Import locally
-Use a local repository path with `--repository`. No Cloud login is required.
+Use the checkout path with `--repository`. A saved report can be imported locally offline. Use this destination for Tenable One Code Repository captures and selected Semgrep Guardian findings. [Supported inputs by provider](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/README.md#choose-your-scanner)
```sh
codex-security publish findings /path/to/selected-wiz-findings.json \
@@ -94,7 +92,7 @@ For CLI automation, prefer `snyk test --file=package.json --json-file-output=sny
Use one format consistently per repository, branch and scan target, with a stable source key such as `github.com/example/project/main/root/native-sca`. Plugin, native JSON and SARIF have distinct identities; use separate keys when switching, without claiming cross-format deduplication or removal of older records. Existing `snyk test --sarif-file-output=snyk-open-source.sarif` reports remain a compatibility path. SARIF groups advisory occurrences and exposes one package coordinate, so prefer JSON for acquisition. Its target-relative manifest paths lack a Git-root offset and stay in original evidence with synthetic line numbers, without being projected as repository locations or package manifest paths.
-Retain package versions, reported fixed versions, provenance and original evidence without claiming a fix was applied. Known repository claims must match the selected Cloud repository or, when available, a configured local Git remote. Resolve an unknown repository with the user; never infer that an export belongs to the current checkout. Follow [local imports](#import-locally) for preview, confirmation and readback or [Cloud publication](#publish-to-cloud) for upload authorization. All three Snyk formats support either destination.
+Retain package versions, reported fixed versions, provenance and original evidence without claiming a fix was applied. Known repository claims must match the selected Cloud repository or, when available, a configured local Git remote. Resolve an unknown repository with the user; never infer that an export belongs to the current checkout. Follow [local imports](#import-locally) for preview, confirmation and readback or [Cloud publication](#publish-to-cloud) for upload authorization. Snyk workspace reports and monitored-project exports support local and Cloud import.
## Semgrep Code
@@ -149,7 +147,7 @@ Code-scanning identities include the ref; repository alerts and advisories must
Resolve the user's destination to a connected GitHub or GitHub Enterprise repository URL or Cloud repository ID, including custom Enterprise hosts. Confirm the intended Cloud account and authorized repository environment before running a preview that can contact Cloud. Use the existing file-backed ChatGPT login; explain a missing or incompatible login rather than changing credential storage automatically.
-For staging or another Cloud deployment, configure the [deployment settings](#deployment-settings) before previewing. Keep the selected deployment and login throughout the upload.
+For an alternate Cloud deployment, configure the [deployment settings](#deployment-settings) before previewing. Keep the selected deployment and login throughout the upload.
### Preview and approve
@@ -159,31 +157,22 @@ codex-security publish findings /path/to/selected-wiz-findings.json \
--source-key TENANT_ID/vulnerability-finding --dry-run --format json
```
-When the preview returns `status: "empty"`, report that there is nothing to upload, then stop. For a nonempty preview, show the Cloud API endpoint, account, repository, environments, source namespace, severity counts, and exclusions. Identify the evidence file and make the complete JSON preview available for inspection without pasting a large report into the conversation. Explain that vendor evidence is not a Codex assessment.
+When the preview returns `status: "empty"`, report that there is nothing to upload. For a nonempty preview, show the endpoint, account, repository, source key, severity counts and exclusions. The `privateImport` entry describes the report for the user’s private inbox. For the repository publisher, `requests` identifies the environments that will receive the records. Identify the evidence file and make the complete JSON preview available for inspection without pasting a large report into the conversation. Explain that vendor evidence is not a Codex assessment.
Obtain explicit confirmation for this concrete upload, including skipped records. Then run the same command without `--dry-run`, adding `--yes`. Authorization to inspect or assess findings alone does not authorize sending them to Cloud. Keep approval when the user already approved this preview and the input and destination are unchanged.
### Upload and report
-Read the structured result even when the process exits nonzero. Progress appears on stderr.
-
-| Status | Exit code | Meaning |
-| ------------- | --------- | ------------------------------------------------------- |
-| `complete` | 0 | All selected records were acknowledged and read back. |
-| `partial` | 1 | Some records were excluded or have final item failures. |
-| `interrupted` | 2 | Upload, verification, or receipt persistence stopped. |
-| `failed` | 2 | Preparation failed before upload. |
+Read the structured result even when the process exits nonzero. Progress appears on stderr. For a private inbox import, check `privateJob.status`, the job counts, errors and unprocessed records. A completed job can have `verified: 0`. For the repository publisher, report verified and unacknowledged records from the item receipts. For either destination, include exclusions, failures and any `savedSubmission` checkpoint. [Result fields and exit codes](https://github.com/openai/codex-security/blob/main/sdk/typescript/docs/cli.md#results-and-exit-codes)
-Cancellation uses the normal signal exit code. Report verified, unacknowledged, excluded, and failed records separately. Include source IDs from `failures`, any `savedSubmission` path, and recovery errors. Receipts and readback confirm stored vendor evidence. Assessment and visibility in the shared Cloud Findings view require separate verification. Link to the returned `cloudUrl` when available.
+A receipt confirms ingestion of scanner evidence. A private finding can then be assessed against the repository and published to shared Findings. Link to the returned `cloudUrl` when available.
### Resume an interrupted upload
-After a lost response or retryable failure, repeat the command with the same input and destination. Cloud may already have accepted some records. The publisher reuses saved request IDs and bodies, resends only requests without a saved receipt, and verifies the acknowledged records. Existing findings keep their original Cloud environment when the repository default changes.
-
-If the repository was reset, stop and report the error. Rediscover the repository and get fresh confirmation before starting a new publication.
+Preview the original file again with the same source key, repository, account, endpoint and state directory. If `resumed` is true, the CLI reuses the saved submission. If a reset or changed destination requires a new submission, review the new preview before confirming. [Retry a Cloud submission](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/schema-guide.md#retry-a-cloud-submission)
### Deployment settings
Set `CODEX_SECURITY_CLOUD_BASE_URL` to the deployment's API root for preview and upload. Use its login and an isolated state directory for tests. If the user or Cloud page supplies an app URL, set `CODEX_SECURITY_CLOUD_WEB_URL` to that full URL. This setting controls the returned UI link. The API root and login still determine routing and authentication.
-Check the preview's `cloudApiUrl` and any `cloudUrl` against the intended API endpoint and app. Saved retries are scoped to the deployment. `CODEX_SECURITY_CLOUD_PUBLISH_URL` applies only to native scan publication. If staging is unavailable, stop before uploading.
+Check the preview's `cloudApiUrl` and any `cloudUrl` against the intended API endpoint and app. Saved retries are scoped to the deployment. `CODEX_SECURITY_CLOUD_PUBLISH_URL` applies only to native scan publication.
diff --git a/plugins/codex-security/skills/publish-findings/references/checkmarx-import.md b/plugins/codex-security/skills/publish-findings/references/checkmarx-import.md
index 65e77cea9..5e9ede8dd 100644
--- a/plugins/codex-security/skills/publish-findings/references/checkmarx-import.md
+++ b/plugins/codex-security/skills/publish-findings/references/checkmarx-import.md
@@ -7,7 +7,7 @@ Use a supplied One CLI JSON or CxSAST XML report directly. For collection, confi
- Use a trusted session and a private working and temporary directory outside the source tree, for both local and Cloud imports. Set the working directory **before** starting a process. Use a noninteractive, non-login system shell such as `/bin/sh` with `login: false`.
- If an IDE or build supplies checkout-controlled startup settings, use a known-clean session or a saved export. A trusted host can exclude `LD_*`, `DYLD_*`, `BASH_ENV` and `ENV` before launching a shell or interpreter. Keep existing exclusions and account for restored shell snapshots. Never start a suspect shell to unset variables or source project files. [Codex shell environment policy](https://developers.openai.com/codex/config-advanced/)
- Resolve the installed [collector](../scripts/collect_checkmarx.py) and vendor tools to trusted absolute paths outside the source tree. For `python_path`, use trusted system tools to inspect the executable and resolve symlinks without running it. Use the native Python 3.10+ interpreter with `-I -S`. Ask for native installation paths if given a shim or shell launcher.
-- Enable external imports. Pass the absolute checkout or unpacked source as `--source-root` before the product. Omit it only when there is no local source tree.
+- Pass the absolute checkout or unpacked source as `--source-root` before the product. Omit it only when there is no local source tree.
## Checkmarx One
@@ -23,7 +23,7 @@ Use native `cx` 2.3.23+. An explicit `CX_CONFIG_FILE_PATH` selects that trusted
**Verify ownership before fetching.** CxFlow requests XML by scan ID. Confirm the completed ID, exact project and full owning team path from the same **Projects & Scans → All Scans** row on the selected server. Use trusted read-only metadata or ask the operator to confirm those values from that view. For repeated names, check **View Project Scans** under the intended team. Without confirmation, ask for selected XML. Issue-tracker filters do not narrow the raw XML. [All Scans](https://docs.checkmarx.com/en/34965-46419-viewing-results-from-all-scans.html)
-Use native Java, a released CxFlow JAR (1.6.37+), and a trusted SAST-only profile with `CxXml` enabled. Keep the profile and everything it loads outside the checkout. Take the server, authentication and any custom `checkmarx.client-id` from that profile. Only append `--use-env-credentials` when the operator confirms the session's `CHECKMARX_USERNAME`, `CHECKMARX_PASSWORD` or `CHECKMARX_CLIENT_SECRET` belong to that server. For custom JVM settings or project names the installed CxFlow cannot resolve (including CJK project names on 1.7.14), ask for an XML export. [CxFlow credentials](https://github.com/checkmarx-ltd/cx-flow/blob/v1.7.14/docs/Tutorials.md#L382-L390) · [CxXml writer](https://github.com/checkmarx-ltd/cx-flow/blob/v1.7.14/docs/Bug-Trackers-and-Feedback-Channels.md#cxxml)
+Use native Java, a released CxFlow JAR (1.6.37+), and a trusted SAST-only profile with `CxXml` enabled. Keep the profile and everything it loads outside the checkout. Take the server, authentication and any custom `checkmarx.client-id` from that profile. Only append `--use-env-credentials` when the operator confirms the session's `CHECKMARX_USERNAME`, `CHECKMARX_PASSWORD` or `CHECKMARX_CLIENT_SECRET` belong to that server. For custom JVM settings or project names the installed CxFlow cannot resolve, ask for an XML export. [CxFlow credentials](https://github.com/checkmarx-ltd/cx-flow/blob/v1.7.14/docs/Tutorials.md#L382-L390) · [CxXml writer](https://github.com/checkmarx-ltd/cx-flow/blob/v1.7.14/docs/Bug-Trackers-and-Feedback-Channels.md#cxxml)
```sh
"$python_path" -I -S "$collector" --source-root "$source_root" cxsast "$scan_id" \
diff --git a/plugins/codex-security/skills/publish-findings/references/wiz-import.md b/plugins/codex-security/skills/publish-findings/references/wiz-import.md
index 736d7fc38..5743571f0 100644
--- a/plugins/codex-security/skills/publish-findings/references/wiz-import.md
+++ b/plugins/codex-security/skills/publish-findings/references/wiz-import.md
@@ -10,9 +10,9 @@ For Cloud preview, approval, upload, and recovery, follow the [Cloud publication
### Package vulnerabilities
-Supported inputs include a vulnerability finding, an array, `data.vulnerabilityFindings.nodes`, a downloaded vulnerability report, and JSONL package records. Keep `id`, `name`, `detailedName`, `vendorSeverity` (or `severity`), and `vulnerableAsset.id`, with available package and source metadata. Existing package occurrence IDs are unchanged.
+Supported inputs include a vulnerability finding, an array, `data.vulnerabilityFindings.nodes`, a downloaded vulnerability report, and JSONL package records. Keep `id`, `name`, `detailedName`, `vendorSeverity` (or `severity`), and `vulnerableAsset.id`, with available package and source metadata. Use the bare Wiz finding ID for a package occurrence.
-For a UI export, use **Vulnerability Findings → Save as → Report**, retaining repository and finding filters. Select **Repository Branch** instead of the default Virtual Machine selection, **JSON** or comma-separated **CSV**, and **Detailed** columns. Pass supported CSV reports directly to the command. Download the completed report; gzip is supported regardless of the filename extension. **Raw Event** on Code & Build Scans contains scan metadata, not findings. Do not create scheduled reports, notifications, or external storage unless requested.
+For a UI export, use **Vulnerability Findings → Save as → Report**, retaining repository and finding filters. Select **Repository Branch**, **JSON** or comma-separated **CSV**, and **Detailed** columns. Pass supported CSV reports directly to the command. Download the completed report; gzip is supported regardless of the filename extension. **Raw Event** on Code & Build Scans contains scan metadata, not findings. Do not create scheduled reports, notifications, or external storage unless requested.
The CSV profile requires `ID`, `Name`, `DetailedName`, `AssetID`, `WizURL`, `CloudPlatform`, and `CloudProviderURL`. `CloudPlatform` must identify GitHub, and `CloudProviderURL` must be a repository-branch URL. Its repository must match the selected Cloud repository or, for local import, a Git remote when parseable remotes are available. The importer uses the reported `ID` as occurrence identity and retains every original cell, including unknown columns, in `source_data.row`. It does not derive a branch or revision from the tree URL. Review excluded rows in the preview before importing.
@@ -34,7 +34,7 @@ Resolve conflicting platform or URL metadata for a repository ID before publishi
Normalized JSONL has one record per line with `source_finding_id` and `evidence` containing `title`, `severity`, and the original record in `source_data`. For SAST, secrets, and IaC, also set `evidence.details.kind` to `sast`, `secret`, or `iac` and set the verified `evidence.details.repository.url`. Use the same prefixed occurrence IDs as raw API imports.
-SAST, repository-secret, and IaC CSV reports still require a reviewed mapping of their actual headers into that profile. Preserve these family-specific details when present:
+SAST, repository-secret, and IaC CSV reports require a reviewed mapping of their actual headers into that profile. Preserve these family-specific details when present:
| Family | Evidence to retain |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------- |
diff --git a/plugins/codex-security/skills/publish-findings/scripts/collect_checkmarx.py b/plugins/codex-security/skills/publish-findings/scripts/collect_checkmarx.py
index 2ff6bd803..e86e49fb1 100644
--- a/plugins/codex-security/skills/publish-findings/scripts/collect_checkmarx.py
+++ b/plugins/codex-security/skills/publish-findings/scripts/collect_checkmarx.py
@@ -389,8 +389,6 @@ def main() -> int:
help="use the Checkmarx credentials selected for this profile's server",
)
args = parser.parse_args()
- if os.environ.get("CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS") != "1":
- parser.error("Set CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1 to enable external imports.")
if args.product == "one":
if not re.fullmatch(
r"[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}", args.scan_id, re.I | re.ASCII
diff --git a/plugins/codex-security/skills/triage-finding/references/ticket-intake.md b/plugins/codex-security/skills/triage-finding/references/ticket-intake.md
index 8383241c7..14808a981 100644
--- a/plugins/codex-security/skills/triage-finding/references/ticket-intake.md
+++ b/plugins/codex-security/skills/triage-finding/references/ticket-intake.md
@@ -6,7 +6,7 @@ Retrieve the requested content before normalization. Do not infer inaccessible t
By default, use the native [Atlassian](app://asdk_app_6a83901dde988191b3f3cefdcc19acfa) app for Jira. Resolve identity and site with `atlassianUserInfo` and `getAccessibleAtlassianResources`; keep that connection and site for the selected set. Ask when the source is ambiguous.
-Use live schemas: `getJiraIssue` for exact issues and `searchJiraIssuesUsingJql` for collections. Exhaust returned pages. Discover deferred metadata through `discover` and `executeRead`; intake does not invoke write tools.
+Use `getJiraIssue` for exact issues and `searchJiraIssuesUsingJql` for collections. Exhaust the JQL result pages by following `nextPageToken` until `isLast` is true. When the request includes comments, use `listJiraIssueComments` and advance `startAt` until `isLast` is true. Preserve each comment’s visibility and whether it is an internal note. Use only read operations for intake. Discover deferred metadata through `discover` and `executeRead`.
Use natural-language search to discover a site, project, issue family, or first key from a vague request, then use JQL or exact fetches. Keep user-supplied JQL intact. Order queries you build by a stable field and preserve the JQL as provenance. Jira text search tokenizes punctuation: if an exact marker gives no results, search a stable token and filter summaries for the exact family when those fields are authorized.
@@ -16,7 +16,7 @@ For Linear, use the native app by default. If the user selects an authenticated
## Linear parents and sub-issues
-Fetch the supplied parent. When the request includes its sub-issues or a finding collection organized under it, list the relevant descendants with the parent filter, exhausting pagination.
+Fetch the supplied parent. For requested sub-issues, use `list_issues` with `parentId` and follow every page of direct children. Repeat for each parent at deeper requested levels.
Honor the requested collection scope across depths. If it is unclear whether descendants are included, show the available set and clarify once rather than asking at every level. Fetch each selected issue's full content before triage.
diff --git a/plugins/codex-security/tests/test_collect_checkmarx.py b/plugins/codex-security/tests/test_collect_checkmarx.py
index b2943dc03..41b9a1bc0 100644
--- a/plugins/codex-security/tests/test_collect_checkmarx.py
+++ b/plugins/codex-security/tests/test_collect_checkmarx.py
@@ -36,7 +36,6 @@ def capture_dir(monkeypatch, tmp_path):
source.mkdir()
monkeypatch.chdir(source)
monkeypatch.setattr(tempfile, "tempdir", str(directory))
- monkeypatch.setenv("CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS", "1")
for setting in ("CX_CONFIG_FILE_PATH", "CX_APIKEY", "CX_CLIENT_ID", "CX_CLIENT_SECRET"):
monkeypatch.delenv(setting, raising=False)
return directory
@@ -392,18 +391,10 @@ def test_one_discards_failed_exports(failure, capture_dir, one_args, monkeypatch
assert not list(capture_dir.iterdir())
[email protected]("refusal", ["opt-in disabled", "relative config"])
@pytest.mark.cross_platform
-def test_one_refuses_before_vendor_invocation(refusal, one_args, monkeypatch, reject):
- if refusal == "relative config":
- monkeypatch.setenv("CX_CONFIG_FILE_PATH", "my-config.yaml")
- reject(one_args, "CX_CONFIG_FILE_PATH to a trusted absolute path")
- else:
- monkeypatch.delenv("CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS")
- monkeypatch.setattr(
- Path, "is_file", lambda path: pytest.fail(f"Probed {path} before opt-in")
- )
- reject(one_args, "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS")
+def test_one_refuses_relative_config_before_vendor_invocation(one_args, monkeypatch, reject):
+ monkeypatch.setenv("CX_CONFIG_FILE_PATH", "my-config.yaml")
+ reject(one_args, "CX_CONFIG_FILE_PATH to a trusted absolute path")
@pytest.mark.parametrize("use_env_credentials", [False, True])
diff --git a/sdk/typescript/README.md b/sdk/typescript/README.md
index c5996754c..dfc549ff2 100644
--- a/sdk/typescript/README.md
+++ b/sdk/typescript/README.md
@@ -657,25 +657,53 @@ and does not describe failed or unfinished scans as clean.
### Publish findings to Cloud
-`publish scan --to cloud` uploads selected findings to Codex Security Cloud.
-It requires ChatGPT credentials; inference API keys and AWS credentials do not
-grant Cloud access. See [Cloud publication](docs/cli.md#publish-completed-scans)
-for setup and review steps, or [Linear publication](docs/cli.md#publish-completed-scans-to-linear)
-for issue creation.
+Use `publish scan --to cloud` for completed Codex Security scans or a Codex
+Security findings CSV. Preview either input offline with `--dry-run`. Uploads
+require a file-backed ChatGPT login. [Cloud publication](docs/cli.md#publish-completed-scans)
+
+For a report exported by a scanner, see [Import external findings](#import-external-findings).
+For issue tracking, see [Linear publication](docs/cli.md#publish-completed-scans-to-linear).
### Import external findings
-External vendor imports are opt-in. Set `CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1`
-to enable `publish findings`, `findings imported`, `import sonar`, `import github-advisories`, and
-the SDK's external publication, local import/readback, Sonar issue collection, and advisory acquisition
-APIs. They are disabled otherwise; CLI commands are hidden from help and schemas.
-SDK callers can supply the flag through the existing per-call
-`dependencies.environment`, or in `options.environment` for `collectSonarIssues(options)`.
-For an SDK import of selected Sonar issues, pass their keys in `options.issueKeys`.
+For a saved scanner report, call `prepareLocalExternalImport` for a checkout
+or `prepareExternalPublication` for a connected Cloud repository. Review the
+returned `preview`, then call `import()` to save locally or `publish()` to
+upload. The [scanner import guides](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/README.md)
+list the supported report formats and destinations for each provider.
+
+For normalized evidence, use `prepareNormalizedLocalImport(findings, options)`
+or `prepareNormalizedExternalPublication(findings, options)` and review the
+preview in the same way. Cloud file imports use `ExternalPublicationOptions`,
+and normalized Cloud imports use `NormalizedExternalPublicationOptions`. Keep
+Cloud receipts and saved requests when retrying an interrupted submission.
+
+Use `listLocalExternalFindings({ repository })` to read saved scanner evidence.
+It starts unassessed. Reimporting the same repository, provider, source key
+and finding ID updates that record. Records omitted from the export remain stored.
+
+A local SDK import with only excluded records returns the exclusions and zero
+writes. The CLI exits 2 in that case. When Cloud preparation throws
+`NoPublishableFindingsError`, inspect its `selection` for the read count,
+exclusions and scanner diagnostics. A clean empty report needs no upload.
+
+File imports forward repository references from the reader automatically. With
+`prepareNormalizedLocalImport()`, supply additional known references in the
+third argument's `sourceRepositories` when they are absent from
+`evidence.details.repository.url`. For a known GitHub custom host, include
+`platform: "github"`, for example `{ sourceRepositories: [{ url:
+"https://git.example.test/example/project", platform: "github" }] }`. Named Wiz
+reports carry this platform in their repository inventory. If you export only the
+normalized finding rows to JSONL, supply that metadata separately; the original
+finding evidence does not include the surrounding inventory.
+
+#### Collect and normalize scanner evidence
+
+To collect selected Sonar issues, pass their keys to `collectSonarIssues` in `options.issueKeys`.
Omit `issueKeys` to collect the project's open security issues. An empty list is rejected.
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.
@@ -694,24 +722,9 @@ Use `normalizeSelectedSemgrepPlatformFindings` for selected SAST findings from s
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).
Use `selectSemgrepPlatformFindings` to [save a selection for the local CLI](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/semgrep.md#existing-platform-findings).
Use `collectSemgrepPlatformFindings` to [collect one project at an explicit ref](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/semgrep.md#collect-a-platform-project-and-branch) for a single product (default `sast`).
-Use `import snyk` to [collect existing Open Source or Code issues](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/snyk.md#existing-issues-from-snyk) for local import or Cloud publication.
+
+Use `collectSnykIssues` to [collect existing Open Source or Code issues](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/snyk.md#existing-issues-from-snyk) for local import or Cloud publication.
For a private repository with a verified SCM, pass its URL and `platform: "gitlab"` or `"github"` in `sourceRepositories` to match standard SSH clone URLs.
-This does not affect scan publishing or the existing GitHub alert collector.
-
-The SDK also exposes `prepareExternalPublication(file, options)` for supported
-vendor exports and `prepareNormalizedExternalPublication(findings, options)` for
-normalized external evidence from any provider in the Cloud import contract.
-The normalized API accepts `NormalizedExternalPublicationOptions`; file readers
-use `ExternalPublicationOptions` for their supported formats. Both resolve the Cloud repository and return a
-`preview` plus a separate `publish()` operation. Inspect the preview before
-calling `publish()`. Imported evidence remains not assessed by Codex, and saved
-requests and receipts support retries after interruption.
-
-When a parsed selection has no publishable findings, preparation throws
-`NoPublishableFindingsError`. Inspect its `selection` for the read count,
-exclusions and scanner diagnostics. A clean empty report needs no upload;
-failed scans and excluded records need attention. Previously imported findings
-remain open.
To inspect dependency vulnerabilities in a saved Trivy schema-v2 repository or filesystem
report, call `readTrivyFindings` with the JSON or gzip path. Use `normalizeTrivyFindings`
@@ -728,29 +741,6 @@ const { findings, excluded, report } = await readTrivyFindings(
);
```
-For CLI examples and supported input formats, see the
-[scanner import guides](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/README.md).
-
-The SDK's `prepareLocalExternalImport(file, options)` returns a `preview` and a
-separate `import()` operation. `prepareNormalizedLocalImport(findings,
-options)` accepts already normalized evidence, and
-`listLocalExternalFindings({ repository })` reads the stored records. Imports
-remain unassessed source evidence, separate from native scan findings. Repeated
-imports update the same repository/provider/source-key/source-ID record; omitted
-records remain stored, and unknown evidence fields are not inferred. A local
-SDK import with only excluded records returns the exclusions and zero write
-counts. The CLI exits 2 for that result so automation can detect it.
-
-File imports forward repository references from the reader automatically. With
-`prepareNormalizedLocalImport()`, supply additional known references in the
-third argument's `sourceRepositories` when they are absent from
-`evidence.details.repository.url`. For a known GitHub custom host, include
-`platform: "github"`, for example `{ sourceRepositories: [{ url:
-"https://git.example.test/example/project", platform: "github" }] }`. Named Wiz
-reports carry this platform in their repository inventory. If you export only the
-normalized finding rows to JSONL, supply that metadata separately; the original
-finding evidence does not include the surrounding inventory.
-
## Findings storage and deduplication
Saved-scan deduplication uses local SQLite directly:
diff --git a/sdk/typescript/docs/cli.md b/sdk/typescript/docs/cli.md
index 4b8bb48d5..5e0288ee1 100644
--- a/sdk/typescript/docs/cli.md
+++ b/sdk/typescript/docs/cli.md
@@ -1032,27 +1032,26 @@ For filesystem and approval behavior, see the
### Environment variables
-| Variable | Effect |
-| --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
-| `OPENAI_API_KEY`, `CODEX_API_KEY` | Scan credentials; the first takes precedence. |
-| `CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS` | Set to `1` to enable vendor finding imports, imported-findings readback, and GitHub advisory acquisition; disabled otherwise. |
-| `CODEX_SECURITY_STATE_DIR` | Private history, database, and default artifacts. |
-| `CODEX_SECURITY_PROJECT_CONFIG` | Selected project file; `-c` overrides it. |
-| `CODEX_HOME` | Ambient Codex home; default `~/.codex`. |
-| `CODEX_CLI_PATH` | Codex executable for login, setup, scans, and workers. |
-| `PYTHON` | Python interpreter unless an explicit option overrides it. |
-| `CODEX_SECURITY_LOG_LEVEL` | CLI diagnostics; `debug` enables verbose output. |
-| `LOG_LEVEL` | Fallback if `CODEX_SECURITY_LOG_LEVEL` is unset or blank. |
-| `CODEX_SECURITY_LINEAR_TEAM`, `CODEX_SECURITY_LINEAR_PROJECT` | Default publication destination. |
-| `CODEX_SECURITY_LINEAR_API_KEY` | Linear personal API key. |
-| `CODEX_SECURITY_CLOUD_BASE_URL` | Cloud API root for discovery, imports, and scan publication. Defaults to `https://chatgpt.com/backend-api/aardvark`. |
-| `CODEX_SECURITY_CLOUD_WEB_URL` | Cloud app URL for repository links when an alternate deployment serves its UI separately. |
-| `CODEX_SECURITY_EMBEDDINGS_URL` | Local dedupe and findings service embeddings endpoint. |
-| `GH_HOST` | GitHub Enterprise host for bulk discovery. |
-| `CODEX_SECURITY_NO_UPDATE_NOTICE`, `NO_UPDATE_NOTIFIER` | Disable interactive update notices. |
-| `CODEX_SECURITY_NPM_REGISTRY`, `npm_config_registry`, `NPM_CONFIG_REGISTRY` | Update registry, in precedence order. |
-| `CI` | Disable interactive update notices. |
-| `NO_COLOR`, `TERM` | Disable colored history when `NO_COLOR` is defined or `TERM=dumb`. |
+| Variable | Effect |
+| --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
+| `OPENAI_API_KEY`, `CODEX_API_KEY` | Scan credentials; the first takes precedence. |
+| `CODEX_SECURITY_STATE_DIR` | Private history, database, and default artifacts. |
+| `CODEX_SECURITY_PROJECT_CONFIG` | Selected project file; `-c` overrides it. |
+| `CODEX_HOME` | Ambient Codex home; default `~/.codex`. |
+| `CODEX_CLI_PATH` | Codex executable for login, setup, scans, and workers. |
+| `PYTHON` | Python interpreter unless an explicit option overrides it. |
+| `CODEX_SECURITY_LOG_LEVEL` | CLI diagnostics; `debug` enables verbose output. |
+| `LOG_LEVEL` | Fallback if `CODEX_SECURITY_LOG_LEVEL` is unset or blank. |
+| `CODEX_SECURITY_LINEAR_TEAM`, `CODEX_SECURITY_LINEAR_PROJECT` | Default publication destination. |
+| `CODEX_SECURITY_LINEAR_API_KEY` | Linear personal API key. |
+| `CODEX_SECURITY_CLOUD_BASE_URL` | Cloud API root for discovery, imports, and scan publication. Defaults to `https://chatgpt.com/backend-api/aardvark`. |
+| `CODEX_SECURITY_CLOUD_WEB_URL` | Cloud app URL for repository links when an alternate deployment serves its UI separately. |
+| `CODEX_SECURITY_EMBEDDINGS_URL` | Local dedupe and findings service embeddings endpoint. |
+| `GH_HOST` | GitHub Enterprise host for bulk discovery. |
+| `CODEX_SECURITY_NO_UPDATE_NOTICE`, `NO_UPDATE_NOTIFIER` | Disable interactive update notices. |
+| `CODEX_SECURITY_NPM_REGISTRY`, `npm_config_registry`, `NPM_CONFIG_REGISTRY` | Update registry, in precedence order. |
+| `CI` | Disable interactive update notices. |
+| `NO_COLOR`, `TERM` | Disable colored history when `NO_COLOR` is defined or `TERM=dumb`. |
Custom Codex executables need thread source attribution for `exec` and
`app-server` (Codex 0.149.1+). On Windows, use a native `.exe` or `.com`;
@@ -1400,13 +1399,6 @@ Choose the command by what you want to keep. [Scanner guides](https://github.com
| Collect live Sonar issues | [`import sonar --dry-run`](#import-sonarqube-cloud-issues) | SonarQube Cloud during collection | The `capture` field gives a private file path. Replay it to save locally or save locally and publish to Cloud. |
| Save Codex Security findings CSV or JSON as a completed scan | [`scan import`](#import-findings-as-a-saved-scan) | None | `scans list --scan-root DIR --json` shows imports under the artifact root. |
-Set `CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1` to enable `publish findings`,
-`findings imported`, `import sonar`, `import semgrep`, `import snyk`, and `import github-advisories`. Only `1`
-enables these commands in help and schemas. The SDK's corresponding operations
-require the flag in their effective environment. Pure normalizers, file readers,
-and the existing `import github` alert collector remain available independently.
-Disabling the flag retains saved records.
-
For `publish findings`, `--to` is required. With `--to local`, `--repository`
takes a checkout path. Select the reader with `--provider` and give the source a stable `--source-key`.
The reader detects the file format. `--format json` selects the output format. A local preview checks the file offline without
@@ -1435,7 +1427,7 @@ exits with status 1. Local imports can retain evidence that exceeds Cloud's per-
Preview the same file and source key again for the intended destination before
publishing. Semgrep Guardian captures support local import only. Both Web API
formats, a selected SAST capture and a full project collection, support local
-and Cloud import. The [Semgrep input selector](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/semgrep.md) lists the four routes.
+and Cloud import. Choose the [Semgrep import method](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/semgrep.md) that matches your source.
## Import Trivy dependency findings
@@ -1711,15 +1703,16 @@ Choose a destination authorized to receive that content. Local history records
successful issue IDs separately from sealed artifacts. The CLI and the plugin's
finding-tracking workflow share these records when using the same Codex Security
state directory. Accepted writes remain recorded even if a later issue read fails.
-The shared-history migration preserves existing Linear receipts and replaces their
-old table. Upgrade CLI and plugin installations together when they share state;
-older publishers cannot write to the migrated database.
-
-Republishing creates duplicates unless `--skip-existing` finds a recorded success
-for that occurrence, team, and project, including issues created or reused through
-the plugin. It does not check remote issues or cover
-unrecorded/concurrent publication. After interruption, inspect the handoff,
-evidence, and destination before retrying.
+
+By default, publishing the same scan again creates new issues. With
+`--skip-existing`, the CLI skips occurrences with a recorded success for the
+same team and project. This includes issues the plugin created or reused.
+The CLI checks local history only. After an interrupted or concurrent run,
+check Linear for an existing issue before retrying.
+
+If the CLI and plugin share a database from an older installation, upgrade
+both together. The shared history preserves existing Linear receipts, but
+publishers that require the old table can no longer record new ones.
```ts
import { publishScan } from "@openai/codex-security";
diff --git a/sdk/typescript/docs/findings-service.md b/sdk/typescript/docs/findings-service.md
index ef27f7ffb..e89635ede 100644
--- a/sdk/typescript/docs/findings-service.md
+++ b/sdk/typescript/docs/findings-service.md
@@ -25,9 +25,7 @@ codex-security dedupe --scan SCAN_ID --findings-url https://findings.example.com
```
Replace `SCAN_ID` with the ID of a completed scan, or use `latest` for the
-current repository. For local setup or migration, see
-[embedding credentials and backups](#local-embeddings-and-backups) or
-[moving from the bundled service](#local-service-removal).
+current repository. For local setup, see [embedding credentials and backups](#local-embeddings-and-backups).
The CLI prepares missing or stale embeddings for the local repository's stored
findings, searches them, and saves reviewed duplicate groups in the workbench
@@ -358,8 +356,7 @@ results, and these callbacks add no network destination or separate files.
## Compatible endpoint contract
-The retained HTTP clients use these endpoints on the supplied base URL,
-preserving its base path:
+The HTTP client appends these paths to the configured base URL, preserving any base path.
| Method | Path | Response |
| ------ | --------------------------------------- | ------------------------------------------------------------------------ |
@@ -371,8 +368,8 @@ Publication sends `{findings, repositoryId}`. Candidate requests include either
`repositoryId` or `allRepositories=true`. Group writes send
`{groups: [[findingId, ...], ...]}`; repeated membership must be idempotent for
workflow retries. Both POST endpoints must persist their writes before
-acknowledging them and return a JSON body. An explicit URL selects this remote
-contract instead of local SQLite. This package no longer implements or hosts the HTTP endpoints.
+acknowledging them and return a JSON body. Supply your service’s base URL to use
+these endpoints. With no URL, deduplication uses local SQLite.
SDK findings client failures preserve the endpoint's error code and message with
the HTTP status. Other responses retain the HTTP-status diagnostic. Retry
@@ -382,20 +379,16 @@ behavior uses the HTTP status and `Retry-After`.
### Local service removal
-The `serve` command (including `--port`), `start:server` script,
-`dist/server/index.js` entrypoint, `startFindingsServer` SDK export, browser
-dashboard, and findings-service Compose deployment have been removed.
-`HOST`, `PORT`, and `CODEX_SECURITY_FINDINGS_IMAGE` no longer configure a bundled
-service. The dashboard storage projection is also removed.
+If you previously used the bundled HTTP service, back up the SQLite state
+directory or service volume. Set `CODEX_SECURITY_STATE_DIR` to the directory
+that contains the existing database to keep using its saved scans, findings,
+and duplicate groups. For clients that need HTTP, configure a service that
+implements the [endpoint contract](#compatible-endpoint-contract).
-Existing SQLite databases, migrations, saved scans, findings, and duplicate
-groups are retained. No data migration or deletion is performed. Keep any
-existing service volume or state directory and back it up before changing
-deployments; local deduplication uses the database selected by
-`CODEX_SECURITY_STATE_DIR`, not a separate service volume automatically.
+### Use SQLite from the SDK
-`@openai/codex-security/server` continues to export `OpenAiFindingEmbedder`,
-`SqliteFindingsStore`, and their storage types for direct storage users.
+`@openai/codex-security/server` exports `OpenAiFindingEmbedder`,
+`SqliteFindingsStore`, and their storage types.
For direct embedding/storage integrations, `OpenAiFindingEmbedder` accepts a
static key or `() => string | Promise<string>` as its first argument. It calls
diff --git a/sdk/typescript/scripts/package-dist-files.mjs b/sdk/typescript/scripts/package-dist-files.mjs
index 45a3acb26..30e3ffa2e 100644
--- a/sdk/typescript/scripts/package-dist-files.mjs
+++ b/sdk/typescript/scripts/package-dist-files.mjs
@@ -62,7 +62,6 @@ const distModules = [
"private-finding-import",
"external-import-contract",
"external-import-models",
- "external-imports-feature",
"endor-findings",
"blackduck-findings",
"wiz-csv",
diff --git a/sdk/typescript/scripts/test-timings.json b/sdk/typescript/scripts/test-timings.json
index 5c8a2910d..5390417e3 100644
--- a/sdk/typescript/scripts/test-timings.json
+++ b/sdk/typescript/scripts/test-timings.json
@@ -244,7 +244,7 @@
"darwin": 9.2,
"win32": 15.6
},
- "cli-external-imports-feature.test.ts": {
+ "cli-external-imports.test.ts": {
"linux": 3,
"win32": 4.9,
"darwin": 3.1
@@ -589,11 +589,6 @@
"darwin": 9.2,
"win32": 21.9
},
- "external-imports-feature.test.ts": {
- "linux": 0.1,
- "win32": 0.3,
- "darwin": 0.1
- },
"feedback.test.ts": {
"linux": 0.6,
"darwin": 0.5,
diff --git a/sdk/typescript/src/api.ts b/sdk/typescript/src/api.ts
index d1aeac404..3da0dbb24 100644
--- a/sdk/typescript/src/api.ts
+++ b/sdk/typescript/src/api.ts
@@ -182,7 +182,6 @@ import {
ScanCostLimitExceededError,
ScanInterruptedError,
} from "./errors.js";
-import { forwardExternalImportSetting } from "./external-imports-feature.js";
import {
knowledgeBaseProtectedRoots,
prepareKnowledgeBase,
@@ -6500,7 +6499,6 @@ function withoutProviderKey(
for (const name of Object.keys(child)) {
if (name.toUpperCase() === key.toUpperCase()) delete child[name];
}
- forwardExternalImportSetting(environment, child);
return child;
}
@@ -6558,7 +6556,6 @@ export function selectedScanEnvironment(
),
);
}
- forwardExternalImportSetting(environment, selected);
return selected;
}
@@ -7318,13 +7315,11 @@ function standaloneFindingForPrompt(finding: string | object): string {
export function definedEnvironment(
environment: ProcessEnvironment,
): Record<string, string> {
- const child = Object.fromEntries(
+ return Object.fromEntries(
Object.entries(environment).filter(
(entry): entry is [string, string] => entry[1] !== undefined,
),
);
- forwardExternalImportSetting(environment, child);
- return child;
}
function withoutCodexHome(
diff --git a/sdk/typescript/src/auth.ts b/sdk/typescript/src/auth.ts
index 5fa15597a..e1f87d7ad 100644
--- a/sdk/typescript/src/auth.ts
+++ b/sdk/typescript/src/auth.ts
@@ -4,7 +4,6 @@ import { readFile } from "node:fs/promises";
import { homedir } from "node:os";
import { join, resolve } from "node:path";
import { parse } from "smol-toml";
-import { forwardExternalImportSetting } from "./external-imports-feature.js";
import type { JsonObject } from "./config.js";
import {
CodexSecurityError,
@@ -38,14 +37,12 @@ export function environmentEntry(
export function withoutOpenAiApiKeys<Value>(
environment: Record<string, Value>,
): Record<string, Value> {
- const child = Object.fromEntries(
+ return Object.fromEntries(
Object.entries(environment).filter(
([name]) =>
!["OPENAI_API_KEY", "CODEX_API_KEY"].includes(name.toUpperCase()),
),
);
- forwardExternalImportSetting(environment, child);
- return child;
}
/** @internal */
diff --git a/sdk/typescript/src/cli.ts b/sdk/typescript/src/cli.ts
index e80edd705..9bba63c6d 100644
--- a/sdk/typescript/src/cli.ts
+++ b/sdk/typescript/src/cli.ts
@@ -127,10 +127,6 @@ import {
} from "./external-findings-publish.js";
import { prepareLocalExternalImport } from "./external-findings-import.js";
import { validateInspectorProjectMapping } from "./inspector-findings.js";
-import {
- externalImportsDisabledMessage,
- externalImportsEnabled,
-} from "./external-imports-feature.js";
import { listLocalExternalFindings } from "./external-findings-local.js";
import type { collectSonarIssues } from "./sonar-collector.js";
import { prepareSonarImport } from "./sonar-import.js";
@@ -430,13 +426,6 @@ const execFile = promisify(execFileCallback);
const WINDOWS_NETWORK_PATH = /^[\\/]{2}/u;
const WINDOWS_LOCAL_DEVICE_ROOT =
/^[\\/]{2}[?.][\\/](?:[A-Za-z]:|Volume\{[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\}|GLOBALROOT[\\/]Device[\\/]HarddiskVolume[0-9]+)(?=[\\/]|$)/iu;
-const FRAMEWORK_ACTIONS = new Set([
- "--llms",
- "--llms-full",
- "--mcp",
- "--update",
- "--incur-update-check",
-]);
const FRAMEWORK_VALUE_OPTIONS = new Set([
"--format",
"--filter-output",
@@ -2193,7 +2182,6 @@ export async function main(
errorOutput: Writable = process.stderr,
dependencies: CliDependencies = DEFAULT_DEPENDENCIES,
): Promise<number> {
- const importsEnabled = externalImportsEnabled(dependencies.environment);
const remediationOperation =
argv[0] === "patch"
? "patch"
@@ -2633,60 +2621,56 @@ export async function main(
);
},
});
- if (importsEnabled) {
- findingFeedback.command("imported", {
- description: "List imported vendor evidence for a local repository.",
- mcp: false,
- args: z.object({
- repository: z
- .string()
- .optional()
- .describe(
- "Local repository to inspect (default: current directory).",
- ),
- }),
- output: z.record(z.string(), z.unknown()).optional(),
- async run({ args, format, error: incurError }) {
- const controller = new AbortController();
- const removeSignals = listenForAbort(dependencies, controller);
- try {
- const repository = resolveCliPath(
- dependencies.currentDirectory(),
- args.repository ?? ".",
- );
- const findings = await (
- dependencies.listLocalExternalFindings ?? listLocalExternalFindings
- )(
- { repository },
- {
- environment: dependencies.environment,
- signal: controller.signal,
- },
- );
- return { repository, findings };
- } catch (error) {
- if (controller.signal.aborted) {
- exitCode = controller.signal.reason === "SIGINT" ? 130 : 143;
- if (
- argv.includes("--full-output") &&
- (format === "json" || format === "jsonl")
- ) {
- structuredError = true;
- return incurError({
- code: "FINDINGS_READ_FAILED",
- message: diagnosticValue(error),
- exitCode,
- });
- }
- return;
+ findingFeedback.command("imported", {
+ description: "List imported vendor evidence for a local repository.",
+ mcp: false,
+ args: z.object({
+ repository: z
+ .string()
+ .optional()
+ .describe("Local repository to inspect (default: current directory)."),
+ }),
+ output: z.record(z.string(), z.unknown()).optional(),
+ async run({ args, format, error: incurError }) {
+ const controller = new AbortController();
+ const removeSignals = listenForAbort(dependencies, controller);
+ try {
+ const repository = resolveCliPath(
+ dependencies.currentDirectory(),
+ args.repository ?? ".",
+ );
+ const findings = await (
+ dependencies.listLocalExternalFindings ?? listLocalExternalFindings
+ )(
+ { repository },
+ {
+ environment: dependencies.environment,
+ signal: controller.signal,
+ },
+ );
+ return { repository, findings };
+ } catch (error) {
+ if (controller.signal.aborted) {
+ exitCode = controller.signal.reason === "SIGINT" ? 130 : 143;
+ if (
+ argv.includes("--full-output") &&
+ (format === "json" || format === "jsonl")
+ ) {
+ structuredError = true;
+ return incurError({
+ code: "FINDINGS_READ_FAILED",
+ message: diagnosticValue(error),
+ exitCode,
+ });
}
- throw error;
- } finally {
- removeSignals();
+ return;
}
- },
- });
- }
+ throw error;
+ } finally {
+ removeSignals();
+ }
+ },
+ });
const scanHistory = Cli.create("scans", {
description: "Review saved scans (default: list).",
})
@@ -3835,9 +3819,8 @@ export async function main(
});
},
});
- let disabledImportInvocation = false;
- function registerFindingPublication() {
- publication.command("findings", {
+ publication
+ .command("findings", {
description:
"Preview and import a saved scanner report locally or to Cloud.",
hint: "Choose your scanner with --provider. Reuse --source-key for later imports from the same source. See the scanner import guide for supported formats, repository setup, and export examples: https://github.com/openai/codex-security/blob/main/docs/scanner-imports/README.md. Gzip files are supported. Use --to local to save unassessed findings without a Cloud login. Use --full-output with --format json or --format jsonl.\nExample: codex-security publish findings selected-wiz.json --to local --repository ./project --provider wiz --source-key TENANT_ID/vulnerability-finding --dry-run --format json",
@@ -3989,8 +3972,6 @@ export async function main(
);
};
try {
- if (!importsEnabled)
- throw new CodexSecurityError(externalImportsDisabledMessage);
const { inspectorProjectArn, ...readerOptions } = options;
let inspectorProjectMap: Map<string, string> | undefined;
if (inspectorProjectArn !== undefined) {
@@ -4193,47 +4174,44 @@ export async function main(
}
});
},
+ })
+ .command("check", {
+ description:
+ "Check saved scan history and Linear access without creating issues.",
+ mcp: false,
+ args: z.object({
+ scanDir: z.string().describe("Completed scan directory."),
+ }),
+ options: PUBLICATION_DESTINATION_OPTIONS,
+ output: z.record(z.string(), z.unknown()).optional(),
+ async run({ args, options }) {
+ return await withTerminalErrorsHandled(errorOutput, async () => {
+ const controller = new AbortController();
+ const removeSignals = listenForAbort(dependencies, controller);
+ try {
+ const result = await (
+ dependencies.checkScanPublication ?? checkScanPublication
+ )(resolveCliPath(dependencies.currentDirectory(), args.scanDir), {
+ ...publicationDestination(options, dependencies.environment),
+ signal: controller.signal,
+ });
+ controller.signal.throwIfAborted();
+ return { ...result };
+ } catch (error) {
+ reportPublicationError(error, controller.signal.reason);
+ throw error;
+ } finally {
+ removeSignals();
+ }
+ });
+ },
});
- }
- if (importsEnabled) registerFindingPublication();
- publication.command("check", {
- description:
- "Check saved scan history and Linear access without creating issues.",
- mcp: false,
- args: z.object({
- scanDir: z.string().describe("Completed scan directory."),
- }),
- options: PUBLICATION_DESTINATION_OPTIONS,
- output: z.record(z.string(), z.unknown()).optional(),
- async run({ args, options }) {
- return await withTerminalErrorsHandled(errorOutput, async () => {
- const controller = new AbortController();
- const removeSignals = listenForAbort(dependencies, controller);
- try {
- const result = await (
- dependencies.checkScanPublication ?? checkScanPublication
- )(resolveCliPath(dependencies.currentDirectory(), args.scanDir), {
- ...publicationDestination(options, dependencies.environment),
- signal: controller.signal,
- });
- controller.signal.throwIfAborted();
- return { ...result };
- } catch (error) {
- reportPublicationError(error, controller.signal.reason);
- throw error;
- } finally {
- removeSignals();
- }
- });
- },
- });
const imports = Cli.create("import", {
- description: importsEnabled
- ? "Import Sonar security issues or read hosted Semgrep, Snyk, and GitHub findings."
- : "Read GitHub code scanning alerts.",
+ description:
+ "Import Sonar security issues or read hosted Semgrep, Snyk, and GitHub findings.",
}).command("github", {
description: "Read GitHub code scanning alerts without changing GitHub.",
- hint: `${importsEnabled ? "Save complete --format json output for publish findings --provider github. " : ""}This command reads code-scanning alerts; Dependabot and secret-scanning alerts are not supported. To save CSV or JSON findings as a local scan, use codex-security scan import --help.`,
+ hint: "Save complete --format json output for publish findings --provider github. This command reads code-scanning alerts; Dependabot and secret-scanning alerts are not supported. To save CSV or JSON findings as a local scan, use codex-security scan import --help.",
destructive: false,
mcp: false,
args: z.object({
@@ -4311,52 +4289,54 @@ export async function main(
}
},
});
- function registerOptInCollectors() {
- async function collect<T>(
- provider: "GitHub advisory" | "Semgrep" | "Snyk",
- fail: (error: {
- code: string;
- message: string;
- exitCode: number;
- }) => never,
- run: (signal: AbortSignal) => Promise<T>,
- ) {
- const controller = new AbortController();
- const removeSignals = listenForAbort(dependencies, controller);
- try {
- if (!importsEnabled)
- throw new CodexSecurityError(externalImportsDisabledMessage);
- return await run(controller.signal);
- } catch (error) {
- const interrupted = interruptedExitCode(controller.signal);
- exitCode = interrupted ?? 2;
- const message = diagnosticValue(error);
- const diagnostic = interrupted
- ? `${provider} import ${interrupted === 130 ? "canceled" : "terminated"}.`
- : message;
- const terminalDiagnostic =
- provider === "Semgrep" || provider === "Snyk"
- ? escapeTerminalText(diagnostic)
- : diagnostic;
- errorOutput.write(`codex-security: ${terminalDiagnostic}\n`);
- if (argv.includes("--full-output")) {
- structuredError = true;
- return fail({
- code:
- provider === "GitHub advisory"
- ? "GITHUB_IMPORT_FAILED"
- : "HOSTED_IMPORT_FAILED",
- message:
- provider === "GitHub advisory" ? message : errorMessage(error),
- exitCode,
- });
- }
- return undefined;
- } finally {
- removeSignals();
+ async function collectHostedFindings<T>(
+ provider: "GitHub advisory" | "Semgrep" | "Snyk",
+ fail: (error: { code: string; message: string; exitCode: number }) => never,
+ run: (signal: AbortSignal) => Promise<T>,
+ ) {
+ const controller = new AbortController();
+ const removeSignals = listenForAbort(dependencies, controller);
+ try {
+ return await run(controller.signal);
+ } catch (error) {
+ const interrupted = interruptedExitCode(controller.signal);
+ exitCode = interrupted ?? 2;
+ const message = diagnosticValue(error);
+ const diagnostic = interrupted
+ ? `${provider} import ${interrupted === 130 ? "canceled" : "terminated"}.`
+ : message;
+ const terminalDiagnostic =
+ provider === "Semgrep" || provider === "Snyk"
+ ? escapeTerminalText(diagnostic)
+ : diagnostic;
+ errorOutput.write(`codex-security: ${terminalDiagnostic}\n`);
+ if (argv.includes("--full-output")) {
+ structuredError = true;
+ return fail({
+ code:
+ provider === "GitHub advisory"
+ ? "GITHUB_IMPORT_FAILED"
+ : "HOSTED_IMPORT_FAILED",
+ message:
+ provider === "GitHub advisory" ? message : errorMessage(error),
+ exitCode,
+ });
}
+ return undefined;
+ } finally {
+ removeSignals();
}
- imports.command("github-advisories", {
+ }
+ const hostedScannerDependencies = {
+ environment: dependencies.environment,
+ fetch: dependencies.hostedScannerFetch,
+ };
+ function setHostedOutputFormat(format?: string) {
+ escapeFrameworkOutput =
+ format === "md" || (format === "toon" && output.isTTY === true);
+ }
+ imports
+ .command("github-advisories", {
description: "Read GitHub security advisories without changing GitHub.",
hint: "Defaults to published repository advisories. Use --github-advisory-source global with explicit --github-advisory IDs to select public database entries. Advisories do not establish an installed dependency or applicability to the selected repository.",
destructive: false,
@@ -4408,7 +4388,7 @@ export async function main(
)
.optional(),
run: ({ args, options, error }) =>
- collect("GitHub advisory", error, (signal) =>
+ collectHostedFindings("GitHub advisory", error, (signal) =>
(dependencies.importGitHubAdvisories ?? importGitHubAdvisories)(
{
repository: args.repository,
@@ -4423,36 +4403,8 @@ export async function main(
},
),
),
- });
- const http = {
- environment: dependencies.environment,
- fetch: dependencies.hostedScannerFetch,
- };
- function setHostedOutputFormat(format?: string) {
- escapeFrameworkOutput =
- format === "md" || (format === "toon" && output.isTTY === true);
- }
- const semgrepReport = z
- .object({
- format: z.literal(semgrepPlatformFormat),
- deployment: z.string(),
- nativeProjectUrl: z.string().optional(),
- sourceRepositoryUrl: z.string().optional(),
- project: z.object({
- id: z.string(),
- name: z.string(),
- url: z.string(),
- }),
- ref: z.string(),
- product: z.enum(SEMGREP_PLATFORM_PRODUCTS),
- repositoryAliases: z.array(z.string()),
- findingCount: z.number().int().nonnegative(),
- findings: z.array(
- z.string().describe("JSON text of a native Semgrep finding."),
- ),
- })
- .optional();
- imports.command("snyk", {
+ })
+ .command("snyk", {
description:
"Read Snyk Open Source or Code issues for one monitored project.",
hint: "Requires SNYK_TOKEN. Save the complete --format json output. Use publish findings --provider snyk with --to local or --to cloud.",
@@ -4498,7 +4450,7 @@ export async function main(
.optional(),
run: ({ args, options, error, format }) => {
setHostedOutputFormat(format);
- return collect("Snyk", error, (signal) =>
+ return collectHostedFindings("Snyk", error, (signal) =>
collectSnykIssues(
{
projectId: args.project,
@@ -4508,12 +4460,12 @@ export async function main(
sourceRepositoryUrl: options.sourceRepositoryUrl,
signal,
},
- http,
+ hostedScannerDependencies,
),
);
},
- });
- imports.command("semgrep", {
+ })
+ .command("semgrep", {
description:
"Read a full Semgrep Platform project and ref through the Web API.",
hint: "Requires SEMGREP_APP_TOKEN with Web API access. Import the saved --format json output with publish findings --provider semgrep and --to local or --to cloud. Use --to local for a selected Guardian MCP capture.",
@@ -4542,10 +4494,29 @@ export async function main(
"Explicit mapping when the Semgrep project has no SCM URL.",
),
}),
- output: semgrepReport,
+ output: z
+ .object({
+ format: z.literal(semgrepPlatformFormat),
+ deployment: z.string(),
+ nativeProjectUrl: z.string().optional(),
+ sourceRepositoryUrl: z.string().optional(),
+ project: z.object({
+ id: z.string(),
+ name: z.string(),
+ url: z.string(),
+ }),
+ ref: z.string(),
+ product: z.enum(SEMGREP_PLATFORM_PRODUCTS),
+ repositoryAliases: z.array(z.string()),
+ findingCount: z.number().int().nonnegative(),
+ findings: z.array(
+ z.string().describe("JSON text of a native Semgrep finding."),
+ ),
+ })
+ .optional(),
run: ({ args, options, error, format }) => {
setHostedOutputFormat(format);
- return collect("Semgrep", error, (signal) =>
+ return collectHostedFindings("Semgrep", error, (signal) =>
collectSemgrepPlatformFindings(
{
project: args.project,
@@ -4555,14 +4526,12 @@ export async function main(
sourceRepositoryUrl: options.sourceRepositoryUrl,
signal,
},
- http,
+ hostedScannerDependencies,
),
);
},
- });
- }
- function registerSonarImport() {
- imports.command("sonar", {
+ })
+ .command("sonar", {
description:
"Collect Sonar security findings or replay a saved capture into the local workbench.",
hint: "Uses the active sonar CLI login. --to cloud also publishes the locally imported selection to the connected Cloud repository. --dry-run saves a live capture for review without importing findings.",
@@ -4642,7 +4611,6 @@ export async function main(
};
try {
if (
- importsEnabled &&
argv.includes("--full-output") &&
format !== "json" &&
format !== "jsonl"
@@ -4801,11 +4769,6 @@ export async function main(
});
},
});
- }
- if (importsEnabled) {
- registerOptInCollectors();
- registerSonarImport();
- }
const infoOutput = z.object({
sdkVersion: z.string(),
bundledPluginVersion: z.string(),
@@ -7421,7 +7384,7 @@ export async function main(
});
const commands = Cli.toCommands.get(cli)!;
- let valueOptions = cliValueOptions(commands);
+ const valueOptions = cliValueOptions(commands);
function isScanImportCommand(argv: readonly string[]): boolean {
const commandIndex = cliCommandIndex(argv);
return argv[commandIndex] === "scan" && argv[commandIndex + 1] === "import";
@@ -7557,11 +7520,6 @@ export async function main(
command === "publish" ||
command === "import";
const subcommand = nestedCommand ? argv[commandIndex + 1] : undefined;
- const optInCollector =
- command === "import" &&
- ["github-advisories", "semgrep", "snyk", "sonar"].includes(
- subcommand ?? "",
- );
if (
command === "import" &&
subcommand !== "sonar" &&
@@ -7570,35 +7528,6 @@ export async function main(
// Incur's skill-sync notice turns a saved collector array into an object.
cliOptions.sync = false;
}
- if (
- !importsEnabled &&
- ((command === "publish" && subcommand === "findings") ||
- (command === "findings" && subcommand === "imported") ||
- optInCollector)
- ) {
- if (
- process.env["COMPLETE"] ||
- argv.some((value) => FRAMEWORK_ACTIONS.has(value))
- ) {
- return externalImportsDisabledMessage;
- }
- if (!argv.includes("--version")) {
- if (
- argv.includes("--schema") ||
- (command !== "publish" &&
- (command !== "import" || !argv.includes("--full-output")))
- ) {
- return externalImportsDisabledMessage;
- }
- disabledImportInvocation = true;
- // This route only formats a disabled command; it is not an installed skill.
- cliOptions.sync = false;
- if (command === "publish") registerFindingPublication();
- else if (subcommand === "sonar") registerSonarImport();
- else registerOptInCollectors();
- valueOptions = cliValueOptions(commands);
- }
- }
if (command === "info") {
for (let index = 0; index < argv.length; index += 1) {
const argument = argv[index]!;
@@ -7675,8 +7604,6 @@ export async function main(
) {
return `Unexpected positional argument for ${command}${subcommand === undefined ? "" : ` ${subcommand}`}.`;
}
- if (disabledImportInvocation && frameworkFlags.hideDisabledRoute)
- return externalImportsDisabledMessage;
}
argv = normalizeScanImportArguments(defaultListCommand(argv));
const frameworkArgv = argv.flatMap((argument) => {
@@ -7850,10 +7777,6 @@ export async function main(
};
if (deferredVerificationDiagnostic === undefined) writeUpdateNotice();
if (frameworkExit !== undefined) {
- if (disabledImportInvocation && exitCode === 0) {
- reportPublicationError(externalImportsDisabledMessage, undefined);
- return exitCode;
- }
if (policyFullOutput || structuredError) {
if (exitCode === 0) exitCode = 2;
} else {
@@ -8244,20 +8167,12 @@ async function prepareScanArgumentsFromRecipe(
}
function frameworkOutputFlags(argv: readonly string[]) {
- let hideDisabledRoute = false;
let fullOutput = false;
let rawCollector = false;
const tokenArguments: string[] = [];
let filterOutput = false;
for (let index = 0; index < argv.length; index++) {
const value = argv[index]!;
- if (
- FRAMEWORK_ACTIONS.has(value) ||
- value === "--schema" ||
- value === "--help" ||
- value === "-h"
- )
- hideDisabledRoute = true;
if (value === "--full-output") fullOutput = true;
if (value === "--json") rawCollector = true;
if (value === "--token-count") tokenArguments.push(value);
@@ -8275,7 +8190,6 @@ function frameworkOutputFlags(argv: readonly string[]) {
}
}
return {
- hideDisabledRoute,
rawCollector: rawCollector && !fullOutput,
filterOutput,
tokenArguments,
diff --git a/sdk/typescript/src/external-findings-import.ts b/sdk/typescript/src/external-findings-import.ts
index eba61b420..4b923dc58 100644
--- a/sdk/typescript/src/external-findings-import.ts
+++ b/sdk/typescript/src/external-findings-import.ts
@@ -18,7 +18,6 @@ import {
snapshotSourceRepositories,
} from "./external-findings.js";
import { abortable } from "./targets.js";
-import { requireExternalImports } from "./external-imports-feature.js";
export interface LocalExternalImportOptions
extends
@@ -32,7 +31,6 @@ export async function prepareLocalExternalImport(
dependencies: LocalExternalImportDependencies = {},
) {
dependencies.signal?.throwIfAborted();
- requireExternalImports(dependencies.environment);
const settings = snapshotImportOptions(options);
const readerSources = distinctSourceRepositories(
snapshotSourceRepositories(dependencies.sourceRepositories),
diff --git a/sdk/typescript/src/external-findings-local.ts b/sdk/typescript/src/external-findings-local.ts
index 762279e57..f355f7e3f 100644
--- a/sdk/typescript/src/external-findings-local.ts
+++ b/sdk/typescript/src/external-findings-local.ts
@@ -21,10 +21,6 @@ import {
readHostedGitRemotes,
} from "./hosted-git-remotes.js";
import { CodexSecurityError } from "./errors.js";
-import {
- forwardExternalImportSetting,
- requireExternalImports,
-} from "./external-imports-feature.js";
import {
externalImportDisposition,
NoPublishableFindingsError,
@@ -678,10 +674,9 @@ async function localContext(
mode: "import" | "read" = "import",
) {
dependencies.signal?.throwIfAborted();
- const selected = dependencies.environment ?? process.env;
- const environment = workbenchEnvironment(selected);
- forwardExternalImportSetting(selected, environment);
- requireExternalImports(environment);
+ const environment = workbenchEnvironment(
+ dependencies.environment ?? process.env,
+ );
const path = expandHome(selectedRepository, environment);
const repository =
mode === "read"
@@ -726,7 +721,6 @@ export async function prepareNormalizedLocalImport(
dependencies: LocalExternalImportDependencies = {},
): Promise<PreparedLocalExternalImport> {
dependencies.signal?.throwIfAborted();
- requireExternalImports(dependencies.environment);
return prepareLocalImport(
input,
snapshotImportOptions(options),
@@ -1451,7 +1445,6 @@ export async function listLocalExternalFindings(
dependencies: LocalExternalImportDependencies = {},
): Promise<StoredExternalFinding[]> {
dependencies.signal?.throwIfAborted();
- requireExternalImports(dependencies.environment);
if (selection.id !== undefined) requireIdentity(selection.id, "Finding id");
const { repository, options } = await localContext(
selection.repository,
diff --git a/sdk/typescript/src/external-findings-publish.ts b/sdk/typescript/src/external-findings-publish.ts
index 5ab28f2c2..ea13f190b 100644
--- a/sdk/typescript/src/external-findings-publish.ts
+++ b/sdk/typescript/src/external-findings-publish.ts
@@ -42,7 +42,6 @@ import {
DEFAULT_CLOUD_BASE_URL,
} from "./cloud-endpoint.js";
import { CodexSecurityError, errorMessage } from "./errors.js";
-import { requireExternalImports } from "./external-imports-feature.js";
import {
codexSecurityStateDirectory,
createWindowsOutputDirectory,
@@ -717,7 +716,6 @@ export async function prepareExternalPublication(
options: ExternalPublicationOptions,
dependencies: ExternalPublicationDependencies = {},
): Promise<PreparedExternalPublication> {
- requireExternalImports(dependencies.environment);
const settings = snapshotImportOptions(options);
requireCloudReader(settings);
const readerSources = snapshotSourceRepositories(
@@ -823,7 +821,6 @@ export async function prepareNormalizedExternalPublication(
options: NormalizedExternalPublicationOptions,
dependencies: ExternalPublicationDependencies = {},
): Promise<PreparedExternalPublication> {
- requireExternalImports(dependencies.environment);
const settings = snapshotImportOptions(options);
requireCloudReader(settings);
return preparePublicationInput(
@@ -1547,7 +1544,6 @@ async function preparePublicationInput(
}
const environment = dependencies.environment ?? process.env;
dependencies.signal?.throwIfAborted();
- requireExternalImports(environment);
progress({ phase: "reading", completed: 0 });
const trivyReportUrls =
options.provider === "trivy" && typeof supplied !== "function"
diff --git a/sdk/typescript/src/external-imports-feature.ts b/sdk/typescript/src/external-imports-feature.ts
deleted file mode 100644
index 011244e0c..000000000
--- a/sdk/typescript/src/external-imports-feature.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-import { CodexSecurityError } from "./errors.js";
-
-const flag = "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS";
-export const externalImportsDisabledMessage = `External findings imports are disabled. Set ${flag}=1 to enable them.`;
-
-export function importEnvironmentSetting<Value>(
- environment: Record<string, Value>,
- requested: string,
-) {
- const exact = environment[requested];
- if (process.platform !== "win32") return { key: requested, value: exact };
- // A scan can override a case-insensitive process.env with its own spelling.
- function callerDeclares(key: string): boolean {
- for (
- let owner: object | null = environment;
- owner && owner !== process.env;
- owner = Object.getPrototypeOf(owner)
- ) {
- if (Object.hasOwn(owner, key)) return true;
- }
- return false;
- }
- if (exact !== undefined && callerDeclares(requested))
- return { key: requested, value: exact };
- // Node includes enumerable prototype keys and sorts competing spellings.
- const keys: string[] = [];
- for (const name in environment) {
- if (name.toUpperCase() === requested) keys.push(name);
- }
- keys.sort();
- const key = keys.find(callerDeclares) ?? keys[0];
- if (key !== undefined)
- return { key, value: key === requested ? exact : environment[key] };
-}
-
-export function externalImportsEnabled(
- environment: NodeJS.ProcessEnv = process.env,
-): boolean {
- return importEnvironmentSetting(environment, flag)?.value === "1";
-}
-
-/** Preserve the selected flag while copying a caller's environment for a child. */
-export function forwardExternalImportSetting<Value>(
- source: Record<string, Value | undefined>,
- child: Record<string, Value>,
-): void {
- const selected = importEnvironmentSetting(source, flag);
- if (selected === undefined) return;
- if (process.platform === "win32") {
- for (const name of Object.keys(child)) {
- if (name !== selected.key && name.toUpperCase() === flag)
- delete child[name];
- }
- }
- if (selected.value !== undefined) child[selected.key] = selected.value;
-}
-
-export function requireExternalImports(environment?: NodeJS.ProcessEnv): void {
- if (!externalImportsEnabled(environment)) {
- throw new CodexSecurityError(externalImportsDisabledMessage);
- }
-}
diff --git a/sdk/typescript/src/github-advisories.ts b/sdk/typescript/src/github-advisories.ts
index f2fbc5d6d..92310ad0c 100644
--- a/sdk/typescript/src/github-advisories.ts
+++ b/sdk/typescript/src/github-advisories.ts
@@ -4,7 +4,6 @@ import {
githubRepositoryParts,
} from "./github-identifiers.js";
import { CodexSecurityError } from "./errors.js";
-import { requireExternalImports } from "./external-imports-feature.js";
import {
githubImportHost,
githubImportClient,
@@ -52,7 +51,6 @@ export async function importGitHubAdvisories(
): Promise<ImportedGitHubAdvisory[]> {
options.signal?.throwIfAborted();
const environment = dependencies.environment ?? process.env;
- requireExternalImports(environment);
const repository = options.repository.trim();
const parts = githubRepositoryParts(repository);
if (!parts)
diff --git a/sdk/typescript/src/hosted-scanner-http.ts b/sdk/typescript/src/hosted-scanner-http.ts
index 235ff741b..b4f5e800d 100644
--- a/sdk/typescript/src/hosted-scanner-http.ts
+++ b/sdk/typescript/src/hosted-scanner-http.ts
@@ -2,7 +2,6 @@ import { waitForRetry } from "./deduplication/retry.js";
import { canonicalNumber } from "./external-import-contract.js";
import { CodexSecurityError, errorMessage } from "./errors.js";
import { normalizeHostedGitRepositoryUrl } from "./hosted-git-repository.js";
-import { importEnvironmentSetting } from "./external-imports-feature.js";
import { isRecord } from "./record.js";
import { declaredScannerRepositoryUrl } from "./scanner-repository-url.js";
@@ -69,6 +68,34 @@ export function hostedNativeRepositoryUrl(
return hostedRepositoryUrl(normalized, label);
}
+export function scannerEnvironmentValue(
+ environment: NodeJS.ProcessEnv,
+ requested: string,
+) {
+ const exact = environment[requested];
+ if (process.platform !== "win32") return exact;
+ // A scan can override a case-insensitive process.env with its own spelling.
+ function callerDeclares(key: string): boolean {
+ for (
+ let owner: object | null = environment;
+ owner && owner !== process.env;
+ owner = Object.getPrototypeOf(owner)
+ ) {
+ if (Object.hasOwn(owner, key)) return true;
+ }
+ return false;
+ }
+ if (exact !== undefined && callerDeclares(requested)) return exact;
+ // Node includes enumerable prototype keys and sorts competing spellings.
+ const keys: string[] = [];
+ for (const name in environment) {
+ if (name.toUpperCase() === requested) keys.push(name);
+ }
+ keys.sort();
+ const key = keys.find(callerDeclares) ?? keys[0];
+ if (key !== undefined) return key === requested ? exact : environment[key];
+}
+
/** Use the selected vendor credential only with its configured service origin. */
export function hostedScannerToken(
environment: NodeJS.ProcessEnv,
@@ -78,10 +105,10 @@ export function hostedScannerToken(
...originNames: string[]
): string | undefined {
const token =
- explicitToken ?? importEnvironmentSetting(environment, tokenName)?.value;
+ explicitToken ?? scannerEnvironmentValue(environment, tokenName);
if (token) {
for (const name of originNames) {
- const configured = importEnvironmentSetting(environment, name)?.value;
+ const configured = scannerEnvironmentValue(environment, name);
if (!configured) continue;
if (URL.parse(configured)?.origin !== origin)
throw new Error(
diff --git a/sdk/typescript/src/runtime.ts b/sdk/typescript/src/runtime.ts
index f5c2ae349..661c1bb37 100644
--- a/sdk/typescript/src/runtime.ts
+++ b/sdk/typescript/src/runtime.ts
@@ -1,4 +1,3 @@
-import { forwardExternalImportSetting } from "./external-imports-feature.js";
import { executablePathForSpawn } from "./executable-path.js";
export { executablePathForSpawn } from "./executable-path.js";
import { resolveBundledCodexExecutable } from "./codex-sdk-environment.js";
@@ -3272,14 +3271,12 @@ export function pluginExecutionEnvironment(
python: string,
environment: ProcessEnvironment = process.env,
): ProcessEnvironment {
- const child = {
+ return {
...pythonUtf8Environment(environment),
PYTHON: python,
CODEX_SECURITY_PYTHON_COMMAND: python,
CODEX_CLI_PATH: resolveCodexCommand(environment).command,
};
- forwardExternalImportSetting(environment, child);
- return child;
}
export function environmentWithGit(
diff --git a/sdk/typescript/src/semgrep-guardian-findings.ts b/sdk/typescript/src/semgrep-guardian-findings.ts
index d92a569f2..6272bb4b2 100644
--- a/sdk/typescript/src/semgrep-guardian-findings.ts
+++ b/sdk/typescript/src/semgrep-guardian-findings.ts
@@ -4,7 +4,6 @@ import type {
ExternalFinding,
ExternalSourceRepository,
} from "./external-findings.js";
-import { requireExternalImports } from "./external-imports-feature.js";
import { isRecord } from "./record.js";
import {
array,
@@ -161,7 +160,6 @@ export async function collectSelectedSemgrepGuardianFindings(
environment?: NodeJS.ProcessEnv;
},
) {
- requireExternalImports(dependencies.environment);
const query = structuredClone(selection.request);
const scope = selectionScope(query, selection.findingIds);
const sourceRepositoryUrl = declaredScannerRepositoryUrl(
diff --git a/sdk/typescript/src/semgrep-platform-collector.ts b/sdk/typescript/src/semgrep-platform-collector.ts
index d9ddbcd08..c0d442600 100644
--- a/sdk/typescript/src/semgrep-platform-collector.ts
+++ b/sdk/typescript/src/semgrep-platform-collector.ts
@@ -2,7 +2,6 @@ import {
snapshotSourceRepositories,
type ExternalSourceRepository,
} from "./external-findings.js";
-import { requireExternalImports } from "./external-imports-feature.js";
import {
hostedScannerToken,
hostedRepositoryUrl,
@@ -55,7 +54,6 @@ export async function collectSemgrepPlatformFindings(
dependencies: HostedScannerHttpOptions = {},
): Promise<SemgrepPlatformReport> {
const environment = dependencies.environment ?? process.env;
- requireExternalImports(environment);
const token = requiredText(
hostedScannerToken(
environment,
diff --git a/sdk/typescript/src/snyk-rest-findings.ts b/sdk/typescript/src/snyk-rest-findings.ts
index 4759a6a12..95af2bbfe 100644
--- a/sdk/typescript/src/snyk-rest-findings.ts
+++ b/sdk/typescript/src/snyk-rest-findings.ts
@@ -18,7 +18,6 @@ import {
readSnykRestDocument,
} from "./snyk-rest-v1.js";
import { snykRepositoryUrls } from "./snyk-findings.js";
-import { requireExternalImports } from "./external-imports-feature.js";
import { isGitHubCloudHost } from "./git-remote.js";
import {
gitPathToHttpPath,
@@ -721,7 +720,6 @@ export async function collectSnykIssues(
} = {},
): Promise<SnykIssuesExport> {
const environment = dependencies.environment ?? process.env;
- requireExternalImports(environment);
const { getJson, signal } = hostedScannerHttp(dependencies, options.signal);
const { product = "open-source" } = options;
const selected = scope(options, options.apiOrigin ?? defaultOrigin, product);
diff --git a/sdk/typescript/src/snyk-token-origin.ts b/sdk/typescript/src/snyk-token-origin.ts
index 2107b9259..ae10adb1a 100644
--- a/sdk/typescript/src/snyk-token-origin.ts
+++ b/sdk/typescript/src/snyk-token-origin.ts
@@ -1,4 +1,4 @@
-import { importEnvironmentSetting } from "./external-imports-feature.js";
+import { scannerEnvironmentValue } from "./hosted-scanner-http.js";
import { isRecord } from "./record.js";
function endpointSetting(environment: NodeJS.ProcessEnv, name: string) {
@@ -15,7 +15,7 @@ function endpointSetting(environment: NodeJS.ProcessEnv, name: string) {
if (!match.endsWith("}")) return match;
const requested =
process.platform === "win32" ? reference.toUpperCase() : reference;
- const value = importEnvironmentSetting(environment, requested)?.value;
+ const value = scannerEnvironmentValue(environment, requested);
if (value === undefined)
throw new Error(
`${name} references missing environment variable ${reference}.`,
@@ -26,7 +26,7 @@ function endpointSetting(environment: NodeJS.ProcessEnv, name: string) {
}
return undefined;
}
- return importEnvironmentSetting(environment, name)?.value;
+ return scannerEnvironmentValue(environment, name);
}
function endpointOrigin(value: string, snykBase: boolean): string | undefined {
@@ -75,10 +75,7 @@ export function snykApiToken(
"SNYK_API",
"SNYK_CFG_ENDPOINT",
];
- const environmentToken = importEnvironmentSetting(
- environment,
- tokenName,
- )?.value;
+ const environmentToken = scannerEnvironmentValue(environment, tokenName);
const token = explicitToken ?? environmentToken;
// HTTP trims trailing whitespace from the Authorization header.
if (token && token.trim() === environmentToken?.trim()) {
diff --git a/sdk/typescript/src/sonar-collector.ts b/sdk/typescript/src/sonar-collector.ts
index 6c6f5c523..5f8e84517 100644
--- a/sdk/typescript/src/sonar-collector.ts
+++ b/sdk/typescript/src/sonar-collector.ts
@@ -9,10 +9,6 @@ import {
} from "./external-findings-local.js";
import { localGitProtectionRoots } from "./local-git-metadata.js";
import { repositoryUrlKey } from "./external-import-contract.js";
-import {
- forwardExternalImportSetting,
- requireExternalImports,
-} from "./external-imports-feature.js";
import { isRecord } from "./record.js";
import { array, record, relativePath, requiredText } from "./scanner-import.js";
import { declaredScannerRepositoryUrl } from "./scanner-repository-url.js";
@@ -354,11 +350,9 @@ export async function collectSonarIssues(
runSonar?: SonarCommand,
): Promise<SonarCapture> {
const suppliedEnvironment = options.environment ?? process.env;
- requireExternalImports(suppliedEnvironment);
const environment: NodeJS.ProcessEnv = Object.create(null);
for (const name in suppliedEnvironment)
environment[name] = suppliedEnvironment[name];
- forwardExternalImportSetting(suppliedEnvironment, environment);
options = { ...options, cwd: resolve(options.cwd), environment };
options.signal?.throwIfAborted();
const { pullRequest } = options;
diff --git a/sdk/typescript/src/sonar-import.ts b/sdk/typescript/src/sonar-import.ts
index 2ef0a04cf..324a4f8ac 100644
--- a/sdk/typescript/src/sonar-import.ts
+++ b/sdk/typescript/src/sonar-import.ts
@@ -4,7 +4,6 @@ import { basename, dirname, join } from "node:path";
import { resolveConfigPath } from "./config-path.js";
import { collectSonarIssues } from "./sonar-collector.js";
import { normalizeSonarFindings, parseSonarCapture } from "./sonar-findings.js";
-import { requireExternalImports } from "./external-imports-feature.js";
import {
configuredFetchRemotes,
type ConfiguredFetchRemote,
@@ -137,7 +136,6 @@ export async function prepareSonarImport(
},
) {
const { signal, environment = process.env } = dependencies;
- requireExternalImports(environment);
signal?.throwIfAborted();
if (
options.capture &&
diff --git a/sdk/typescript/tests-ts/api-credentials.test.ts b/sdk/typescript/tests-ts/api-credentials.test.ts
index e66e1b489..5b294da87 100644
--- a/sdk/typescript/tests-ts/api-credentials.test.ts
+++ b/sdk/typescript/tests-ts/api-credentials.test.ts
@@ -6,7 +6,7 @@ import {
} from "../src/config.js";
import { rejecting } from "./support/errors.js";
import { requestMetadata } from "./support/request-metadata.js";
-import { nodeCommand, runCommand } from "./support/shell.js";
+import { nodeCommand } from "./support/shell.js";
import { existsSync } from "node:fs";
import { chmod, mkdir, readFile, stat, writeFile } from "node:fs/promises";
import { join, relative } from "node:path";
@@ -468,28 +468,11 @@ describe("CodexSecurity orchestration", () => {
let scansStarted = 0;
const deepScanConfigPaths = new Set<string>();
const concurrentScans = Promise.withResolvers<void>();
- const inheritedOptIn = Object.defineProperty(
- {},
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS",
- { value: "1", enumerable: false, writable: true },
- );
const clients = await Promise.all(
- [
- {},
- {
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS:
- process.platform === "win32" ? undefined : "0",
- Codex_Security_Enable_External_Imports: "1",
- },
- ].map(async (overrides, index) => {
+ [0, 1].map(async (index) => {
const scanDir = join(root, `parallel-scan-${index}`);
await mkdir(scanDir, { mode: 0o700 });
- const environment: NodeJS.ProcessEnv = Object.assign(
- Object.create(inheritedOptIn),
- { CODEX_HOME: ambientHome, CODEX_SECURITY_STATE_DIR: stateDirectory },
- overrides,
- );
return new TestClient(
{
pluginPath: PLUGIN_ROOT,
@@ -498,7 +481,10 @@ describe("CodexSecurity orchestration", () => {
},
},
{
- environment,
+ environment: {
+ CODEX_HOME: ambientHome,
+ CODEX_SECURITY_STATE_DIR: stateDirectory,
+ },
resolvePluginPython: async () => "/managed/python",
prepareOutputDir: async () => scanDir,
repositoryRevision: async () => "deadbeef",
@@ -531,15 +517,6 @@ describe("CodexSecurity orchestration", () => {
workers: index + 2,
});
await concurrentScans.promise;
- const child = await runCommand(
- nodeCommand().command,
- ["-p", "process.env.CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS"],
- { env: options.env },
- );
- expect(child.status, child.stderr).toBe(0);
- expect(child.stdout.trim()).toBe(
- String(environment["CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS"]),
- );
const after = parseToml(
await readFile(deepScanConfigPath!, "utf8"),
);
diff --git a/sdk/typescript/tests-ts/cli-external-imports-feature.test.ts b/sdk/typescript/tests-ts/cli-external-imports-feature.test.ts
deleted file mode 100644
index 2368ceaba..000000000
--- a/sdk/typescript/tests-ts/cli-external-imports-feature.test.ts
+++ /dev/null
@@ -1,381 +0,0 @@
-import { spawnSync } from "node:child_process";
-import { Writable } from "node:stream";
-import { fileURLToPath } from "node:url";
-import { expect, mock, test } from "bun:test";
-import { main } from "../src/cli.js";
-import { VERSION } from "../src/version.js";
-import {
- removeTemporaryDirectory,
- temporaryDirectory,
-} from "./support/temporary-directories.js";
-import { capture, dependencies } from "./cli-fixtures.js";
-import { createCliTest } from "./support/cli-run.js";
-import { importedAlert } from "./support/github-import-fixtures.js";
-import { runTestInSubprocess } from "./support/test-subprocess.js";
-
-const commands = [
- ["publish", "findings"],
- ["findings", "imported"],
- ["import", "github-advisories"],
- ["import", "snyk"],
- ["import", "sonar"],
-];
-
-const publishLocal = [
- "publish",
- "findings",
- "selected.json",
- "--to",
- "local",
- "--repository",
- ".",
- "--provider",
- "wiz",
- "--source-key",
- "synthetic/findings",
- "--yes",
-];
-
-test("Semgrep import advertises its saved report format and native finding JSON strings", async () => {
- const cli = createCliTest(main);
- const code = await cli.runCli(
- ["import", "semgrep", "--schema", "--json"],
- dependencies({
- environment: { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" },
- }),
- );
- expect(code).toBe(0);
- expect(JSON.parse(cli.stdout.text()).output).toMatchObject({
- properties: {
- format: { const: "semgrep-platform-findings/v2" },
- project: { properties: { id: { type: "string" } } },
- product: { enum: ["sast", "sca", "ai_sast"] },
- findings: { type: "array", items: { type: "string" } },
- },
- });
-});
-
-test("disabled commands distinguish discovery requests from filter values", async () => {
- const deps = dependencies({ environment: {} });
- for (const flag of ["--schema", "--llms-full", "--help"]) {
- const cli = createCliTest(main);
- expect(
- await cli.runCli(
- [
- "--filter-output",
- `--token-limit=${flag}`,
- "publish",
- "findings",
- "--json",
- ],
- deps,
- ),
- ).toBe(2);
- expect(cli.stdout.text()).toBe("");
- expect(cli.stderr.text()).toContain(
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1",
- );
- }
- const filtered = createCliTest(main);
- expect(
- await filtered.runCli(
- [
- ...publishLocal,
- "--filter-output=--schema",
- "--full-output",
- "--format=json",
- ],
- deps,
- ),
- ).toBe(2);
- expect(JSON.parse(filtered.stdout.text()).error.code).toBe("IMPORT_FAILED");
-});
-
-test("disabled commands cannot invoke import, storage, or publication handlers", async () => {
- const unexpected = mock(async () => {
- throw new Error("Unexpected import handler");
- });
- const deps = {
- ...dependencies({
- environment: {},
- importGitHubAdvisories: unexpected,
- onWorkbench: unexpected,
- }),
- prepareLocalExternalImport: unexpected,
- listLocalExternalFindings: unexpected,
- cloudFetch: unexpected,
- };
- for (const command of [
- publishLocal,
- [
- "publish",
- "findings",
- "selected.json",
- "--to",
- "cloud",
- "--repository",
- "example/project",
- "--provider",
- "snyk",
- "--source-key",
- "synthetic/findings",
- "--yes",
- ],
- ["findings", "imported", "."],
- ["import", "github-advisories", "example/project"],
- ["import", "sonar"],
- ]) {
- const cli = createCliTest(main);
- expect(await cli.runCli(command, deps)).not.toBe(0);
- expect(cli.stderr.text()).toContain(
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1",
- );
- if (command[0] === "publish") {
- for (const [flags, diagnostic] of [
- [["--unknown", "--json"], cli.stderr.text()],
- [
- ["extra.json", "--json"],
- "Unexpected positional argument for publish findings.",
- ],
- [
- ["--source-key", "--dry-run", "--json"],
- "Missing value for flag: --source-key",
- ],
- ] as const) {
- const rejected = createCliTest(main);
- expect(await rejected.runCli([...command, ...flags], deps)).toBe(2);
- expect(rejected.stdout.text()).toBe("");
- expect(rejected.stderr.text()).toContain(diagnostic);
- }
- for (const [flags, result] of [
- [["--format=yaml"], /^status: failed$/m],
- [["--format", "md"], /\|\s*status\s*\|\s*failed\s*\|/],
- [["--format", "json", "--format", "yaml"], /^status: failed$/m],
- ] as const) {
- const formatted = createCliTest(main);
- expect(await formatted.runCli([...command, ...flags], deps)).toBe(2);
- expect(formatted.stdout.text()).toMatch(result);
- expect(formatted.stdout.text()).toContain(
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1",
- );
- }
- for (const format of ["json", "jsonl"]) {
- const formatted = createCliTest(main);
- expect(
- await formatted.runCli(
- [...command, "--format", format, "--full-output"],
- deps,
- ),
- ).toBe(2);
- const message = expect.stringContaining(
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1",
- );
- expect(JSON.parse(formatted.stdout.text())).toMatchObject({
- ok: false,
- error: { code: "IMPORT_FAILED", message },
- data: { status: "failed", error: message },
- });
- }
- const unsupported = createCliTest(main);
- expect(
- await unsupported.runCli(
- [...command, "--format", "json", "--format", "yaml", "--full-output"],
- deps,
- ),
- ).toBe(2);
- expect(unsupported.stdout.text()).toContain("INVALID_ARGUMENTS");
- } else if (command[0] === "import") {
- const errorCode =
- command[1] === "sonar" ? "SONAR_IMPORT_FAILED" : "GITHUB_IMPORT_FAILED";
- for (const format of [undefined, "json", "jsonl", "yaml", "md", "toon"]) {
- const formatted = createCliTest(main);
- expect(
- await formatted.runCli(
- [
- ...command,
- "--full-output",
- ...(format === undefined ? [] : ["--format", format]),
- ],
- deps,
- ),
- ).toBe(2);
- if (format === "json" || format === "jsonl") {
- expect(JSON.parse(formatted.stdout.text())).toMatchObject({
- ok: false,
- error: { code: errorCode },
- });
- } else {
- expect(formatted.stdout.text()).toContain(errorCode);
- }
- expect(formatted.stdout.text()).toContain(
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1",
- );
- }
- }
- }
- expect(unexpected).not.toHaveBeenCalled();
-});
-
-test("a closed diagnostic pipe preserves the Sonar error envelope", async () => {
- const stdout = capture();
- const stderr = new Writable({
- write(_chunk, _encoding, done) {
- setImmediate(() =>
- done(Object.assign(new Error("closed"), { code: "EPIPE" })),
- );
- },
- });
- const closed = new Promise<void>((resolve) => stderr.once("close", resolve));
- const code = await main(
- ["import", "sonar", "--full-output", "--format=json"],
- stdout.stream,
- stderr,
- dependencies({ environment: {} }),
- );
- await closed;
- expect(code).toBe(2);
- expect(JSON.parse(stdout.text()).error.code).toBe("SONAR_IMPORT_FAILED");
-});
-
-test("rejects unsupported Sonar full-output formats before collecting findings", async () => {
- const collectSonarIssues = mock(async (): Promise<never> => {
- throw new Error("Unexpected collection");
- });
- const cli = createCliTest(main);
- const deps = {
- ...dependencies({
- environment: { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" },
- }),
- collectSonarIssues,
- };
- expect(
- await cli.runCli(
- ["import", "sonar", "--yes", "--full-output", "--format", "yaml"],
- deps,
- ),
- ).toBe(2);
- expect(cli.stdout.text()).toContain("INVALID_ARGUMENTS");
- expect(collectSonarIssues).not.toHaveBeenCalled();
-});
-
-const installedSkills =
- "installed skills preserve import errors and collector output";
-test(installedSkills, async () => {
- if (runTestInSubprocess(import.meta.path, installedSkills)) return;
- const root = await temporaryDirectory("disabled-import-skills-");
- const entry = fileURLToPath(new URL("../src/cli.ts", import.meta.url));
- const run = (...args: string[]) =>
- spawnSync(process.execPath, [entry, ...args], {
- cwd: root,
- env: {
- ...process.env,
- COMPLETE: "",
- HOME: root,
- USERPROFILE: root,
- CODEX_HOME: root,
- XDG_DATA_HOME: root,
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "0",
- CODEX_SECURITY_NO_UPDATE_NOTICE: "1",
- },
- encoding: "utf8",
- });
- try {
- expect(run("skills", "add", "--no-global").status).toBe(0);
- for (const args of [
- [...publishLocal, "--json"],
- [
- "import",
- "github-advisories",
- "example/project",
- "--json",
- "--full-output",
- ],
- ]) {
- const result = run(...args);
- expect(result.status).toBe(2);
- expect(result.stdout).toContain(
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1",
- );
- expect(result.stdout).not.toContain("Skills are out of date");
- }
-
- process.env["XDG_DATA_HOME"] = root;
- const alerts = [importedAlert()];
- const deps = dependencies({
- environment: { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" },
- importGitHubAlerts: async () => alerts,
- });
- const args = ["import", "github", "example/project", "--json"];
- const full = createCliTest(main);
- expect(await full.runCli([...args, "--full-output"], deps)).toBe(0);
- expect(JSON.parse(full.stdout.text())).toMatchObject({
- data: alerts,
- meta: { cta: { description: "Skills are out of date:" } },
- });
- const plain = createCliTest(main);
- expect(await plain.runCli(args, deps)).toBe(0);
- expect(JSON.parse(plain.stdout.text())).toEqual(alerts);
- const yaml = createCliTest(main);
- expect(await yaml.runCli([...args, "--format=yaml"], deps)).toBe(0);
- expect(Bun.YAML.parse(yaml.stdout.text())).toEqual(alerts);
- } finally {
- await removeTemporaryDirectory(root);
- }
-});
-
-test("opt-in exposes the commands per invocation without affecting concurrent disabled discovery", async () => {
- await Promise.all(
- [true, false].map(async (enabled) => {
- const environment = {
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: enabled ? "1" : "0",
- };
- for (const [group, command] of commands) {
- const version = createCliTest(main);
- expect(
- await version.runCli(
- [group!, command!, "--version", "--json"],
- dependencies({ environment }),
- ),
- ).toBe(0);
- expect(version.stdout.text()).toBe(`${VERSION}\n`);
- expect(version.stderr.text()).toBe("");
- const cli = createCliTest(main);
- expect(
- await cli.runCli([group!, "--help"], dependencies({ environment })),
- ).toBe(0);
- expect(
- new RegExp(`^\\s+${command}\\s`, "m").test(cli.stdout.text()),
- ).toBe(enabled);
- const schema = createCliTest(main);
- const status = await schema.runCli(
- [group!, command!, "--schema"],
- dependencies({ environment }),
- );
- if (enabled) expect(status).toBe(0);
- else expect(status).not.toBe(0);
- }
- }),
- );
-});
-
-test("established scan publishing, status, scan import, and GitHub collection stay available", async () => {
- for (const command of [
- ["publish", "scan"],
- ["publish", "check"],
- ["scan", "import"],
- ["import", "github"],
- ]) {
- const cli = createCliTest(main);
- expect(
- await cli.runCli(
- [...command, "--help"],
- dependencies({ environment: {} }),
- ),
- ).toBe(0);
- expect(cli.stdout.text()).toContain(
- `Usage: codex-security ${command.join(" ")} `,
- );
- if (command[0] === "import" && command[1] === "github")
- expect(cli.stdout.text()).not.toContain("publish findings");
- }
-});
diff --git a/sdk/typescript/tests-ts/cli-external-imports.test.ts b/sdk/typescript/tests-ts/cli-external-imports.test.ts
new file mode 100644
index 000000000..10744a0b0
--- /dev/null
+++ b/sdk/typescript/tests-ts/cli-external-imports.test.ts
@@ -0,0 +1,155 @@
+import { mkdir, writeFile } from "node:fs/promises";
+import { join } from "node:path";
+import { Writable } from "node:stream";
+import { expect, mock, test } from "bun:test";
+import { main } from "../src/cli.js";
+import {
+ removeTemporaryDirectory,
+ temporaryDirectory,
+} from "./support/temporary-directories.js";
+import { capture, dependencies } from "./cli-fixtures.js";
+import { createCliTest } from "./support/cli-run.js";
+import { importedAdvisory } from "./support/github-import-fixtures.js";
+import { runTestInSubprocess } from "./support/test-subprocess.js";
+
+test.each(
+ Object.entries({
+ publish: ["findings"],
+ findings: ["imported"],
+ import: ["github-advisories", "semgrep", "snyk", "sonar"],
+ }),
+)("%s commands are discoverable by default", async (group, commands) => {
+ const deps = dependencies();
+ const help = createCliTest(main);
+ expect(await help.runCli([group, "--help"], deps)).toBe(0);
+ const helpText = help.stdout.text();
+ for (const command of commands) {
+ expect(helpText).toMatch(new RegExp(`^\\s+${command}\\s`, "m"));
+
+ const schema = createCliTest(main);
+ expect(
+ await schema.runCli([group, command, "--schema", "--json"], deps),
+ ).toBe(0);
+ expect(JSON.parse(schema.stdout.text()).output).toBeDefined();
+ }
+});
+
+test("a legacy disabled setting still allows reading imported findings", async () => {
+ const cli = createCliTest(main);
+ const listLocalExternalFindings = mock(async () => []);
+ const code = await cli.runCli(["findings", "imported", ".", "--json"], {
+ ...dependencies({
+ environment: { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "0" },
+ }),
+ listLocalExternalFindings,
+ });
+ expect(code).toBe(0);
+ expect(listLocalExternalFindings).toHaveBeenCalledTimes(1);
+ expect(JSON.parse(cli.stdout.text()).findings).toEqual([]);
+});
+
+test("Semgrep import advertises its saved report format and native finding JSON strings", async () => {
+ const cli = createCliTest(main);
+ const code = await cli.runCli(
+ ["import", "semgrep", "--schema", "--json"],
+ dependencies(),
+ );
+ expect(code).toBe(0);
+ expect(JSON.parse(cli.stdout.text()).output).toMatchObject({
+ properties: {
+ format: { const: "semgrep-platform-findings/v2" },
+ project: { properties: { id: { type: "string" } } },
+ product: { enum: ["sast", "sca", "ai_sast"] },
+ findings: { type: "array", items: { type: "string" } },
+ },
+ });
+});
+
+test("a closed diagnostic pipe preserves the Sonar error envelope", async () => {
+ const stdout = capture();
+ const stderr = new Writable({
+ write(_chunk, _encoding, done) {
+ setImmediate(() =>
+ done(Object.assign(new Error("closed"), { code: "EPIPE" })),
+ );
+ },
+ });
+ const closed = new Promise<void>((resolve) => stderr.once("close", resolve));
+ const code = await main(
+ [
+ "import",
+ "sonar",
+ "capture.json",
+ "--sonar-project",
+ "synthetic",
+ "--full-output",
+ "--format=json",
+ ],
+ stdout.stream,
+ stderr,
+ dependencies(),
+ );
+ await closed;
+ expect(code).toBe(2);
+ expect(JSON.parse(stdout.text()).error.code).toBe("SONAR_IMPORT_FAILED");
+});
+
+test("rejects unsupported Sonar full-output formats before collecting findings", async () => {
+ const collectSonarIssues = mock(async (): Promise<never> => {
+ throw new Error("Unexpected collection");
+ });
+ const cli = createCliTest(main);
+ const deps = {
+ ...dependencies(),
+ collectSonarIssues,
+ };
+ expect(
+ await cli.runCli(
+ ["import", "sonar", "--yes", "--full-output", "--format", "yaml"],
+ deps,
+ ),
+ ).toBe(2);
+ expect(cli.stdout.text()).toContain("INVALID_ARGUMENTS");
+ expect(collectSonarIssues).not.toHaveBeenCalled();
+});
+
+const installedSkills = "stale installed skills preserve collector output";
+test(installedSkills, async () => {
+ if (runTestInSubprocess(import.meta.path, installedSkills)) return;
+ const root = await temporaryDirectory("import-skills-");
+ try {
+ process.env["XDG_DATA_HOME"] = root;
+ const skill = join(root, "codex-security-import");
+ await mkdir(skill);
+ await writeFile(join(skill, "SKILL.md"), "Previously installed skill.");
+ await mkdir(join(root, "incur"));
+ await writeFile(
+ join(root, "incur", "codex-security.json"),
+ JSON.stringify({
+ hash: "previous-command-hash",
+ skills: ["codex-security-import"],
+ paths: [skill],
+ }),
+ );
+
+ const advisories = [importedAdvisory()];
+ const deps = dependencies({
+ importGitHubAdvisories: async () => advisories,
+ });
+ const args = ["import", "github-advisories", "example/project", "--json"];
+ const full = createCliTest(main);
+ expect(await full.runCli([...args, "--full-output"], deps)).toBe(0);
+ expect(JSON.parse(full.stdout.text())).toMatchObject({
+ data: advisories,
+ meta: { cta: { description: "Skills are out of date:" } },
+ });
+ const plain = createCliTest(main);
+ expect(await plain.runCli(args, deps)).toBe(0);
+ expect(JSON.parse(plain.stdout.text())).toEqual(advisories);
+ const yaml = createCliTest(main);
+ expect(await yaml.runCli([...args, "--format=yaml"], deps)).toBe(0);
+ expect(Bun.YAML.parse(yaml.stdout.text())).toEqual(advisories);
+ } finally {
+ await removeTemporaryDirectory(root);
+ }
+});
diff --git a/sdk/typescript/tests-ts/cli-import-snyk.test.ts b/sdk/typescript/tests-ts/cli-import-snyk.test.ts
index 289c56e4e..d6903053c 100644
--- a/sdk/typescript/tests-ts/cli-import-snyk.test.ts
+++ b/sdk/typescript/tests-ts/cli-import-snyk.test.ts
@@ -24,7 +24,6 @@ const command = [
"json",
];
const environment = {
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1",
SNYK_TOKEN: "synthetic",
};
@@ -61,7 +60,7 @@ test.each(["open-source", "code"] as const)(
},
);
-test("import snyk requires opt-in and keeps failed collections out of redirected JSON", async () => {
+test("import snyk checks the token before fetching and keeps failed collections out of redirected JSON", async () => {
const detail = "projet refusé \u202edenied\npermissions:\tread";
const fetch = mock(async (_url: URL, init: RequestInit) => {
expect(new Headers(init.headers).get("authorization")).toBe(
@@ -69,28 +68,26 @@ test("import snyk requires opt-in and keeps failed collections out of redirected
);
return new Response(detail, { status: 403 });
});
- const disabled = createCliTest(main);
+ const missingToken = createCliTest(main);
expect(
- await disabled.runCli(command, {
+ await missingToken.runCli(command, {
...dependencies({ environment: {} }),
hostedScannerFetch: fetch,
}),
).toBe(2);
expect(fetch).not.toHaveBeenCalled();
- expect(disabled.stdout.text()).toBe("");
- expect(disabled.stderr.text()).toContain(
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1",
- );
+ expect(missingToken.stdout.text()).toBe("");
+ expect(missingToken.stderr.text()).toContain("SNYK_TOKEN");
- const enabled = createCliTest(main);
+ const cli = createCliTest(main);
expect(
- await enabled.runCli(command, {
+ await cli.runCli(command, {
...dependencies({ environment }),
hostedScannerFetch: fetch,
}),
).toBe(2);
- expect(enabled.stdout.text()).toBe("");
- expect(enabled.stderr.text()).toContain(
+ expect(cli.stdout.text()).toBe("");
+ expect(cli.stderr.text()).toContain(
"projet refusé \\u202edenied permissions: read",
);
@@ -102,7 +99,7 @@ test("import snyk requires opt-in and keeps failed collections out of redirected
}),
).toBe(2);
expect(JSON.parse(full.stdout.text()).error.message).toContain(detail);
- expect(full.stderr.text()).toBe(enabled.stderr.text());
+ expect(full.stderr.text()).toBe(cli.stderr.text());
});
test("Snyk CLI escapes cursors in human output and retains the native JSON value", async () => {
@@ -139,12 +136,7 @@ test("Snyk CLI escapes cursors in human output and retains the native JSON value
test("Snyk --schema describes the complete saved report", async () => {
const cli = createCliTest(main);
expect(
- await cli.runCli(
- ["import", "snyk", "--schema", "--json"],
- dependencies({
- environment: { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" },
- }),
- ),
+ await cli.runCli(["import", "snyk", "--schema", "--json"], dependencies()),
).toBe(0);
const { output } = JSON.parse(cli.stdout.text());
expect(output.properties).toMatchObject({
diff --git a/sdk/typescript/tests-ts/cli-local-import.test.ts b/sdk/typescript/tests-ts/cli-local-import.test.ts
index 295d7a5a7..934740e8b 100644
--- a/sdk/typescript/tests-ts/cli-local-import.test.ts
+++ b/sdk/typescript/tests-ts/cli-local-import.test.ts
@@ -11,10 +11,7 @@ import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { afterEach, expect, test } from "bun:test";
import { main } from "../src/cli.js";
-import {
- dependencies as cliDependencies,
- FakeSignals,
-} from "./cli-fixtures.js";
+import { dependencies, FakeSignals } from "./cli-fixtures.js";
import { createCliTest } from "./support/cli-run.js";
import { opengrepJson } from "./support/opengrep-import-fixtures.js";
import {
@@ -22,17 +19,6 @@ import {
inspectorRepositoryUrl,
} from "./support/inspector-import-fixtures.js";
-const dependencies: typeof cliDependencies = (options = {}) => {
- const result = cliDependencies(options);
- return {
- ...result,
- environment: {
- ...result.environment,
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1",
- },
- };
-};
-
const roots: string[] = [];
afterEach(async () => {
await Promise.all(
diff --git a/sdk/typescript/tests-ts/direct-deep-scan.test.ts b/sdk/typescript/tests-ts/direct-deep-scan.test.ts
index c9458b204..cdd89077e 100644
--- a/sdk/typescript/tests-ts/direct-deep-scan.test.ts
+++ b/sdk/typescript/tests-ts/direct-deep-scan.test.ts
@@ -62,7 +62,6 @@ writeFileSync(process.env.SYNTHETIC_RECEIPT, JSON.stringify({
request, ipc: !!process.send, argv: process.argv.slice(2), key: process.env.CODEX_API_KEY,
execPath: process.execPath, bun: process.versions.bun,
awsProfile: process.env.AWS_PROFILE, snapshot: process.env.CODEX_SECURITY_DEEP_SCAN_CONFIG_PATH,
- externalImports: process.env.CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS,
}));
if (request.diagnosticsVersion === 1 && process.env.SYNTHETIC_OLD_ENGINE !== '1') {
process.send({ event: 'discovery_worker_replaced', scanId: request.scanId, reason: 'tool error' });
@@ -89,7 +88,7 @@ if (process.env.SYNTHETIC_FAIL === '1') {
test("isolates direct engine credentials and runtime snapshots across concurrent scans", async () => {
const { root, pluginRoot } = await fixture();
const events = await Promise.all(
- ["first", "second", "unset", "mixed-case"].map(async (name) => {
+ ["first", "second"].map(async (name) => {
const scanDir = join(root, name);
const receipt = join(root, `${name}.json`);
await mkdir(scanDir);
@@ -104,14 +103,6 @@ test("isolates direct engine credentials and runtime snapshots across concurrent
"private-snapshot.toml",
),
AWS_PROFILE: `profile-${name}`,
- ...(name === "mixed-case"
- ? { Codex_Security_Enable_External_Imports: "1" }
- : name === "unset"
- ? {}
- : {
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS:
- name === "first" ? "1" : "0",
- }),
};
const before = { ...environment };
const collected = [];
@@ -137,18 +128,6 @@ test("isolates direct engine credentials and runtime snapshots across concurrent
}))
collected.push(event);
const saved = JSON.parse(await readFile(receipt, "utf8"));
- assert.equal(
- saved.externalImports,
- name === "mixed-case"
- ? process.platform === "win32"
- ? "1"
- : undefined
- : name === "first"
- ? "1"
- : name === "second"
- ? "0"
- : undefined,
- );
assert.partialDeepStrictEqual(saved, {
key: `synthetic-key-${name}`,
awsProfile: `profile-${name}`,
diff --git a/sdk/typescript/tests-ts/external-findings-import.test.ts b/sdk/typescript/tests-ts/external-findings-import.test.ts
index f588973cb..ab1fcc6af 100644
--- a/sdk/typescript/tests-ts/external-findings-import.test.ts
+++ b/sdk/typescript/tests-ts/external-findings-import.test.ts
@@ -11,33 +11,7 @@ import {
localReportFixture,
} from "./external-findings-local-helpers.js";
-test("requires opt-in before reading the source file", async () => {
- await using fixture = await localFindingsFixture();
- const environment: NodeJS.ProcessEnv = { ...fixture.environment };
- delete environment["CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS"];
- let workbenchCalls = 0;
- await expect(
- prepareLocalExternalImport(
- join(fixture.root, "missing-findings.json"),
- {
- repository: fixture.repository,
- provider: "wiz",
- sourceKey: "example-project/main",
- },
- {
- environment,
- runWorkbench: async () => {
- workbenchCalls++;
- throw new Error("Disabled imports must not access the workbench");
- },
- },
- ),
- ).rejects.toThrow("CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1");
- expect(workbenchCalls).toBe(0);
- await expect(access(fixture.stateDirectory)).rejects.toThrow();
-});
-
-test("a file import rechecks the selected workbench opt-in after reading", async () => {
+test("a file import resolves the repository using the caller’s workbench environment", async () => {
await using f = await localFindingsFixture();
const file = join(f.root, "report.json");
await writeFile(
@@ -66,19 +40,7 @@ test("a file import rechecks the selected workbench opt-in after reading", async
);
expect(prepared.preview.repository).toBe(f.repository);
- const dependencies = { environment: { ...f.environment } };
- const pending = prepareLocalExternalImport(file, selection, dependencies);
- const disabledState = join(f.root, "disabled-state");
- dependencies.environment = {
- ...f.environment,
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "0",
- CODEX_SECURITY_STATE_DIR: disabledState,
- };
- await expect(pending).rejects.toThrow(
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1",
- );
await expect(access(f.stateDirectory)).rejects.toThrow();
- await expect(access(disabledState)).rejects.toThrow();
});
test("cancels preparation while the source file read is pending", async () => {
diff --git a/sdk/typescript/tests-ts/external-findings-local-helpers.ts b/sdk/typescript/tests-ts/external-findings-local-helpers.ts
index e56374938..855bfc084 100644
--- a/sdk/typescript/tests-ts/external-findings-local-helpers.ts
+++ b/sdk/typescript/tests-ts/external-findings-local-helpers.ts
@@ -52,14 +52,8 @@ export async function localFindingsFixture(options: Checkout = {}) {
stateDirectory,
git,
environment: {
- ...Object.fromEntries(
- Object.entries(env).filter(
- ([name]) =>
- name.toUpperCase() !== "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS",
- ),
- ),
+ ...env,
CODEX_SECURITY_STATE_DIR: stateDirectory,
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1",
},
dispose,
[Symbol.asyncDispose]: dispose,
diff --git a/sdk/typescript/tests-ts/external-findings-local.test.ts b/sdk/typescript/tests-ts/external-findings-local.test.ts
index 0ae70f616..bc86ff455 100644
--- a/sdk/typescript/tests-ts/external-findings-local.test.ts
+++ b/sdk/typescript/tests-ts/external-findings-local.test.ts
@@ -113,133 +113,6 @@ describe("local normalized scanner findings", () => {
}
});
- test("requires opt-in before resolving repositories or accessing the workbench", async () => {
- const { root, stateDirectory, environment } = await fixture();
- const disabledEnvironment: NodeJS.ProcessEnv = { ...environment };
- delete disabledEnvironment["CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS"];
- const repository = join(root, "missing-repository");
- let workbenchCalls = 0;
- const dependencies = {
- environment: disabledEnvironment,
- runWorkbench: async () => {
- workbenchCalls++;
- throw new Error("Disabled imports must not access the workbench");
- },
- };
- await expect(
- prepareNormalizedLocalImport(
- input(),
- { repository, ...source },
- dependencies,
- ),
- ).rejects.toThrow("CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1");
- await expect(
- listLocalExternalFindings({ repository }, dependencies),
- ).rejects.toThrow("CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1");
- expect(workbenchCalls).toBe(0);
- expect(existsSync(stateDirectory)).toBe(false);
- });
-
- test("requires opt-in from the workbench selected during normalization", async () => {
- const { root, repository, stateDirectory, environment } = await fixture();
- const disabledState = join(root, "disabled-state");
- const dependencies = { environment };
- const data = input();
- const finding = data.findings[0]!;
- const evidence = finding.evidence;
- Object.defineProperty(finding, "evidence", {
- enumerable: true,
- get() {
- dependencies.environment = {
- ...environment,
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "0",
- CODEX_SECURITY_STATE_DIR: disabledState,
- };
- return evidence;
- },
- });
- await expect(
- prepareNormalizedLocalImport(
- data,
- { repository, ...source },
- dependencies,
- ).then((prepared) => prepared.import()),
- ).rejects.toThrow("CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1");
- expect(existsSync(disabledState)).toBe(false);
- expect(existsSync(stateDirectory)).toBe(false);
- });
-
- test("forwards an inherited opt-in to store and read helpers while an overlapping import stays disabled", async () => {
- const { root, repository, stateDirectory, environment } = await fixture();
- const { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS, ...settings } = environment;
- const enabledEnvironment = Object.assign(
- Object.create({
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS,
- get CODEX_SECURITY_CLOUD_WEB_URL() {
- throw new Error("A local import does not use the Cloud endpoint");
- },
- }),
- settings,
- );
- const disabledState = join(root, "disabled-state");
- const disabledEnvironment = {
- ...environment,
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "0",
- CODEX_SECURITY_STATE_DIR: disabledState,
- };
- const [enabled, disabled] = await Promise.allSettled([
- prepareNormalizedLocalImport(
- input(),
- { repository, ...source },
- { environment: enabledEnvironment },
- ).then((prepared) => prepared.import()),
- prepareNormalizedLocalImport(
- input(),
- { repository, ...source },
- {
- environment: disabledEnvironment,
- },
- ).then((prepared) => prepared.import()),
- ]);
- if (enabled.status !== "fulfilled") throw enabled.reason;
- expect(enabled.value.counts).toEqual({
- created: 2,
- updated: 0,
- unchanged: 0,
- });
- expect(disabled.status).toBe("rejected");
- if (disabled.status !== "rejected")
- throw new Error("Disabled import succeeded");
- expect(disabled.reason.message).toContain(
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1",
- );
- const [readback, blockedRead] = await Promise.allSettled([
- listLocalExternalFindings(
- { repository },
- { environment: enabledEnvironment },
- ),
- listLocalExternalFindings(
- { repository },
- { environment: disabledEnvironment },
- ),
- ]);
- expect(readback.status).toBe("fulfilled");
- if (readback.status !== "fulfilled") throw readback.reason;
- expect(
- new Map(readback.value.map((finding) => [finding.id, finding])),
- ).toEqual(
- new Map(enabled.value.findings.map((finding) => [finding.id, finding])),
- );
- expect(blockedRead.status).toBe("rejected");
- if (blockedRead.status !== "rejected")
- throw new Error("Disabled read succeeded");
- expect(blockedRead.reason.message).toContain(
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1",
- );
- expect(existsSync(join(stateDirectory, "workbench.sqlite3"))).toBe(true);
- expect(existsSync(disabledState)).toBe(false);
- });
-
test("rejects unserializable report metadata before storing findings", async () => {
const { repository, stateDirectory, environment } = await fixture();
await expect(
diff --git a/sdk/typescript/tests-ts/external-findings-publish.test.ts b/sdk/typescript/tests-ts/external-findings-publish.test.ts
index e3b9c6e6f..e6e1a3ebf 100644
--- a/sdk/typescript/tests-ts/external-findings-publish.test.ts
+++ b/sdk/typescript/tests-ts/external-findings-publish.test.ts
@@ -46,7 +46,7 @@ import { promisify } from "node:util";
import { gzipSync } from "node:zlib";
import { Database } from "bun:sqlite";
import { NoPublishableFindingsError } from "../src/index.js";
-import { afterEach, expect, spyOn, test } from "bun:test";
+import { afterEach, expect, spyOn, test, mock } from "bun:test";
import {
ExternalPublicationError,
prepareExternalPublication,
@@ -239,122 +239,29 @@ test("Cloud stops before expanding a shared subtree beyond its JSON depth limit"
expect(reads).toBe(128);
});
-test("external publication requires opt-in before reading input or accessing Cloud", async () => {
- const root = await mkdtemp(join(tmpdir(), "external-import-disabled-"));
- cleanups.push(() => rm(root, { recursive: true, force: true }));
- const state = join(root, "state");
- let sideEffects = 0;
- const disabled = {
- environment: {
- CODEX_SECURITY_STATE_DIR: state,
- },
- credentials: async () => {
- sideEffects++;
- throw new Error("Unexpected credential read");
- },
- fetch: async () => {
- sideEffects++;
- throw new Error("Unexpected Cloud request");
- },
- };
- // The missing path would fail differently if the file reader ran first.
- await expect(
- prepareExternalPublication(join(root, "missing.json"), options, disabled),
- ).rejects.toThrow("CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1");
- await expect(
- prepareNormalizedExternalPublication(
- { read: 0, findings: [], excluded: [] },
- options,
- disabled,
- ),
- ).rejects.toThrow("CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1");
- expect(sideEffects).toBe(0);
- await expect(readdir(state)).rejects.toThrow("ENOENT");
-});
-
-test("concurrent external publications enforce opt-in and provider options before Cloud access", async () => {
+test("checks incompatible provider options before Cloud access", async () => {
const f = await fixture();
const parsed = await readVendorFindings(f.file);
- let disabledSideEffects = 0;
- const disabled = {
- ...f.deps,
- environment: {
- ...f.environment,
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "0",
- },
- credentials: async () => {
- disabledSideEffects++;
- throw new Error("Unexpected credential read");
- },
- fetch: async () => {
- disabledSideEffects++;
- throw new Error("Unexpected Cloud request");
- },
- };
- const results = await Promise.allSettled([
- prepareExternalPublication(f.file, options, f.deps),
- prepareExternalPublication(f.file, options, disabled),
- prepareNormalizedExternalPublication(parsed, options, f.deps),
- prepareNormalizedExternalPublication(parsed, options, disabled),
- ]);
- expect(results.map((result) => result.status)).toEqual([
- "fulfilled",
- "rejected",
- "fulfilled",
- "rejected",
- ]);
- for (const result of results) {
- if (result.status === "fulfilled") {
- expect(result.value.preview.findings).toHaveLength(1);
- } else {
- expect(String(result.reason)).toContain(
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1",
- );
- }
- }
+ const credentials = mock(async () => {
+ throw new Error("Unexpected credential read");
+ });
+ const deps = { ...f.deps, credentials };
const incompatible = { ...options, inspectorProjectMap: new Map() };
- const enabled = { ...disabled, environment: f.environment };
const message = "map requires the inspector provider";
await expect(
- prepareNormalizedExternalPublication(parsed, incompatible, enabled),
+ prepareNormalizedExternalPublication(parsed, incompatible, deps),
).rejects.toThrow(message);
await expect(
prepareExternalPublication(
join(f.root, "missing.json"),
incompatible,
- enabled,
+ deps,
),
).rejects.toThrow(message);
- expect(disabledSideEffects).toBe(0);
+ expect(credentials).not.toHaveBeenCalled();
expect(f.posts).toHaveLength(0);
});
-for (const provider of ["wiz", "snyk"] as const) {
- test(`${provider} publication rechecks the selected Cloud opt-in after reading`, async () => {
- const f =
- provider === "snyk" ? await fixture(snykSarif()) : await fixture();
- let credentialReads = 0;
- const dependencies = {
- ...f.deps,
- environment: { ...f.environment },
- credentials: async () => {
- credentialReads++;
- throw new Error("Unexpected credential read");
- },
- };
- const pending = prepareExternalPublication(
- f.file,
- { ...options, provider },
- dependencies,
- );
- dependencies.environment.CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS = "0";
- await expect(pending).rejects.toThrow(
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1",
- );
- expect(credentialReads).toBe(0);
- });
-}
-
test("Wiz's gzip JSON report retains finding identity, evidence and repository locations", async () => {
const report = {
id: "vendor-report-1",
@@ -651,7 +558,7 @@ async function fixture(
await writeFile(file, JSON.stringify(records));
const environment = {
...process.env,
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1",
+
CODEX_HOME: join(root, "credentials"),
CODEX_SECURITY_STATE_DIR: join(root, "state"),
};
@@ -1180,7 +1087,7 @@ test("normalized SDK callers can distinguish an empty report from exclusions wit
},
]) {
const prepared = prepareNormalizedExternalPublication(selection, options, {
- environment: { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" },
+ environment: {},
credentials: async () => {
throw new Error("Unexpected credential read");
},
@@ -1622,7 +1529,7 @@ test.each(["file", "SDK"] as const)(
token: "synthetic-token",
},
{
- environment: { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" },
+ environment: {},
fetch: async (url) =>
Response.json(
url.pathname.endsWith("/findings")
@@ -1892,7 +1799,7 @@ test("Trivy Cloud preparation reads the serialized batch and rows", async () =>
]) {
await expect(
prepareNormalizedExternalPublication(input, trivyOptions, {
- environment: { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" },
+ environment: {},
credentials: async () => {
throw new Error("Reached credential lookup");
},
@@ -1913,7 +1820,7 @@ test("a normalized Semgrep report checks the provider before Cloud credentials",
report,
{ ...options, provider: "wiz" },
{
- environment: { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" },
+ environment: {},
credentials: async () => {
throw new Error("Unexpected credential lookup");
},
@@ -6176,7 +6083,7 @@ test("empty or oversized normalized input stops before Cloud discovery", async (
{ read: findings.length, findings, excluded: [] },
options,
{
- environment: { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" },
+ environment: {},
credentials: async () => {
throw new Error("Unexpected authentication");
},
diff --git a/sdk/typescript/tests-ts/external-imports-feature.test.ts b/sdk/typescript/tests-ts/external-imports-feature.test.ts
deleted file mode 100644
index 82e76b176..000000000
--- a/sdk/typescript/tests-ts/external-imports-feature.test.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-import { expect, test } from "bun:test";
-import { externalImportsEnabled } from "../src/external-imports-feature.js";
-import { runTestInSubprocess } from "./support/test-subprocess.js";
-
-const flag = "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS";
-const mixed = "Codex_Security_Enable_External_Imports";
-const lower = flag.toLowerCase();
-
-test.each([undefined, "", "0", "true", " 1 ", "1"])(
- "requires exact opt-in for %p",
- (value) => {
- expect(externalImportsEnabled({ [flag]: value })).toBe(value === "1");
- },
-);
-
-test("resolves mixed-case and inherited settings on the host platform", () => {
- const windows = process.platform === "win32";
- for (const [environment, expected] of [
- [{ [mixed]: "1" }, windows],
- [{ [mixed]: "0" }, false],
- [{ [mixed]: "true" }, false],
- [{ [mixed]: "1", [flag]: undefined }, false],
- [{ [lower]: "1", [mixed]: "0" }, false],
- [{ [lower]: "0", [mixed]: "1" }, windows],
- [Object.create({ [flag]: "1" }), true],
- [Object.assign(Object.create({ [flag]: "0" }), { [mixed]: "1" }), false],
- [Object.defineProperty({}, flag, { value: "1" }), true],
- [Object.defineProperty({ [lower]: "1" }, flag, { value: "0" }), false],
- [
- Object.defineProperty({ [lower]: "1" }, flag, { value: undefined }),
- windows,
- ],
- [{}, false],
- ] as const) {
- expect(externalImportsEnabled(environment)).toBe(expected);
- }
-});
-
-const overlay = "prefers a caller's own Windows setting over process.env";
-test.skipIf(process.platform !== "win32")(overlay, () => {
- if (runTestInSubprocess(import.meta.path, overlay)) return;
- for (const name of Object.keys(process.env))
- if (name.toUpperCase() === flag) delete process.env[name];
- for (const host of [flag, mixed, lower]) {
- for (const own of ["0", "1"]) {
- process.env[host] = own === "0" ? "1" : "0";
- const environment = Object.create(process.env, {
- [mixed]: { value: own, enumerable: true },
- });
- expect(externalImportsEnabled(environment)).toBe(own === "1");
- }
- delete process.env[host];
- }
-});
diff --git a/sdk/typescript/tests-ts/github-advisories.test.ts b/sdk/typescript/tests-ts/github-advisories.test.ts
index 938330fa7..27b86831a 100644
--- a/sdk/typescript/tests-ts/github-advisories.test.ts
+++ b/sdk/typescript/tests-ts/github-advisories.test.ts
@@ -9,8 +9,6 @@ import { dependencies, FakeSignals } from "./cli-fixtures.js";
import { captureCli, runCapturedCli } from "./support/cli-run.js";
import { importedAdvisory } from "./support/github-import-fixtures.js";
-const enabledEnvironment = { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" };
-
function client(respond: (url: URL) => Response): Octokit {
return new Octokit({
auth: "SYNTHETIC_ADVISORY_TOKEN",
@@ -29,24 +27,6 @@ function client(respond: (url: URL) => Response): Octokit {
});
}
-test.each(["repository", "global"] as const)(
- "%s advisory imports require opt-in before GitHub authentication",
- async (source) => {
- const createGitHub = mock(async () => client(() => Response.json([])));
- await expect(
- importGitHubAdvisories(
- {
- repository: "example/project",
- source,
- advisoryIds: [importedAdvisory().ghsaId],
- },
- { environment: {}, createGitHub },
- ),
- ).rejects.toThrow("CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1");
- expect(createGitHub).not.toHaveBeenCalled();
- },
-);
-
test.each([
[403, "GitHub denied security advisory access"],
[404, "GitHub repository or security advisory was not found"],
@@ -57,7 +37,7 @@ test.each([
importGitHubAdvisories(
{ repository: "example/project" },
{
- environment: enabledEnvironment,
+ environment: {},
createGitHub: async () => client(() => Response.json({}, { status })),
},
),
@@ -65,30 +45,6 @@ test.each([
},
);
-test("concurrent advisory imports keep opt-in scoped to each call", async () => {
- const advisory = importedAdvisory();
- const createGitHub = mock(async () =>
- client(() => Response.json([advisory.advisory])),
- );
- const [enabled, disabled] = await Promise.allSettled([
- importGitHubAdvisories(
- { repository: "example/project" },
- { environment: enabledEnvironment, createGitHub },
- ),
- importGitHubAdvisories(
- { repository: "example/project" },
- { environment: {}, createGitHub },
- ),
- ]);
- expect(enabled).toEqual({ status: "fulfilled", value: [advisory] });
- expect(disabled.status).toBe("rejected");
- if (disabled.status === "rejected")
- expect(disabled.reason.message).toContain(
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1",
- );
- expect(createGitHub).toHaveBeenCalledTimes(1);
-});
-
test("repository advisory lists default to published and paginate cursors with full evidence", async () => {
const paths: string[] = [];
const github = client((url) => {
@@ -109,7 +65,7 @@ test("repository advisory lists default to published and paginate cursors with f
});
const imported = await importGitHubAdvisories(
{ repository: "example/project" },
- { environment: enabledEnvironment, createGitHub: async () => github },
+ { environment: {}, createGitHub: async () => github },
);
expect(paths).toHaveLength(2);
expect(new URL(paths[1]!).searchParams.get("after")).toBe("cursor-2");
@@ -130,7 +86,7 @@ test("global advisory selection uses only explicit deduplicated IDs and preserve
source: "global",
advisoryIds: [selected.ghsaId.toLowerCase(), selected.ghsaId],
},
- { environment: enabledEnvironment, createGitHub: async () => github },
+ { environment: {}, createGitHub: async () => github },
);
expect(paths).toEqual([`/advisories/${selected.ghsaId}`]);
expect(imported).toEqual([selected]);
@@ -148,7 +104,7 @@ test("explicit repository IDs allow private drafts without listing other advisor
});
const imported = await importGitHubAdvisories(
{ repository: "example/project", advisoryIds: [selected.ghsaId] },
- { environment: enabledEnvironment, createGitHub: async () => github },
+ { environment: {}, createGitHub: async () => github },
);
expect(imported[0]!.advisory).toEqual(draft);
});
@@ -158,7 +114,7 @@ test("global crawl and misleading exact-ID state filters fail before GitHub auth
await expect(
importGitHubAdvisories(
{ repository: "example/project", source: "global" },
- { environment: enabledEnvironment, createGitHub },
+ { environment: {}, createGitHub },
),
).rejects.toThrow("explicit GHSA IDs");
await expect(
@@ -168,7 +124,7 @@ test("global crawl and misleading exact-ID state filters fail before GitHub auth
advisoryIds: [importedAdvisory().ghsaId],
state: "draft",
},
- { environment: enabledEnvironment, createGitHub },
+ { environment: {}, createGitHub },
),
).rejects.toThrow("only filters repository lists");
expect(createGitHub).not.toHaveBeenCalled();
@@ -187,7 +143,7 @@ test("a later advisory page failure returns no incomplete selection", async () =
await expect(
importGitHubAdvisories(
{ repository: "example/project" },
- { environment: enabledEnvironment, createGitHub: async () => github },
+ { environment: {}, createGitHub: async () => github },
),
).rejects.toThrow("rate limited");
});
@@ -209,7 +165,6 @@ test("GitHub advisory CLI exposes separate selection defaults and exact public I
"json",
],
dependencies({
- environment: enabledEnvironment,
importGitHubAdvisories: async (value) => {
options = value;
return [importedAdvisory("global")];
@@ -228,7 +183,7 @@ test("GitHub advisory CLI exposes separate selection defaults and exact public I
expect(
await schema.run(
["import", "github-advisories", "--schema", "--format", "json"],
- dependencies({ environment: enabledEnvironment }),
+ dependencies(),
),
).toBe(0);
expect(JSON.parse(schema.text())).toMatchObject({
@@ -248,7 +203,6 @@ test("advisory CLI cancellation removes handlers and preserves its exit code", a
main,
["import", "github-advisories", "example/project"],
dependencies({
- environment: enabledEnvironment,
signals,
importGitHubAdvisories: async ({ signal }) => {
signals.emit("SIGINT");
@@ -289,7 +243,6 @@ for (const format of [
"--full-output",
],
dependencies({
- environment: enabledEnvironment,
signals,
importGitHubAdvisories: async ({ signal }) => {
if (failure === "error")
diff --git a/sdk/typescript/tests-ts/github-findings.test.ts b/sdk/typescript/tests-ts/github-findings.test.ts
index fb8239416..47cb0098c 100644
--- a/sdk/typescript/tests-ts/github-findings.test.ts
+++ b/sdk/typescript/tests-ts/github-findings.test.ts
@@ -899,7 +899,7 @@ test("real GitHub readers and mappings preserve explicit ports in repository evi
},
});
const dependency = {
- environment: { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" },
+ environment: {},
createGitHub: async (selectedHost: string) => {
expect(selectedHost).toBe(host);
return github;
diff --git a/sdk/typescript/tests-ts/hosted-scanner-http.test.ts b/sdk/typescript/tests-ts/hosted-scanner-http.test.ts
index dc3cc8b2a..c0d113181 100644
--- a/sdk/typescript/tests-ts/hosted-scanner-http.test.ts
+++ b/sdk/typescript/tests-ts/hosted-scanner-http.test.ts
@@ -3,7 +3,9 @@ import { afterEach, expect, jest, mock, test } from "bun:test";
import {
hostedScannerHttp,
type HostedScannerHttpOptions,
+ hostedScannerToken,
} from "../src/hosted-scanner-http.js";
+import { runTestInSubprocess } from "./support/test-subprocess.js";
const url = new URL(
"https://semgrep.dev/api/v1/deployments/example/findings?page=1",
@@ -15,6 +17,27 @@ function get(options: HostedScannerHttpOptions) {
const now = Date.UTC(2026, 10, 6, 8, 49, 20, 250);
afterEach(() => jest.useRealTimers());
+const overlay =
+ "hosted scanners resolve caller token overrides using the host's environment casing";
+test(overlay, () => {
+ if (runTestInSubprocess(import.meta.path, overlay)) return;
+ process.env["SEMGREP_APP_TOKEN"] = "synthetic-host-token";
+ const environment = Object.create(process.env, {
+ Semgrep_App_Token: { value: "synthetic-caller-token", enumerable: true },
+ });
+ const token = hostedScannerToken(
+ environment,
+ "SEMGREP_APP_TOKEN",
+ undefined,
+ url.origin,
+ );
+ expect(token).toBe(
+ process.platform === "win32"
+ ? "synthetic-caller-token"
+ : "synthetic-host-token",
+ );
+});
+
function limited(hint: string, cancel: () => void) {
return new Response(new ReadableStream({ cancel }), {
status: 429,
diff --git a/sdk/typescript/tests-ts/runtime.test.ts b/sdk/typescript/tests-ts/runtime.test.ts
index ede7d941b..7350d7419 100644
--- a/sdk/typescript/tests-ts/runtime.test.ts
+++ b/sdk/typescript/tests-ts/runtime.test.ts
@@ -2921,7 +2921,6 @@ for await (const line of createInterface({ input: process.stdin })) {
};
const parentEnvironment = pluginExecutionEnvironment(process.execPath, {
PATH: "",
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1",
...(process.env["SystemRoot"] === undefined
? {}
: { SystemRoot: process.env["SystemRoot"] }),
@@ -2940,9 +2939,6 @@ for await (const line of createInterface({ input: process.stdin })) {
expect(workerEnvironment["CODEX_CLI_PATH"]).toBe(
resolveCodexCommand().command,
);
- expect(workerEnvironment["CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS"]).toBe(
- "1",
- );
expect(workerEnvironment["PYTHONUTF8"]).toBe("1");
expect(workerEnvironment["CODEX_SECURITY_PYTHON_COMMAND"]).toBe(
process.execPath,
@@ -2962,25 +2958,6 @@ for await (const line of createInterface({ input: process.stdin })) {
expect(nestedCodex.stdout).toMatch(/^codex-cli\s+\d/u);
});
- test("forwards the external import setting to the plugin helper", () => {
- const flag = "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS";
- const node = Bun.which("node")!;
- const environment: NodeJS.ProcessEnv = Object.assign(
- Object.create({ [flag]: "1" }),
- { CODEX_CLI_PATH: node, SystemRoot: process.env["SystemRoot"] },
- );
- const helper = join(PLUGIN_ROOT, "mcp", "helpers.mjs");
- const run = () =>
- spawnSync(node, [helper, "list-external-findings", "--help"], {
- env: pluginExecutionEnvironment(node, environment),
- }).status;
-
- expect(run()).toBe(0);
- environment[flag] = undefined;
- environment["Codex_Security_Enable_External_Imports"] = "1";
- expect(run()).toBe(2);
- });
-
test("preserves an explicit Codex executable override for nested workers", () => {
const configured = join(
tmpdir(),
diff --git a/sdk/typescript/tests-ts/semgrep-guardian-findings.test.ts b/sdk/typescript/tests-ts/semgrep-guardian-findings.test.ts
index 3e574d32f..27322730f 100644
--- a/sdk/typescript/tests-ts/semgrep-guardian-findings.test.ts
+++ b/sdk/typescript/tests-ts/semgrep-guardian-findings.test.ts
@@ -36,7 +36,6 @@ const row = {
filePath: "src/main.ts",
line: 3,
};
-const environment = { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" };
const capture = {
format: "semgrep-guardian-selection/v1",
...selection,
@@ -49,7 +48,6 @@ test("a signed-in Guardian selection and Web API collection keep independent row
}));
const selected = await collectSelectedSemgrepGuardianFindings(selection, {
callTool,
- environment,
});
expect(callTool.mock.calls).toEqual([[selection.request]]);
expect(selected).toEqual(capture);
@@ -79,7 +77,7 @@ test("a signed-in Guardian selection and Web API collection keep independent row
const web = await collectSemgrepPlatformFindings(
{ deployment, project, ref },
{
- environment: { ...environment, SEMGREP_APP_TOKEN: "synthetic" },
+ environment: { SEMGREP_APP_TOKEN: "synthetic" },
fetch: async (url) =>
Response.json(
url.pathname.endsWith("/findings")
@@ -169,7 +167,6 @@ test("Guardian Supply Chain retains its summary and checks the operator's checko
},
{ repository: project, provider: "semgrep", sourceKey: "example/topic" },
{
- environment,
credentials: async () => {
throw new Error("Unexpected credential lookup");
},
@@ -331,14 +328,14 @@ test("SDK exports containing Guardian findings fail before Cloud credential look
provider: "semgrep",
sourceKey: "example/topic",
},
- { environment, credentials },
+ { credentials },
),
).rejects.toThrow(/local import/);
}
expect(credentials).not.toHaveBeenCalled();
});
-test("empty selections and disabled imports do not call Guardian; tool errors retain their message", async () => {
+test("Guardian validates the selection before calling the tool and preserves tool errors", async () => {
const callTool = mock(async () => ({
isError: true,
content: [{ type: "text", text: "Guardian login expired" }],
@@ -346,20 +343,13 @@ test("empty selections and disabled imports do not call Guardian; tool errors re
await expect(
collectSelectedSemgrepGuardianFindings(
{ ...selection, findingIds: [] },
- { callTool, environment },
+ { callTool },
),
).rejects.toThrow(/at least one/);
- await expect(
- collectSelectedSemgrepGuardianFindings(selection, {
- callTool,
- environment: {},
- }),
- ).rejects.toThrow(/disabled/);
expect(callTool).not.toHaveBeenCalled();
await expect(
collectSelectedSemgrepGuardianFindings(selection, {
callTool,
- environment,
}),
).rejects.toThrow("Guardian login expired");
});
@@ -370,7 +360,6 @@ test("Guardian binds the collection, saved selection and normalized replay to th
{ ...selection, sourceRepositoryUrl: url },
{
callTool: async () => ({ structuredContent: { findings: [row] } }),
- environment,
},
);
const other = url + ".git";
diff --git a/sdk/typescript/tests-ts/semgrep-platform-collector.test.ts b/sdk/typescript/tests-ts/semgrep-platform-collector.test.ts
index edbc22b72..54d0fbdfd 100644
--- a/sdk/typescript/tests-ts/semgrep-platform-collector.test.ts
+++ b/sdk/typescript/tests-ts/semgrep-platform-collector.test.ts
@@ -27,7 +27,6 @@ const options = {
ref: "refs/heads/topic",
};
const environment = {
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1",
SEMGREP_APP_TOKEN: "synthetic",
};
const fullPage = Array.from({ length: 3000 }, (_, index) => ({
@@ -780,7 +779,6 @@ test("an explicit SDK token respects the configured Semgrep origin", async () =>
{ ...options, token: "synthetic-explicit" },
{
environment: {
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1",
[setting]: "https://private.example.test",
},
fetch,
@@ -1710,12 +1708,12 @@ test("CLI preserves native Semgrep error details in structured output and escape
expect(JSON.parse(cli.stdout.text()).error.message).toContain(detail);
});
-test("CLI checks opt-in and token origin before fetching", async () => {
+test("CLI checks the token and its origin before fetching", async () => {
const fetch = mock(() => {
throw new Error("Unexpected HTTP call");
});
for (const [env, diagnostic] of [
- [{}, "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS"],
+ [{}, "SEMGREP_APP_TOKEN"],
[
{ ...environment, SEMGREP_URL: "https://other.example.test" },
"SEMGREP_URL",
diff --git a/sdk/typescript/tests-ts/snyk-rest-boundaries.test.ts b/sdk/typescript/tests-ts/snyk-rest-boundaries.test.ts
index 57f14bada..35724fc2a 100644
--- a/sdk/typescript/tests-ts/snyk-rest-boundaries.test.ts
+++ b/sdk/typescript/tests-ts/snyk-rest-boundaries.test.ts
@@ -112,7 +112,7 @@ test("an empty normalized Snyk report stops before Cloud credentials", async ()
normalized,
{ provider: "snyk", repository: "repo-example", sourceKey: "example" },
{
- environment: { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" },
+ environment: {},
credentials,
},
),
@@ -608,7 +608,7 @@ test("a serialized Snyk report keeps its monitored asset when a reader supplies
projected,
{ provider: "wiz", sourceKey: "project", repository: "repo-example" },
{
- environment: { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" },
+ environment: {},
credentials,
},
),
@@ -619,7 +619,7 @@ test("a serialized Snyk report keeps its monitored asset when a reader supplies
malformed,
{ provider: "snyk", sourceKey: "project", repository: "repo-example" },
{
- environment: { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" },
+ environment: {},
credentials,
},
),
diff --git a/sdk/typescript/tests-ts/snyk-rest-findings.test.ts b/sdk/typescript/tests-ts/snyk-rest-findings.test.ts
index 872717a63..b94e0aae9 100644
--- a/sdk/typescript/tests-ts/snyk-rest-findings.test.ts
+++ b/sdk/typescript/tests-ts/snyk-rest-findings.test.ts
@@ -19,7 +19,6 @@ import {
} from "./support/snyk-rest-fixtures.js";
const environment = {
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1",
SNYK_TOKEN: "test-token",
};
@@ -184,7 +183,7 @@ test.each([
collectSnykIssues(
{ ...options, apiOrigin, token },
{
- environment: { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" },
+ environment: {},
fetch: async (url, init) => {
seen.push(url.origin);
expect(new Headers(init.headers).get("authorization")).toBe(
diff --git a/sdk/typescript/tests-ts/snyk-rest-response-scope.test.ts b/sdk/typescript/tests-ts/snyk-rest-response-scope.test.ts
index 900fc5450..d8807bbce 100644
--- a/sdk/typescript/tests-ts/snyk-rest-response-scope.test.ts
+++ b/sdk/typescript/tests-ts/snyk-rest-response-scope.test.ts
@@ -17,7 +17,7 @@ function capture(...responses: unknown[]) {
return collectSnykIssues(
{ ...snykOptions, token: "example-token" },
{
- environment: { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" },
+ environment: {},
fetch: async () => {
if (!responses.length) throw new Error("Unexpected Snyk request");
return Response.json(responses.shift());
diff --git a/sdk/typescript/tests-ts/snyk-rest-scm-proof.test.ts b/sdk/typescript/tests-ts/snyk-rest-scm-proof.test.ts
index fd399ba38..32590e74f 100644
--- a/sdk/typescript/tests-ts/snyk-rest-scm-proof.test.ts
+++ b/sdk/typescript/tests-ts/snyk-rest-scm-proof.test.ts
@@ -51,7 +51,6 @@ test.each([
) =>
collectSnykIssues(options, {
environment: {
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1",
SNYK_TOKEN: "synthetic",
},
sourceRepositories,
diff --git a/sdk/typescript/tests-ts/sonar-collector.test.ts b/sdk/typescript/tests-ts/sonar-collector.test.ts
index 8aff78e21..05c25bd2d 100644
--- a/sdk/typescript/tests-ts/sonar-collector.test.ts
+++ b/sdk/typescript/tests-ts/sonar-collector.test.ts
@@ -31,10 +31,7 @@ const organization = "example";
const project = "example:service";
const repositoryUrl = "https://example.invalid/team/service";
const auth = { status: "connected", org: organization, server };
-const environment = {
- ...sonarGitTestEnvironment(),
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1",
-};
+const environment = sonarGitTestEnvironment();
function git(...args: string[]) {
return execFileSync("git", args, { env: environment });
@@ -665,32 +662,6 @@ test("guides disconnected users to sign in and honors cancellation before openin
).rejects.toThrow("cancel collection");
});
-test("honors the SDK caller's inherited opt-in and explicit non-enumerable opt-out before invoking Sonar", async () => {
- const cwd = await checkout();
- const allowed = sonarSession({ pages: [page("A")] });
- const capture = await collectSonarIssues(
- { cwd, environment: Object.create(environment) },
- allowed.run,
- );
- expect(capture.repositoryUrl).toBe(repositoryUrl);
- const session = sonarSession({ pages: [] });
- const denied = Object.defineProperty(
- { codex_security_enable_external_imports: "1" },
- "CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS",
- { value: "0" },
- );
- await expect(
- collectSonarIssues(
- {
- cwd: ".",
- environment: denied,
- },
- session.run,
- ),
- ).rejects.toThrow("imports are disabled");
- expect(session.commands).toEqual([]);
-});
-
test("canonical Cloud endpoints are accepted and connection changes during issue search discard the capture", async () => {
const cwd = await checkout();
for (const [initialServer, final] of [
diff --git a/sdk/typescript/tests-ts/sonar-import.test.ts b/sdk/typescript/tests-ts/sonar-import.test.ts
index 12766ed38..36606a2e3 100644
--- a/sdk/typescript/tests-ts/sonar-import.test.ts
+++ b/sdk/typescript/tests-ts/sonar-import.test.ts
@@ -31,7 +31,6 @@ async function fixture(root: string, name = "checkout") {
const environment = {
...sonarGitTestEnvironment(),
CODEX_HOME: join(root, "codex"),
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1",
CODEX_SECURITY_STATE_DIR: join(root, "state"),
};
const git = (...args: string[]) =>
diff --git a/sdk/typescript/tests-ts/tenable-import.test.ts b/sdk/typescript/tests-ts/tenable-import.test.ts
index c4a4d4811..065ecde85 100644
--- a/sdk/typescript/tests-ts/tenable-import.test.ts
+++ b/sdk/typescript/tests-ts/tenable-import.test.ts
@@ -182,12 +182,9 @@ test("file and normalized imports verify repository and finding identity, even f
expect(runWorkbench).not.toHaveBeenCalled();
});
-test("local opt-in and Cloud rejection precede file access or credentials", async () => {
+test("Cloud rejects local Tenable findings before file access or credential lookup", async () => {
await using fixture = await checkout();
const options = { ...source, repository: fixture.repository };
- await expect(
- prepareLocalExternalImport(fixture.file, options, { environment: {} }),
- ).rejects.toThrow("CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1");
const unexpected = mock(async () => {
throw new Error("Unexpected Cloud call");
});
diff --git a/sdk/typescript/tests-ts/trivy-findings-local.test.ts b/sdk/typescript/tests-ts/trivy-findings-local.test.ts
index 94e7735bf..77fdb7ec9 100644
--- a/sdk/typescript/tests-ts/trivy-findings-local.test.ts
+++ b/sdk/typescript/tests-ts/trivy-findings-local.test.ts
@@ -72,13 +72,11 @@ test("normalized Trivy headers reject credentials before local or Cloud preparat
repository: "repo-example",
sourceKey: "example/project/main",
};
- const environment = { CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1" };
await expect(
- prepareNormalizedLocalImport(
- input,
- { ...options, sourceRepositoryUrl: foreignUrl },
- { environment },
- ),
+ prepareNormalizedLocalImport(input, {
+ ...options,
+ sourceRepositoryUrl: foreignUrl,
+ }),
).rejects.toThrow("--source-repository-url");
input.report = trivyRepositoryHeader(
"https://scanner:[email protected]/example/other",
@@ -88,7 +86,6 @@ test("normalized Trivy headers reject credentials before local or Cloud preparat
await expect(local.prepare(input)).rejects.toThrow(error);
await expect(
prepareNormalizedExternalPublication(input, options, {
- environment,
credentials: async () => {
throw new Error("Unexpected Cloud authentication");
},
diff --git a/sdk/typescript/tests-ts/wiz-findings.test.ts b/sdk/typescript/tests-ts/wiz-findings.test.ts
index e50d5ef04..923f125a4 100644
--- a/sdk/typescript/tests-ts/wiz-findings.test.ts
+++ b/sdk/typescript/tests-ts/wiz-findings.test.ts
@@ -569,7 +569,6 @@ async function cloudFixture(payload: unknown) {
const f = await fixture(payload);
const environment = {
...process.env,
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1",
CODEX_HOME: join(f.root, "login"),
CODEX_SECURITY_STATE_DIR: join(f.root, "state"),
};
@@ -1866,7 +1865,6 @@ test("Node resumes the same uncertain publication across locales and Unicode key
const prepared = await prepareExternalPublication(
${JSON.stringify(f.file)}, ${JSON.stringify(f.options)}, {
environment: ${JSON.stringify({
- CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS: "1",
CODEX_HOME: f.environment.CODEX_HOME,
CODEX_SECURITY_STATE_DIR: f.environment.CODEX_SECURITY_STATE_DIR,
})},