Security and privacy
What leaves your machine, and how ocra is isolated.
This page describes the mechanisms; Threat model says what a hostile pull request can try against them and what remains your risk.
What is sent to the model provider
- The reviewer's instructions, the change request title and description, and the diff of the files under review.
AGENTS.mdand matching.ocra/rules.jsonrules.- File content and search results that reviewers request through their tools.
- Accepted findings from
.ocra/memory.jsonfor the files under review. - For verification, each file's findings with its diff and the lines around them; for judging, the findings with the change request's title and description.
The provider is the one each model chain names, or the baseUrl of a provider declared under providers (Model providers). At review time the opencode runtime reaches only your chains' providers and OpenCode's pricing catalog, models.opencode.ai; the direct runtime reaches only the declared endpoints your chains name. The npm installs OpenCode attempts (its plugin package at start, code for a provider it does not ship, see Model providers) go to a registry on your machine that refuses them, so no code is fetched and no npm token is sent. A test runs OpenCode with every other address refused.
Nothing else is added: your global OpenCode configuration, installed skills and project instruction files are disabled, so details of your machine stay out of prompts.
Isolation
- The OpenCode runtime runs on
127.0.0.1with a random port and a random password per run, and keeps its state in a temporary directory that is removed afterwards. - OpenCode runs in an empty directory of its own, not your checkout, with its project configuration off, so plugins, custom tools and settings committed to the reviewed code (
.opencode/,opencode.json) never load; a test checks each protection on its own. - Review tools are served from ocra's own process on
127.0.0.1, protected by a random bearer token. - The runtime receives only system basics and the credentials of the providers in your model chains, not your whole environment.
- All built-in agent tools (shell, file editing, web access) are disabled; reviewers can only read the revision under review.
- Model-requested paths are confined to the repository. Symbolic links are never followed: a link reads as its target path, as git stores it, so
notes.txt -> .envcannot expose.env. A working-tree file reads only under its exact name: another spelling that a case-insensitive file system (macOS's default) would also open finds nothing. - Reviewers cannot read, diff or search likely secret files (
.env, keys, certificates, cloud and registry credentials, Terraform variables and state), a file renamed away from such a name, or anything under.git/, under any spelling (case, Unicode case variants, invisible characters), whatever a prompt asks. The same patterns keep those files out of review. - Session logs and
--outputfiles are never written through a symbolic link planted in the reviewed tree.
Untrusted input
Pull request text, diffs, repository files, rules, guidelines, tool results, SARIF logs passed with --import-sarif, replies to findings, and everything models write about them (findings, plans, relocated quotes) are data; instructions inside them are never followed.
- ocra's own sections are tagged
<ocra_…>. Text in the data that could form such a tag (look-alike brackets and letters, fullwidth and other compatibility forms, spacing, case and invisible characters included) is rewritten to‹ocra_…, and a<that ends a field becomes‹, so two fields cannot form a tag where they meet: data can neither leave its section nor pose as another finding. Ordinary HTML and XML in reviewed code pass unchanged. - Pull request titles and descriptions are capped in length; a reviewer reports at most 50 findings per task, with bounded text.
- Terminal output (findings, commit messages, errors) has control characters, escape sequences and bidirectional overrides replaced, so a change cannot rewrite your screen, hide a finding or write to your clipboard. JSON output (
--format json, session reports and logs) escapes the same characters. --resumereuses only results ocra on this machine sealed with your own key, kept outside every repository, so a session committed with a change cannot pass itself off as an earlier review. It reads the session log without following links and only up to a size bound.
The verdict is not a security gate
Shared configuration
extends fetches settings and rules over https only, never plugins, and can be pinned with #sha256=. For pull requests it is read from the base commit like the rest of the configuration.
Keys
Provider keys are read from environment variables only and never written to configuration, logs or session files. Secret files in the repository are unreadable to reviewers (Isolation), so their contents cannot reach prompts, reports or session files.
CI
- Store keys as CI secrets.
ocra review --pr, the GitHub Action andocra review --mrread.ocra/config.json,.ocra/rules.jsonandAGENTS.mdfrom the base commit and never load repository plugins (GitHub, GitLab).- Pull requests from forks run on
pull_request_target, which gives the job your secrets: acceptable only because ocra runs nothing from the pull request, so never add a step that does.
Reviewing code you do not trust
.ocra/config.json can list plugins, and plugins run code. ocra review --no-repo-config ignores that file and takes models from OCRA_MODEL_*. .ocra/memory.json (which can silence findings), .ocra/rules.json and AGENTS.md then come from the --from commit with --from/--to, and are otherwise not used. ocra-eval always passes it.
Reporting a vulnerability
Report it privately through GitHub, never in a public issue: SECURITY.md says what is in scope and what happens next.