Threat model
What a hostile pull request can try, what stops it, and what ocra does not protect against.
ocra is built to review pull requests from strangers. This page lists what such a pull request can try, what stops it, and what remains your risk; Security and privacy describes the mechanisms.
It covers the GitHub Action and ocra review --pr, ocra review --mr, and local reviews with --no-repo-config. A plain local review trusts the checkout's .ocra/config.json, plugins included: pass --no-repo-config for code you do not trust.
What is protected
- Your secrets: the model key, the GitHub token, and any file outside the reviewed revision or that looks like a secret.
- Your runner or machine: ocra runs nothing from the pull request.
- Your repository: ocra posts review comments and, if configured, requests or withdraws changes; nothing else.
- What ocra posts: a pull request cannot make ocra's comments hide a link's target, show images, mention people, carry hidden markup or issue commands.
- Your spend: every loop over a model has a cap.
Not promised: a correct verdict. The models read the pull request, so they can be steered, and they can be wrong.
Who can attack
| Who | What they control |
|---|---|
| The author of a pull request, from a fork or a branch | The diff and every file at its head (including .ocra/, .opencode/ and AGENTS.md), file names, commit messages, the title and the description |
| Anyone who can comment | Replies and review comments on the pull request |
| Someone with push access to your repository (on GitLab, the Developer role) | All of the above, and the pipelines their branches run: any workflow they push on GitHub, the merge request's .gitlab-ci.yml on GitLab (who controls the pipeline) |
| The model provider | Everything ocra sends it (what is sent) |
| A compromised package or registry account | Code that ocra installs |
Attacks and what stops them
| The pull request tries to | What stops it |
|---|---|
Run code: plugins in .ocra/config.json, OpenCode plugins or tools in .opencode/, install scripts, git drivers | Configuration, rules, memory and AGENTS.md come from the base commit; repository plugins never load for pull requests; OpenCode's project configuration is off. ocra never checks out, installs or builds the pull request, and git reads it with external diff drivers and text conversion off and without your model keys in its environment. |
| Read secrets through a reviewer | Reviewers can only read the reviewed revision, inside the repository, without following links, and never secret-looking files or .git/ (Isolation). OpenCode's process gets system basics and the model provider's credentials only (plus names you list in OCRA_RUNTIME_ENV), never GITHUB_TOKEN or other CI variables. |
Keep its changes out of review by marking them binary in .gitattributes | git takes attributes from the base commit (git 2.41 or later). With an older git the change's own attributes apply, and the run warns about each file whose name says text but that was skipped as binary. |
| Get a secret into ocra's comments | No secret reaches a prompt, so no model can repeat one. |
| Hide an issue or argue a finding away (prompt injection) | Everything reaches models as data, and look-alikes of ocra's own sections are rewritten (Untrusted input). Only confirmed critical findings can block, and the judge can neither drop nor downgrade them. This limits steering; it does not prevent it. |
| Forge a command or a dismissal | Only someone with write access other than the author counts, never through a comment someone else edited. An override names the full head commit id. A thread counts only while nobody else has edited ocra's comment in it, so its finding cannot be swapped. |
| Plant markup or links in ocra's comments | Model text cannot close ocra's markup, embed images or HTML, mention people (also not through a character reference such as @), spell one of ocra's commands, start a line with a slash (a GitLab quick action such as /merge), or become a link: addresses of any scheme are shown as text. Quoted code in a closed backtick fence, a one-line inline span or an indented block after a blank line is posted as written, since code renders none of these. What is code is found by parsing the text as CommonMark with GitHub's tables, as both platforms do; outside it every <, unescaped backtick and dollar sign is shown as text, so no HTML, math or later span can change what is code. GitLab's wikilinks ([[…]]) are broken too, and a fence that would post a committable suggestion of the model's own; ocra posts suggestions only under its own rules. |
| Tamper with the state in ocra's summary comment | State counts only when ocra's account posted the comment and edited it last; it is validated and size-capped. |
| Rewrite your terminal (local runs) | Control characters, escape sequences and bidirectional overrides are replaced in all output, JSON included. |
Pass off committed session files as an earlier review (--resume, local runs) | Only session lines sealed with your own key, kept outside every repository, are reused; a session without them is refused (Sessions). |
| Run up your model bill | 30 steps per task, 60 tasks per run, bounded reads and tool answers, 50 findings per task, and --max-cost-usd per run. In CI, also limit who can start a review (pull requests from forks). |
The defenses are covered by tests next to the code, in the repository.
Who controls the pipeline
ocra's rules against the author (no dismissal, no override, no forged earlier review) hold only while the author can neither change the job that runs ocra nor read its secrets.
GitHub. A fork's pull request gets no secrets on pull_request, and on pull_request_target the workflow comes from your default branch: either way the review is out of its author's reach. A workflow pushed by someone with push access, though, gets the repository's secrets and a GITHUB_TOKEN posting as github-actions[bot], the account ocra trusts by default, so they could read the model key or forge ocra's summary. GitHub pull requests shows the setup that prevents both: pull_request_target, secrets in an environment only the default branch may use, comments from a GitHub App that ocra trusts instead, and code owner review for .github/workflows.
GitLab. A fork's merge request runs its pipeline in the fork, without your variables. A merge request from a branch of your project runs a pipeline its author wrote, and every job can read the project's unprotected variables: its review is advice its author can forge (GitLab merge requests). A pipeline execution policy (GitLab Ultimate) protects the job, not the token.
A design, not tried yet: a separate reviewer project only maintainers can change, started by a merge request webhook through a pipeline trigger, running on its protected default branch with the token and model key as protected variables, and reading the merge request as data. Developers could neither change the review nor read its secrets. Its result would not be the merge request pipeline's status, so approval rules would still gate merging.
ocra Cloud
This applies only while you are signed in (ocra login) and OCRA_CLOUD is not off; a review that is not signed in never contacts ocra Cloud. What it holds and keeps is in its data policy; the decisions are ADR-0024, ADR-0027 and ADR-0028.
| Who | What they control |
|---|---|
| ocra Cloud, or whoever compromises it | Your account's settings, rules, plugin names and memory as the CLI fetches them; calls to ocra-<provider>/<model> models, which pass its gateway with your stored keys; the counts, and shared findings, the CLI sends |
| Someone holding your terminal's session token | Model calls through the gateway with your stored keys, up to the account's daily cap |
| Someone holding your browser session | Your settings, rules, plugin names and memory, whether findings are shared, deleting your stored keys, adding a key for a provider that has none, and approving an ocra login code, which gives the terminal-session access above. Replacing a stored key, deleting the account, and turning sharing off together with deleting the shared findings need a sign-in within the last 15 minutes. A browser session ends after 7 days unused, and 30 days after sign-in at the latest. |
| They try to | What stops it |
|---|---|
| Send your code or a local key to a server of their choosing | The CLI drops providers, extends and key variables from account settings, whatever the server sends. An account model must be ocra-<provider>/<model>, which reaches only the gateway's fixed list of providers, through a path the server lists only if it has no . or .. segment. |
| Run code on your machine | An account-named plugin loads only if you installed and allowed that exact version on this machine (ocra plugins allow), from that directory, after an integrity check; never in --pr or --mr reviews or with --no-repo-config. An unknown runtime name is dropped. |
| Read your stored provider keys | They are encrypted under a master key kept apart from the database and never returned, to a terminal or a browser session. |
| Weaken or inflate reviews through settings and rules | Your repository's configuration, spend limit included, wins over the account's; the gateway's daily cap and your provider's limit bound cost. An exclude in your configuration, even [], keeps the account's out, since a file it excludes is neither reviewed nor counted as unreviewed. ocra review --plan shows each setting's source, the report records the settings version and every rule's source, and the web keeps every saved version. |
| Hide findings through memory | Account memory applies only to its repository and only while signed in; the terminal, report and pull request summary count the findings it hid, apart from .ocra/memory.json. |
| Read your code | Only what you route through the gateway (ocra- models) passes it, in memory; it stores counts, and findings with their quoted code only when you turn sharing on and the machine signed in (ocra login) while it was on, after secret-looking tokens are redacted on your machine; the login records that machine's consent, so the server alone cannot turn sharing on. The repository is sent as a salted hash. |
A stolen terminal session cannot change settings or read keys; revoking it on the web's sessions page stops its refresh token at once. A signed-in review of an untrusted pull request still takes the base commit's configuration, with your account's settings and memory under it and no account plugins.
What ocra does not protect against
- Steering. A clean verdict proves nothing (why).
- The model provider. It sees the code under review; choose one whose data policy you accept.
- Bugs in ocra or what it builds on. ocra, OpenCode, git and Node.js all process the pull request, and a flaw would run with your model key and token present. Limit what it could reach: a review-only model key with a spending limit, and the token permissions in the examples.
- Your own workflow. A step that checks out and installs, builds or tests the pull request in a job with your secrets undoes everything above.
- Push access, unless the pipeline is set up as above.
- The supply chain. The Action installs the published ocra with dependencies pinned by its lockfile, install scripts off and registry signatures checked (GitHub Action); ocra's packages carry provenance, and OpenCode is pinned with its built-in tools checked by a test. A stolen npm login could still publish a bad version, which two-factor authentication with a security key makes hard. Pin the Action by commit.