Use import sonar to collect security issues for one project and branch or
pull request. A --dry-run with either live issues or a saved capture writes a private evidence copy and returns its path. Pass that path to confirm the reviewed selection.
Replay it without signing in to Sonar. If you already have issue-search JSON,
preview the native export.
From the matching checkout, run sonar auth login with browse access to the project's Sonar
organization. Sonar CLI authentication
Preview live issues. Copy the project and issue keys from Sonar's Issues view or the SonarQube plugin for Codex. Replace the example keys and branch.
codex-security import sonar --sonar-project example_project --sonar-branch main \
--sonar-issue ISSUE_A --sonar-issue ISSUE_B --dry-run --format jsonRepeated --sonar-issue selects the requested security issues regardless of
status. Omit it to collect open and confirmed security issues for the selected
ref. For a pull request, replace --sonar-branch main with
--sonar-pull-request 42. Omit both to use the project's main branch.
Check the repository and ref. Compare the issue keys in
local.findings[].source_finding_id and any local.excluded entries with
your selection. Keep the private path returned in capture to
save locally or save locally and publish to Cloud.
From the same checkout, pass the local preview's capture
path. Omit --yes for an interactive prompt. In a script, use --yes
after review.
codex-security import sonar "/path/from/local-preview.json" --yesSign in to Cloud
on a deployment that accepts the sonar provider. Preview the connected
repository from the local capture.
codex-security import sonar "/path/from/local-preview.json" --to cloud --dry-run --format jsonCheck the account, repository and any environment listed in cloud. Confirm
with the new capture path from the successful Cloud preview.
codex-security import sonar "/path/from/cloud-preview.json" --to cloud --yes --format jsonFor readback and verification, use
the preview's local repository path. Check cloud and any cloudError
if you published.
If the checkout, state directory or Cloud destination changes, preview the capture again. To resume an interrupted upload, reuse the approved capture and destination.
Omit --sonar-project only when the checkout's Git origin maps to exactly
one project in the active organization. For a monorepo, supply the project
key. If a search exceeds 10,000 results, select issue keys.
SonarQube plugin · Codex Security import workflow
If Sonar lacks a repository binding, Git uses an SSH host alias or Cloud
finds no usable remote, verify the project's Git URL in Sonar. Pass it as
--source-repository-url when previewing the capture. At least one
comparable remote must match if the checkout has any. Preview again if a
fetch URL changes.
Each issue key identifies one record within its source and repository.
The title is the rule name when available, otherwise the rule key. The
description is the issue message. Severity comes from the security impact,
or the native severity for a legacy vulnerability. The capture supplies a
link to that issue on the selected branch or pull request. The primary file
range requires a verified project base directory. Other flow locations and
their messages remain in the original issue under evidence.source_data.issue.flows.
Supply one complete GET /api/issues/search page or an ordered array of
all pages for one project and ref. Pages can omit repository and ref context.
Run this preview from the checkout root with the verified repository URL.
The example starts a new source key.
codex-security publish findings ../reports/sonar-pages.json --provider sonar \
--to local --repository . --source-repository-url https://github.com/example/project \
--source-key sonarcloud.io/example/example_project/branch/main --dry-run --format jsonTo update issues from a capture, pass its preview's repository path and
exact sourceKey (sonar:<hash>) as --repository and --source-key.
Check source.source_key in the file preview or sourceKey on a stored
record. Native pages replace matching evidence and can omit issue URLs and
repository-relative locations. Replay the capture to retain those fields,
or use another key to keep both versions.
Save or publish the native report and verify the result