Skip to content

fix(web): refuse private repos in the browser merge runner itself - #63

Merged
PastaPastaPasta merged 1 commit into
masterfrom
fix/web-merge-refuse-private
Sep 27, 2026
Merged

PastaPastaPasta merged 1 commit into
masterfrom
fix/web-merge-refuse-private

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

What

The browser merge now refuses private repositories in runMergeSteps itself, not only in the merge panel. A private repo's pack has to be encrypted, and the browser merge writes plaintext. Before this change the refusal was UI-only (mergeButton), so any other caller of the runner could have stored a plaintext pack for a private repo.

runMergeSteps now stops with MergeStopped('Private repositories are merged with \dg pr merge` for now.')` before it runs the worker, uploads anything or writes any document. The private-repos work adds an upload-level backstop separately, so both layers hold whichever lands first.

Follow-up to #61.

Tests

  • lib/merge/runner.test.ts: a private-repo run throws MergeStopped with that message and makes no calls at all: no worker, verify, upload, manifest, index, ref or event, and no step events. The test fails when the guard is removed.
  • pnpm typecheck, pnpm lint and vitest run lib/merge/runner.test.ts (13 passed) pass.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Merge attempts on non-public repositories now stop before any merge work begins and display a message directing users to dg pr merge.

The merge panel already hides the browser merge for private repos, but runMergeSteps did not check: a caller could store a plaintext pack for one. It now stops before the worker, the upload or any write.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: ae66f675-124f-404d-b896-3785942ff3b2

📥 Commits

Reviewing files that changed from the base of the PR and between 89aa559 and 0a61d9a.

📒 Files selected for processing (2)
  • forge-web/lib/merge/runner.test.ts
  • forge-web/lib/merge/runner.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

runMergeSteps now stops when a repository is not public. A test verifies that a private repository is rejected before merge work, writes, or step events occur.

Changes

Merge guard

Layer / File(s) Summary
Reject non-public repositories
forge-web/lib/merge/runner.ts, forge-web/lib/merge/runner.test.ts
runMergeSteps throws MergeStopped for non-public repositories before checking saved-run state. The test verifies that rejection occurs before merge work or writes, and that no step events occur.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 0a61d

The reachable browser path preserves private-repository visibility, and the runner stops before merge work. No current-head merge risk is indicated.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 0a61d

The runner now stops private-repository merges before uploads or writes. No new exposure was identified, but this client-side check alone does not establish protection for every upload path.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The new refusal covers merge work initiated through this runner, including its production panel caller. It does not, by itself, establish a restriction on independently invoked upload paths.

Trust Boundaries and Controls

  • observed — The runner checks RepoRef.visibility before invoking its injected upload dependency. This is a runner-level control using a supplied repository reference, not an authoritative check shown at storage.

Resilience and Maintainability Implications

  • inferred — Because the refusal is at function entry, interruption and repetition do not advance a private run through additional runner steps. It does not reverse earlier writes.

Hardening Proposals

  • proposed — For defense in depth, ensure upload authorization independently checks authoritative repository visibility and the required encryption state rather than relying on a caller-supplied RepoRef.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: the browser merge runner now refuses private repositories.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@PastaPastaPasta
PastaPastaPasta merged commit 0cec37c into master Sep 27, 2026
5 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.

1 participant