Skip to content

security: harden the action against fork PRs, prompt injection and mutable pins - #56

Merged
yi-here merged 28 commits into
mainfrom
claude/blissful-clarke-wpj2wn
Oct 31, 2026
Merged

yi-here merged 28 commits into
mainfrom
claude/blissful-clarke-wpj2wn

Conversation

@yi-here

@yi-here yi-here commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes from an internal security review of OrcaCode Review. This PR hardens the action against outsiders' pull requests, prompt-injected review output, key exposure and supply-chain drift. It does so without breaking existing customer workflows. Every change was made test-first: the suite went from 567 to 1019 tests, all passing.

What changes

Who can trigger a paid review

  • Author gate: on public repos, auto-review-authors now defaults to OWNER, MEMBER and COLLABORATOR. Private repos keep reviewing everyone. Use "*" or the full association list for everyone; the installer's "Everyone" option writes the full list, which v1.6.0 also reads correctly.
  • Comment commands: the action now checks the commenter's association itself (OWNER/MEMBER/COLLABORATOR) instead of relying only on the workflow's if:.
  • Event allowlist: reviewer comments (pull_request_review*) no longer trigger paid reviews. Any other event is a green no-op with a notice.
  • Fork pushes: on a fork synchronize, a pusher other than the author needs write access.
  • Fork comment commands: they must name the current head (/orcacode-review <sha≥7>), so a fork can't swap code between the command and the run.

Merge-gate integrity

  • Head-SHA status: a new "OrcaCode Review" commit status is written on the head SHA. It needs statuses: write; without it the action warns. Comment runs write it too.
  • Skips: skipped reviews keep a green job, as before (on-skipped-review: "pass" is the default), but the status says "Not reviewed: ". Teams that require the status are protected; teams that require the job see no change.
  • Concurrency: set per job, with comment runs in their own group, so a commenter can't cancel an in-flight review.
  • Gate exit: passes only on the explicit pass code. A crash or an unreadable result fails closed.
  • Settings errors: a 4xx (an ordinary, non-CI key) or an outage falls back to the workflow's own inputs, with a notice naming the cause. It never loosens or escalates beyond them.
  • Dedupe: keeps the highest severity, and the judge can't drop P0 or security findings.
  • Lockfiles: the oversized-diff guard ignores the nine standard lockfile names. Excluded lockfiles are listed in the summary.

Key exposure and output

  • Placeholder key: the engine sees only a placeholder. The loopback fact-proxy injects the real key, read from a 0600 file it deletes before the engine starts. The proxy is pinned to one https origin (plain http only to loopback).
  • Checkout hardening: every symlink is deleted, and the repo's .gitattributes are neutralized for the diff.
  • Publish guard: one sanitizer covers every posting path. It breaks @mentions, renders HTML as text, removes HTML comments and forged markers, defangs off-repo links, and caps findings and lengths. It also redacts the key and token in raw, base64, base64url, hex, URL-encoded and Basic-auth forms, ignoring invisible characters. Tests check it against micromark + GFM over a corpus plus a 3000-seed fuzz.
  • Marker comments: matched only on the action's own identity, through one funnel (bot-login input, then the token user, then the default token, then the author of the action's first post in the run).
  • Job token: never on argv or in step scripts. It now travels in GIT_CONFIG_*.
  • Guardrail-block comments: policy details are hidden on public repos.

Supply chain and releases

  • Engine install: the tarball is checked against a pinned sha512, the binary against a pinned sha256, with --ignore-scripts.
  • Actions: every uses: is SHA-pinned with a # vX.Y.Z comment, and .github/dependabot.yml is added.
  • Release tags: v1.<n> tags are immutable. v1 advances only by a fast-forward (force=false) ref update.
  • Pins: the installer, example workflow, skill asset and README all pin one SHA, and scripts/doc-pins.mjs blocks publishing docs that describe a newer version than the pin.

Customer-visible changes (also in README → Upgrading)

  • Unchanged for most workflows: skips stay green and the job check behaves as before.
  • Public repos: auto-review only maintainers unless auto-review-authors is set.
  • Fork PRs: comment commands must name the head SHA.
  • Gateway URL: a plain-http gateway that isn't loopback now fails at once with a fix message.
  • Settings outage: a 4xx or an outage now uses the workflow's inputs.
  • New inputs: on-skipped-review, status-context, bot-login. The new status needs statuses: write.
  • Self-hosted runners: need git ≥ 2.31 for private-repo fetches.

After merge (needs a maintainer or admin)

  1. Tag the release (e.g. v1.7.0). Bump ACTION_SHA/ACTION_VERSION in bin/orcacode-review.mjs and the same pin in the example workflow, skill asset and README. Remove the "from v1.7.0 (unreleased)" markers. release-pin and doc-pins enforce this.
  2. Admin: add a tag ruleset on v* (no updates, deletions or force pushes; admin-only bypass to advance v1) and turn on immutable releases.
  3. Gateway: bump the pinned action SHA in OrcaRouter's generated workflow; that's a separate PR in OrcaRouter-O2.

Testing

  • npm ci --ignore-scripts && npm test: 1019 passing.
  • New exact-pinned dev dependencies: yaml@2.9.1, micromark@4.0.2, micromark-extension-gfm@3.0.0. None has install scripts.
  • Not tested: nothing was run on a real GitHub runner. The github.token comparison inside a composite action and the permission API with the default token are covered only by fakes.

Generated by Claude Code

claude added 28 commits October 31, 2026 03:47
… (CR-13)

Two comments in run: blocks named the github.token expression with its
braces, so GitHub expanded the live token into the step script it writes
to disk. The PR-head fetch passed the Basic-auth header with
`git -c http.extraheader=...`, which puts the token on argv where any
process on a shared runner can read it from /proc/<pid>/cmdline.

The comments now name the expression without braces, and the fetch
carries the header through GIT_CONFIG_COUNT/KEY/VALUE (git >= 2.31),
scoped to the server URL.

Adds the `yaml` parser as a dev-only dependency (exact pin, lockfile
integrity, `npm ci --ignore-scripts` in CI) so structural tests read
action.yml and the shipped workflows through a parser instead of regexes,
and a helper that runs a step's bash or github-script body with doubles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…-16)

The enforce step read every non-zero gate.mjs exit as "no blocking
finding", and gate.mjs itself exited 1 on an unreadable result. Node also
exits 1 on any uncaught exception, so a crashed gate, a missing or
garbled result, or a killed process all passed the merge gate.

gate.mjs now answers with distinct codes: 0 = a blocking finding,
10 = none, 2 = usage, 3 = the result could not be read (including a
result with no comments array). The enforce step accepts only 0 and 10
as answers and fails closed on anything else; the summary and the run
report treat anything but 10 as blocked, matching what the enforce step
does.

The old gate.test.mjs case "missing / unparseable file -> no match
(exit 1)" pinned the fail-open behaviour and now expects exit 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…it (CR-16)

On any settings outage settings.mjs wrote its built-in defaults, and the
action used block_on=P0,P1 from them whenever the workflow left block-on
at its default. A workspace whose dashboard blocks on P2 silently lost
that policy for the run.

settings.mjs now names every stand-in value in `unresolved` (every field
on an envelope failure, the one field on a field failure; absent when
the server answered validly). The settings step reads it: an explicit
workflow block-on stays authoritative, but a workflow that defers to the
dashboard blocks on every severity (P0,P1,P2,P3) while the dashboard's
block_on is unknown, with a warning annotation. A settings file that
cannot be read at all counts as unresolved.

settings.test.mjs expectations for the fallback file now include the
`unresolved` marker (the shape changed; the fail-open-for-reviews
behaviour it pins is unchanged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…of the engine (CR-16, CR-4)

fact-proxy resolved the client's request target with
`new URL(req.url, upstream)`, so an absolute-form (`http://host/...`),
scheme-relative (`//host/...`) or backslash target was forwarded to that
other host with the client's Authorization; an http: upstream was
accepted for any host. Meanwhile the engine that reads the fork checkout
ran with the real OrcaRouter key in OCR_LLM_TOKEN, and its parent shell's
environment (readable by the same user via /proc) held it too.

The proxy now:
- accepts only origin-form targets equal to the configured endpoint's
  path (anything else is answered 404 and dials nothing), always to the
  configured origin;
- refuses a non-https upstream unless the host is loopback;
- reads its key from CR_UPSTREAM_KEY_FILE, unlinks the file before it
  prints PROXY_URL, and replaces the client's Authorization (and drops
  x-api-key) with it. The key is deliberately not taken from the
  environment: /proc/<pid>/environ is readable by the engine's user.

action.yml stages the key in a 0600 file in a step that runs nothing from
the PR; the Review step's env carries no secret, the engine and the judge
get a placeholder token, and the step refuses to start the engine while
the key file still exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…R-14)

The engine read a fork checkout in which:
- symlinks were left in place (only .opencodereview was removed), so a
  committed `notes.md -> /proc/self/environ` pointed its file tools
  outside the repository;
- the PR's .gitattributes applied, so `* -diff` (or the `binary` macro)
  turned every change into "Binary files differ" for both the size
  guard and the engine;
- the root .gitignore was the PR's, and the engine reads it to decide
  what to skip, so a PR could ignore its own changes;
- files the engine skips by default (tests, fixtures, snapshots,
  generated code, unsupported types, binaries) vanished from the review
  without a word.

New scripts/harden-checkout.mjs, run by a new "Harden the checkout" step
after the PR-head fetch and again right before the engine: deletes every
symlink (tracked mode 120000 and untracked, files and directories), writes
`* !diff` to $GIT_DIR/info/attributes so repository attributes lose their
say over diffing (works on any git, unlike GIT_ATTR_SOURCE), removes
.opencodereview/, and restores the base revision's .gitignore. Exits 1 if
any of that fails.

New scripts/excluded-files.mjs lists the changed files the engine skips,
with the engine's own rules (bin/selection.mjs over the vendored data),
capped at 200; the summary renders them in a collapsible "Not reviewed"
block with file names neutralised for markdown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…ion posts (CR-7, CR-4, CR-20)

Finding text and file paths were posted as raw markdown: a finding
written under a fork's influence could @mention teams, render HTML
(<img>, <details>, comments forging the action's own markers), link
anywhere, print a fake "## OrcaCode Review ... No findings" heading and
run to any length; a path with a backtick broke out of its code span.
Nothing redacted the OrcaRouter key or the GitHub token from what was
posted. The guardrail-block comment published the workspace policy name
and up to 300 characters of match detail on public PRs.

New scripts/publish-guard.mjs, used by every github-script step that
posts (review, fallback comment, notices, PR description):
- sanitizeUntrusted() for each fragment of finding text: strips HTML
  comments, escapes HTML and link brackets outside code, defangs URLs
  not pointing into this repository or the OrcaRouter docs host,
  neutralises @mentions with a zero-width joiner, demotes forged
  headings, caps length, leaves code spans and fences intact and closes
  a fence a fragment left open. Errs only towards escaping. Applied to
  titles and bodies after they are split, so a split cannot cut a code
  span in half.
- codeSpan() for file paths.
- guardGithub() wraps the client so every posting call redacts the key
  and the token: raw, base64 at any alignment within a longer run,
  base64url, URL-encoded, and the Basic-auth value.
- at most 50 findings are posted (most severe first; the rest counted
  in the review body) and bodies stay under GitHub's size limit.

The guardrail/firewall notice is generic on public repositories (and
when visibility is unknown); private repositories keep the sanitised
policy name and detail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…cannot drop P0 or security findings (CR-8)

Three stages between the engine and the gate fold findings together and
each kept whichever copy it met first, tag stripped for comparison:
postfilter's content dedupe, exhaustive-merge's file+line+content key,
and the L2 judge's one-representative-per-cluster. A "[P3] x" seen first
swallowed the "[P0] x" after it; a cluster represented by its P3 lost the
P0 inside it. The judge could also drop any cluster, P0s included, on a
model's verdict over text the PR shaped.

- severity.mjs gains RANK, moreSevere(), withSeverity() and
  isSecurityFinding() (a deliberately broad keyword match: a false
  positive only keeps a finding).
- postfilter and exhaustive-merge keep the first copy's location but the
  most severe tag among the duplicates; exhaustive-merge's stdout
  contract ({"new_findings":N}) is unchanged, upgrades are logged.
- judge.mjs raises a kept representative to its cluster's most severe
  tag, and keeps a cluster it would drop when it holds a P0 or a
  security finding (the judge's representative if protected, else the
  most severe protected member), logged as KEEP*.

exhaustive-merge.test.mjs pinned "the base's tag wins" for exactly the
P2-then-P0 case; it now expects the more severe tag, plus a new case that
a less severe repeat never lowers it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…no green skips, verdict on the head SHA (CR-12, CR-2, CR-5)

CR-12: the action relied on the workflow's `if:` to keep outsiders'
comments out, and the README quickstart shows a bare `uses:` with no
such `if:`. "Resolve PR refs" now refuses an issue_comment run unless it
is on a pull request, the comment is the review command (followed by
whitespace or the end), and the commenter is OWNER, MEMBER or
COLLABORATOR. A refusal sets run=false and every later step is gated on
it (a quiet no-op: nothing is spent, nothing attaches to the PR). An
`edited` PR event runs only when the base changed. All steps now gate
positively on `decision == 'review'` instead of `!= 'skip'`, so a missing
decision runs nothing.

CR-2: auto-review-authors defaulted to everyone, so any outsider's fork
PR on a public repo spent the wallet. Unset now means
OWNER,MEMBER,COLLABORATOR on a public repository (and when visibility is
unknown); private repositories keep "everyone"; "*" opts back in.

CR-5: every settings skip ended green, and an on-demand review's verdict
landed on the default branch's check. New input on-skipped-review
("fail" by default, "pass" for advisory) mirrors on-oversized-diff; new
input status-context (default "OrcaCode Review", empty disables) names a
commit status written on the PR head SHA on every ending, comment runs
included — success only when a review ran on that head and the gate
passed, or a skip was made advisory (scripts/review-status.mjs). A
missing statuses permission warns instead of failing.

settings.test.mjs: "an empty allowlist allows everyone" pinned the
public-repo default; it now runs as the private case, with a new public
case beside it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…ses: write (CR-6, CR-5)

All three workflow copies (workflows/orca-code-review.yml, the skill's
assets/workflow.yml, and the installer's renderWorkflow):

- CR-6: drop the workflow-level concurrency group. With
  cancel-in-progress, every comment on the PR started a run in the same
  group and cancelled the in-flight review before its own job was
  skipped, so any commenter could cancel reviews. Concurrency is now on
  the job, with comment runs in a group of their own that never cancels;
  push runs still supersede each other per PR.
- CR-5: pull_request_target also triggers on `reopened` and `edited`;
  the job's `if:` lets `edited` through only when github.event.changes.base
  is set, so retargeting a PR re-reviews it against the new base and a
  title edit does not.
- `statuses: write`, so the action can put its verdict on the PR head
  for comment-triggered runs too.

installer.test.mjs compared a top-level `concurrency:` section between the
example and the skill template; that block must no longer exist, so the
test now compares the parsed on/permissions/job concurrency/job if of all
three copies, the installer's included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…nts (CR-15)

The upserts and the stale-notice sweep found the action's comments by an
HTML marker (<!-- orca-code-review-disabled|skip|block|summary -->) in ANY
comment, so anyone able to comment on the PR could plant a marker and get
the action to edit or delete their comment, or keep a real notice stale.

"Resolve PR refs" resolves the token's identity once (the user of a
personal token via users.getAuthenticated; github-actions[bot] for the
default GITHUB_TOKEN, where that call is refused) and outputs bot_login.
Every marker lookup — the settings-skip and oversized notices, the
guardrail notice, and the summary step's sweep — now matches only
comments authored by that login; with no login nothing matches (post
anew, edit and delete nothing).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…A-pin every action (CR-9)

`npm install -g "@alibaba-group/open-code-review@${ENGINE_VERSION}"`
pinned only the top-level version, ran the package's postinstall (which
downloads the ~40 MB Go engine binary and checks it against a checksum
file fetched from the same release, i.e. no independent pin) and checked
no integrity. The composite's own steps used tags (github-script@v7,
setup-node@v4, checkout@v4).

- New scripts/engine-pins.json pins, per engine version, the npm
  tarball's sha512 SRI and each platform binary's URL and sha256. 1.3.13:
  integrity from `npm view ... dist.integrity`, re-computed locally from
  the packed tarball; linux-x64/arm64 sha256 computed from the downloaded
  release assets (they match the release's sha256sum.txt); darwin values
  from that sha256sum.txt.
- New scripts/install-engine.mjs: refuses an unpinned version or
  platform; `npm pack --ignore-scripts`, verifies the tarball's sha512
  before use; downloads the binary with curl (https-only, redirects
  included) and verifies its sha256; installs the verified tarball with
  `npm install -g --ignore-scripts --offline` into $RUNNER_TEMP/ocr-engine
  and places the binary beside the wrapper. Any failure exits 1 and
  removes the prefix. The install step puts <prefix>/bin on GITHUB_PATH.
- Every `uses:` in action.yml and .github/workflows is pinned to the
  commit its current major tag points at, with a `# vX.Y.Z` comment:
  github-script f28e40c7 (v7.1.0), setup-node 49933ea5 (v4.4.0),
  checkout 11d5960a (v4.4.0).

Behaviour change: an engine-version without pins now fails the run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…ve a version tag (CR-3, CR-12)

RELEASE.md told maintainers to force-move v1 and to re-tag "immutable"
v1.<n> tags with a force push, and the installer, the example workflow,
the skill's asset and the README all pinned @v1 — so whoever could move
the tag decided what ran, with the customer's key, in every repository
that pinned it. The README quickstart also showed a bare `uses:` step
with no comment gate (CR-12).

- bin/orcacode-review.mjs exports ACTION_SHA / ACTION_VERSION (the
  v1.6.0 release commit this branch builds on, 6d253e0) and renders
  `uses: Continuum-AI-Corp/orca-code-review@<sha> # v1.6.0`; the example,
  the skill asset and the README quickstart carry the same line, held
  together by scripts/release-pin.test.mjs (comments read through the
  YAML document model). Customers' Dependabot reads the comment and
  offers new releases as PRs.
- The README quickstart is now the complete gated workflow (triggers,
  permissions incl. statuses: write, job-level concurrency, the
  maintainer-only comment `if:`), and "Block merges" names the
  "OrcaCode Review" commit status as the check to require.
- RELEASE.md: a release is a new annotated v1.<n>.<p> tag pushed once and
  never moved; the pins are bumped in a follow-up PR; `v1` is legacy and
  only advanced to an already-released descendant by an admin through a
  ruleset bypass; documents the tag ruleset and immutable releases as
  one-time administrator settings.
- publish.yml's gate verifies the installer's pinned commit exists, is the
  commit tagged ACTION_VERSION, and ships settings.mjs/report.mjs,
  instead of inspecting the v1 tag.
- .github/dependabot.yml: weekly github-actions updates for this repo's
  own pinned actions.

installer.test.mjs pinned the module's export list; it now includes
ACTION_SHA and ACTION_VERSION.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
With unset auto-review-authors now meaning OWNER,MEMBER,COLLABORATOR on a
public repository, the installer's public-repo "Everyone" answer (value
"") equalled the default, was omitted from the generated workflow, and
would silently have meant maintainers only. It now writes the explicit
"*" opt-out. The answers move into an exported authorChoices() so a test
can hold them; the module's export-list test gains it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…iour (CR-20)

SECURITY.md overstated engine pinning (only the top-level npm version
was pinned), claimed the key "never appears in comments" with nothing
enforcing it, and did not say the action rewrites the PR description.
It now describes the code as it is after this series: the checkout
hardening, the engine holding no credential and the proxy injecting the
key, the pinned origin, the posting funnel (sanitising + redaction), the
generic guardrail notice on public repos, who can make the action spend
(public-repo author default, the action's own comment check, per-job
concurrency), the fail-closed merge gate and the status to require, the
verified engine install and SHA pins, the release-tag policy and the
administrator settings it depends on, and the residual self-hosted risk.

README: the "Block merges" section (in the release-pin commit) names the
OrcaCode Review status; a new "Upgrading: behaviour changes" table lists
every change a customer will notice and how to keep the old behaviour
where that is safe; "Re-run a review" says only maintainers can.

Skill references (inputs.md, troubleshooting.md, SKILL.md): new inputs
on-skipped-review and status-context, the visibility-dependent
auto-review-authors default and the "*" opt-out, the required status
instead of the `review` job, pinned release commits instead of @v1, and
the two new symptoms (red check on a skip, ignored command).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…r's own variables

runBashStep / runBashStepAsync started each step from ...process.env and
runGithubScript ran with process.env as it was, so on a CI runner a step
under test wrote its outputs into the TEST job's GITHUB_OUTPUT / GITHUB_ENV
/ GITHUB_PATH / step summary, wrote into its RUNNER_TEMP, and read
GITHUB_EVENT_NAME=push from the test workflow. Every helper now starts from
cleanEnv() — process.env minus GITHUB_*, RUNNER_*, ACTIONS_* — and a test
passes what it means explicitly; runGithubScript removes them for the
script's duration and restores them after. The two suites that run
fragments of step bodies directly use cleanEnv() too.

scripts/test-isolation.test.mjs plants a parent GITHUB_OUTPUT (and the
other workflow-command files, RUNNER_TEMP and event/identity variables) and
proves no step output or file reaches them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…eal CommonMark+GFM parser

The sanitizer treated `\` + backtick as an escaped backtick even when the
backslash was itself escaped, so
  \\`x` [Approve](https://evil/login) <img src="https://evil/p.png"> `
passed unchanged while GFM renders a live link and image. A setext
underline of one `-` was not escaped either.

A differential test (scripts/sanitizer-render.test.mjs) now renders every
sanitised fragment, placed the way action.yml places finding text, with
micromark + micromark-extension-gfm and asserts no raw HTML, no heading, no
off-site link, and that the text after the fragment is not swallowed — over
a corpus of tricks and a seeded fuzz. It found more of the same class, all
fixed here:
  - backslashes: an escape is `\` + ASCII punctuation (CommonMark's rule);
    a fragment's own `\[` stays an escape (doubling it made `[` live) and any
    other backslash is doubled so it cannot escape a backtick we add;
  - lone backtick runs are escaped, so they cannot re-pair with the backticks
    of a defanged URL's code span;
  - URL runs are taken as GFM's autolink takes them (to whitespace or `<`,
    across backticks); an allowed URL is emitted as an explicit <...>
    autolink; a span is never glued to a preceding backtick (runs merge);
  - headings, setext underlines and tilde fences inside list items and
    quotes are escaped; a fence is trusted only at column 0 (indented, it may
    belong to a list item the renderer closes early);
  - no table can form (a table row cuts code spans open at `|`).
An exploratory 100k-iteration fuzz with a wider alphabet was clean.

micromark@4.0.2 and micromark-extension-gfm@3.0.0 are exact-pinned
devDependencies (36 packages in the lockfile, none with install scripts);
CI installs them with `npm ci --ignore-scripts`. The action never does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…ters

formsOf() covered raw, URL-encoded, base64 (every alignment) and base64url,
but not hex, and a copy with zero-width characters between its letters
reads as the secret and matched nothing. redactSecrets now adds the hex form
(matched in any letter case) and matches against the text with Unicode
format characters (\p{Cf}: ZWSP, ZWJ/ZWNJ, word joiner, BOM, soft hyphen,
bidi marks) ignored, replacing the original span — invisible characters
outside a match are kept, so a sanitised @<ZWJ>mention stays neutralised.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
… says "Not reviewed"

on-skipped-review defaulted to "fail", so on-demand mode, auto-review off,
drafts and (on public repos) outsiders' PRs turned the job red for every
customer, and those who require the `review` job could no longer merge.

The job conclusion for a skip is back to PASS by default, as in every
earlier release; `on-skipped-review: "fail"` still fails it (case and spaces
ignored; any other value passes and warns). The commit status on the PR head
(status-context, needs statuses: write) reports every settings skip as a
failure, "Not reviewed: <reason>", whatever the job does — so a customer
who makes that status required cannot merge an unreviewed PR, and nobody
else regresses. The skip notice says so when the status is on.

Docs (README, SECURITY.md, the skill's inputs/troubleshooting) describe the
job/status split, marked as v1.7.0 (unreleased) behaviour where it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…e workflow's inputs, never more

An ordinary (non-CI) key gets 403 from /api/code_review/settings on every
run, and the action treated that as an outage and blocked on P0-P3 every
time. settings.mjs now classifies a failed fetch in the file it writes:
  status "no_settings" — a 4xx (but 408/429) or success:false; no retry;
  status "unavailable" — 5xx, 408/429, timeout, network error, a body that
                         is not the envelope; after one retry;
with `cause` ("HTTP 403", "timed out after 5000ms", ...).

The "Fetch review settings" step takes ONE workflow-authoritative path for
`settings: "false"`, a 4xx (with a notice) and an outage (with a warning
naming the cause): the workflow's inputs, exactly what settings: "false"
writes. Nothing escalates past the workflow any more; the CR-16 hole (an
outage loosening a stricter dashboard block_on) is closed by documenting the
workflow's block-on as the outage floor. A dashboard that answered with an
invalid block_on uses the workflow's block-on for that field.

Tests: settings.mjs against 400/401/403/404 (no retry), 408/429/500/502/503
(one retry), a server that never answers (CR_SETTINGS_TIMEOUT_MS), a refused
connection; the step with stubbed files; and the step plus the real
settings.mjs end to end against 403, 404, 500 and a hung gateway.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
Every pin (installer ACTION_SHA, example workflow, skill asset, README) is
v1.6.0, which predates this branch. Main must stay consistent with it:

(a) The installer's "Everyone" answer wrote "*", which v1.6.0's allowlist
    gate reads as a list holding only "*" — no automatic review at all (and
    the skill told agents to write the same). It now writes the full
    association list, which both releases read as everyone; "*" stays
    supported in action.yml. scripts/pinned-release.test.mjs runs every
    answer through v1.6.0's gate (a frozen copy, checked against the pinned
    commit where the checkout has it) and the current one.

(b) Doc lines about behaviour only the unreleased action has carry
    "from v1.7.0 (unreleased)" (or sit under a heading that does). The test
    derives the terms — every input action.yml has that v1.6.0 does not,
    plus listed behaviours (the head-SHA status, statuses: write, the key
    proxy, the public-repo author default, the action's own command check,
    engine pins, https-only) — over README, SECURITY.md, the skill and the
    shipped workflows; once ACTION_VERSION reaches v1.7.0 the marker itself
    is refused, so the release bump forces a doc pass. Fixing the docs also
    fixed a live trap: the skill told agents to require the "OrcaCode Review"
    status, which v1.6.0 never writes, blocking every PR; it now requires the
    `review` job and describes the status as from v1.7.0.

(c) RELEASE.md: v1.<n>.<p> tags are immutable; the floating v1 MAY be
    advanced, only by the release step, by an administrator through the
    ruleset bypass, as a fast-forward-only ref update (force=false); the
    recommended customer pin is a full SHA with `# v1.x`. The release step
    now bumps PINNED and the doc markers with the pin. The publish workflow
    runs scripts/doc-pins.mjs on the packed tarball and refuses docs that
    name an action version newer than the pin outside the marker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…cancel

- inputs.md's judge-model default named a model; the action's default is ""
  (the router's recipe picks the judge). A new test compares every input row
  of inputs.md with action.yml — every input present, every stated default
  equal — so the table the skill tells agents to trust cannot drift again.
- inputs.md's github-token row now says it writes the commit status on the
  PR head from v1.7.0 (needs statuses: write).
- publish.yml's fetch-depth comment named a "v1 tag check" that is gone; it
  names the pinned-commit check that needs the history.
- "comment runs never cancel anything" (shipped workflows, the installer's
  template, SECURITY.md, README): GitHub keeps one running and one pending
  job per concurrency group, so a newer comment replaces a comment run still
  pending, never a running one. Every such claim must now say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…never assumed to be github-actions[bot]

When users.getAuthenticated failed — every installation token — the action
assumed github-actions[bot], so a custom App never matched its own markers
(a new notice on every push) and would have treated the workflow bot's
comments as its own. Four steps carried a copy of the check.

scripts/identity.mjs is now the one funnel:
  1. the new `bot-login` input;
  2. else the token's user (getAuthenticated: a personal token);
  3. else github-actions[bot], only when github-token IS the job's own
     token (TOKEN_IS_JOB_TOKEN: inputs.github-token == github.token) — so the
     default case keeps working;
  4. else unknown until the action's first comment or review in this run:
     guardGithub records the author GitHub reports back in
     $RUNNER_TEMP/cr-identity (cleared at the start and end of every run).
Unknown matches nothing. The four marker steps use guard.isOwn (a derived
test refuses any step that lists comments without it), and the reactions
step clears the 👀 of the funnel's identity, not a guessed one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…the input and the fix

The proxy refused a plain-http gateway with a message naming neither the
input nor the fix — and it was the only place that looked: settings.mjs and
report.mjs sent the same key, as a Bearer header, to whatever orcarouter-url
said, plain http included, before the proxy ever ran.

scripts/gateway-url.mjs is now the one judge (OrcaRouter's own rule for
credentials in clear: only to this machine): https anywhere; plain http
only to localhost, 127.0.0.0/8 or [::1] (WHATWG-normalised, so 127.1 counts
and 127.0.0.1.nip.io, 0.0.0.0, ::ffff:… do not). It is asked:
  - by the first step that reads the URL (Fetch review settings), on every
    run, which fails with "::error::orcarouter-url must be https: … Use an
    https:// URL — put TLS in front of a self-hosted gateway — or plain http
    only to this machine (localhost, 127.0.0.0/8 or [::1])";
  - by the proxy (pinnedUpstream), the settings fetch and the run report,
    none of which sends the key where it refuses.
The step fails if it is not handed the judge at all (`node ""` exits 0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
The hardened checkout's `* !diff` stops a fork's .gitattributes from hiding
its change — and with it the `-diff` most repositories put on their
lockfiles, so a dependency bump's megabytes of package-lock.json / go.sum
counted toward max-diff-kb and ordinary PRs skipped (and, by default,
failed) on size.

scripts/guard-diff.mjs now produces the diff the size guard measures: the
same merge-base range, minus files whose NAME is a standard lockfile's
(package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb, go.sum,
Cargo.lock, poetry.lock, composer.lock, Gemfile.lock, at any depth) —
never by an attribute the PR could set, and leaving a file out of the count
can only make the guard review more. It fails open as before. The engine
still reads the hardened checkout's full diff. The lockfiles left out are
written to cr-lockfiles.json (cleared with the other run files), counted in
the guard's outputs, and listed in the PR summary.

Tested through the real Harden and guard steps on a scratch repository
whose only large change is a lockfile (reviewed, not skipped), with
look-alike names still counted and the engine-side diff unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
… successfully, saying why

Only issue_comment went through the comment refusal; every other event fell
into the pull_request* auto-review gate, which is keyed on the PR's author —
so a workflow listening to pull_request_review_comment or
pull_request_review ran a paid review on a maintainer's PR whenever anyone
left a review comment (and push / workflow_dispatch reached pulls.get with
no PR number).

"Resolve PR refs" now runs only on pull_request / pull_request_target
(opened, synchronize, reopened, ready_for_review, edited — edited still only
on a base change) and issue_comment (created). Anything else, including an
edited or deleted comment, is run=false with a notice naming the event and
the allowlist; nothing later runs and the job stays green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…thor

author_association is the PR author's. On a maintainer-opened PR whose head
lives in an outsider's fork, every push the outsider made was a
`synchronize` the author gate waved through — an auto-review on the
workspace's wallet, on a public repository, triggered by someone the gate
never looked at.

"Resolve PR refs" now, on `synchronize` from a head repository other than
the base and pushed by someone other than the PR's author, asks GitHub that
pusher's permission here (repos.getCollaboratorPermissionLevel) and outputs
pusher / pusher_trusted (true | false | n/a; false when GitHub cannot say).
The settings gate auto-reviews only a trusted pusher — unless
auto-review-authors lets everyone through anyway ("*", or unset on a
private repo), where the pusher could have opened a PR of their own. A
refusal is a skip, reported on the head-SHA status as "Not reviewed"; the
author pushing to their own fork, a same-repo head, and events that move no
code are not asked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
… it must still be the head

A maintainer's /orcacode-review reviewed whatever head the PR had when the
run started. On a fork PR the fork's owner can push between the maintainer
reading the change and the review — the maintainer approves spend on code
they never saw, and the verdict lands on it.

When the PR's head repository is not the base repository (a fork, or a
deleted fork), "Resolve PR refs" now requires the command to name the head
commit — `/orcacode-review <sha>`, 7 to 40 hex characters, any spelling of
the command — and runs only while that commit is still the head; the
checkout then pins the full SHA. Otherwise it answers on the PR, through
the publish funnel, with the current head and the exact command to use, and
runs nothing (a successful no-op). A same-repository PR keeps the bare
command; a commit it names is held to the same check. The outsider refusal
still comes first and posts nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
…what changed

action.yml's posture summary names the event allowlist, the fork-command
commit pin, the pusher check, the identity funnel and the gateway-URL judge;
the skill no longer counts its troubleshooting list ("the four") after a
fifth entry joined it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vkCaUqAcSVZ9vVBuuYg3k
@orcacode-review

Copy link
Copy Markdown

🐳 OrcaCode Review

Skipped: diff is 513.4 KB, over the 512 KB limit. Split the PR into smaller changes, or ask whoever operates this worker to raise ORCA_MAX_DIFF_KB / ORCA_MAX_DIFF_FILES.

OrcaCode Review — Route Smarter. Ship Safer. Spend Less.

@yi-here
yi-here merged commit db85888 into main Oct 31, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants