Repository navigation
Harden tap redirect trust and rollback - #24198
Conversation
Signed-off-by: Patrick Linnane <patrick@linnane.io>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (7)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (20)
🧰 Additional context used📚 Code guidelines (2)📓 Path-based instructions (3)Source excerpt: Use the system Homebrew `brew bundle exec ...`📄 CodeRabbit inference engine (docs/AGENTS.md) Files:
Test command behavior and its observable effects, including stdout, stderr, exit status, and state changes as relevant.📄 CodeRabbit inference engine (Generated by CodeRabbit) Files:
Implement CLI commands as `Homebrew::Cmd` classes inheriting from `AbstractCommand`; declare help text and argument metadata in `cmd_args`, and put command behavior in `run`.📄 CodeRabbit inference engine (Generated by CodeRabbit) Files:
🪛 ast-grep (0.45.3)Library/Homebrew/test/cmd/update-report_spec.rb[warning] 166-169: Found the use of an hardcoded passphrase for RSA. The passphrase can be easily discovered, and therefore should not be stored in source-code. It is recommended to remove the passphrase from source-code, and use system environment variables or a restricted configuration file. (hardcoded-secret-rsa-passphrase-ruby) [warning] 166-169: Found the use of an hardcoded passphrase for RSA. The passphrase can be easily discovered, and therefore should not be stored in source-code. It is recommended to remove the passphrase from source-code, and use system environment variables or a restricted configuration file. (hardcoded-secret-rsa-passphrase-ruby) 🔇 Additional comments (8)
📝 SummarySummary by CodeRabbit
WalkthroughTap redirects now check the source remote and trust entries before changing a tap’s identity. Update processing passes repository branch context and restores repository state when it denies a redirect. ChangesTap Redirects
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant Update as homebrew-update
participant Report as UpdateReport
participant Tap as Tap
participant Trust as Trust entries
participant Git as Git repository
Update->>Report: Pass repository branch context
Report->>Tap: Apply redirected remote
Tap->>Git: Read origin fetch URL
Tap->>Trust: Check matching destination entries
Tap-->>Report: Return redirect denial
Report->>Git: Restore target branch and remote-tracking ref
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The inspected redirect and rollback paths show no actionable issue requiring a fix before merge. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The redirect policy strengthens protection against unintended trust inheritance. No introduced security defect was established, but recovery remains dependent on Git state and transport configuration, with some failures requiring manual repair. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
Homebrew renamed taps based on any
redirecting toline in Git's stderr. Over SSH that line comes from the remote server, so any tap host could relabel its checkout as an official, implicitly trusted tap or as another tap.insteadOf) is HTTPS or SSH on github.com.brew updaterolls back a refused redirect, keep local changes and developer branches, and report a failed rollback without skipping other taps.brew tap --custom-remoteand anArgumentErrorwhen a core tap is redirected to a third-party tap.GitHub renames of untrusted taps still work; renames from other hosts now need
brew untapandbrew tap.brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?GPT-6 Astra and Claude Code (Opus 5.5) drafted the implementation and tests, verified the new tests fail without the change and pass with it, and ran
brew lgtmplus targeted specs; I reviewed the diff.