Skip to content

Merge only what was reviewed, and only with permission (7.5.0) - #15

Merged
jonradoff merged 4 commits into
mainfrom
security/reviewed-merge
Nov 10, 2026
Merged

jonradoff merged 4 commits into
mainfrom
security/reviewed-merge

Conversation

@jonradoff

Copy link
Copy Markdown
Collaborator

Stacked on #14, which is stacked on #13. Third of three changes; merge #13 and #14 first. This one also carries the 7.5.0 docs and changelog for the whole series.

Why

An agent that ended its own sandbox could then merge its own fork. Merging your own work is a normal way to add content to a site, so it should stay possible, but only as a permission an admin grants on purpose and that is off by default. Merges also weren't tied to what a person reviewed:

  • The fork diff cut values at 2,000 bytes before comparing them, so a change past that point never showed.
  • The diff skipped several fields a merge writes.
  • New pages showed no content.
  • The admin review page had no diff at all.
  • A fork could still change after submission, and a merge wrote no version and couldn't be rolled back.

What changes

Merging through a key or connection is a granted permission

  • POST /api/v1/forks/{id}/merge through an API key or OAuth connection needs:
  • Everything else is refused, and a person merges at /cm/forks/{id}. People merging in the admin UI are unaffected.
  • The audit entry marks a self-merge and lists the pages created and updated.
  • A Sandbox credential with the permission can merge its own sandbox, and stays Sandbox afterwards.

Merges are bound to the review

  • ForkService.Review compares every field a merge writes, using complete values, and lists what a new page sets.
  • It returns a digest of the fork pages and the live pages they change. Merge requires the digest and returns ErrForkChanged if anything changed since.
  • get_fork_diff returns the digest, and merge_fork requires it. The admin merge form carries the digest of the page the reviewer saw.
  • Ending a sandbox with submit freezes its fork: no API key or connection can change it afterwards. A person can still edit it, which changes the digest.

The review is on the fork page

  • /cm/forks/{id} shows every change field by field, "live now" against "after merge". Long values are cut on a character boundary with "Show all" to expand.
  • The merge confirmation no longer says it cannot be undone.

Merges can be undone

  • Every live page a merge creates or changes gets a version with the provenance and editor of the merge. A page with no history gets its pre-merge state as version 1 first.
  • The session ledger reads created_ids/updated_ids from the merge's audit entry, so rollback_agent_session undoes a session's merge.
  • A merged page's static file is now rendered from the whole merged page, so its meta description, tags and author render as merged.

Docs and release

  • README, MCP.md and CLAUDE.md describe the access model, the review digest and the in-process /mcp design.
  • The tool descriptions no longer claim protections the server didn't provide.
  • build.json and manifest.json are bumped to 7.5.0, with a changelog entry and upgrade notes for the series.

Upgrade notes

  • merge_fork through an existing key stops working until an admin grants the merge permission for that key.
  • Forks made before 7.5.0 have no recorded creator, so a person merges those.
  • Every merge now needs the digest from the fork's diff.

Tests

  • Review: a change past 2,000 characters appears in the diff, and every merged field is compared.
  • Refusals: a merge is refused without a digest, after the fork changes, after a page is added, and after the live page changes.
  • Versions and rollback: versions carry provenance, and session rollback undoes a merge.
  • Key rules:
    • A key needs the grant.
    • A key can't merge another key's fork or a person's fork.
    • The grant needs a role that can merge.
    • A Sandbox key with the grant merges its own sandbox.
  • Freeze: submitting freezes the fork for keys but not for people.
  • Review page: it shows the diff, refuses a stale merge, and merges what it showed.
  • End to end through /mcp:
    • An agent without the permission is refused.
    • An agent with it reviews, merges and then rolls its own session back.

go test -p 1 ./... passes.

🤖 Generated with Claude Code

jonradoff and others added 4 commits November 9, 2026 21:55
- Through an API key or OAuth connection, a merge needs "Can merge its
  own forks" on that credential, an owner whose role can merge, and a
  fork the same credential created. People merging in the admin UI are
  unaffected. The audit entry marks a self-merge.
- ForkService.Review compares every field a merge writes, in full (a
  change past 2,000 bytes used to be invisible), lists what a new page
  sets, and returns a digest of the fork and live pages. Merge requires
  the digest and refuses with ErrForkChanged if anything changed.
  get_fork_diff returns it and merge_fork requires it.
- Ending a sandbox with "submit" freezes its fork for keys and
  connections; a person can still edit it.
- /cm/forks/{id} shows the review field by field and its merge form
  carries the digest of what was shown.
- Merges write a version for every live page they create or change, and
  session rollback undoes a session's merge. A merged page's static file
  is rendered from the whole merged page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
README, MCP.md and CLAUDE.md describe connections that act as a person,
Sandbox and Full access, the merge permission and the review digest.
build.json and manifest.json move to 7.5.0, and the changelog has the
upgrade notes for the series.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A submitted fork is frozen for keys and connections on every route
  that changes it: deleting, restoring or reverting a copy, and
  archiving or deleting the fork, as well as editing.
- A key or connection can't self-merge a fork it submitted for review.
- Merge claims the fork (status "merging", expiring after 10 minutes),
  so a second merge of the same fork is refused instead of applying
  twice, and takes its digest from exactly the pages it applies.
- The digest covers publish state and schedule. A schedule set on a fork
  copy is dropped when the merge creates the page, and fork copies can't
  be scheduled.
- Versions record noindex and the author, so reverting a merge restores
  them; versions saved before 7.5 leave those fields alone.
- Rollback reports a fork copy that merging removed as gone, not failed.
- The review page's "Show all" preview is valid HTML.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jonradoff

Copy link
Copy Markdown
Collaborator Author

Independent review (a different model) confirmed:

  • the merge-permission rules and the digest's coverage of pages added or removed, live pages appearing or disappearing, and folder and template changes;
  • the version and provenance writing;
  • that Sandbox keys are fully frozen.

Its findings are fixed in b5860f4:

  • A submitted fork could still be changed by a Full key through delete, restore or revert of a copy, or archive or delete of the fork. All are frozen now.
  • A key could self-merge a fork it had submitted. Refused now.
  • Two merges of one fork could both apply. Merge now claims the fork, and its digest is computed from exactly the pages it applies.
  • The digest didn't cover publish state or schedule, and a fork copy could be scheduled. Both closed.
  • Versions didn't record noindex or the author, so rollback couldn't restore them. Now recorded; older versions leave those fields alone.
  • Rollback reports merged-away fork copies as gone, not as failed.
  • The review page's preview markup is now valid HTML.

Not changed: the diff returns complete values with no size cap. The page clamps the display, but an MCP client receives everything.

@jonradoff
jonradoff changed the base branch from security/server-sandbox to main November 10, 2026 11:03
@jonradoff
jonradoff merged commit f46f40f into main Nov 10, 2026
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.

1 participant