tap: link completions only for canonical origins by p-linnane · Pull Request #23823 · Homebrew/brew · GitHub
Skip to content

tap: link completions only for canonical origins - #23823

Merged
MikeMcQuaid merged 1 commit into
mainfrom
completion-origin-trust
Sep 6, 2026
Merged

tap: link completions only for canonical origins#23823
MikeMcQuaid merged 1 commit into
mainfrom
completion-origin-trust

Conversation

@p-linnane

Copy link
Copy Markdown
Contributor

Completion and manpage linking trusted any tap whose name looks official, so a tap named homebrew/foo cloned from a custom remote had its shell completions linked automatically even though the trust checks would not run its Ruby. Add Tap#official_git_checkout?, which requires the checkout's actual Git origin to be the canonical remote, and use it where completions are linked, unlinked and counted, so only canonical official checkouts get automatic completion trust.


  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

GPT-6 Astra and Claude Code (Fable 5.1) drafted the implementation and tests; I reviewed the diff, verified the new test fails without the change and the updated specs pass with it, and ran brew lgtm --online plus targeted specs.


Copilot AI balanced review requested due to automatic review settings September 5, 2026 22:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The security-sensitive behaviour is consistently applied and covered, with only a minor performance optimisation suggested.

Pull request overview

Restricts automatic completion trust to official taps using canonical Git origins.

Changes:

  • Adds Tap#official_git_checkout?.
  • Applies origin verification when linking, unlinking and counting completions.
  • Updates tap and completion tests.
File summaries
File Description
Library/Homebrew/tap.rb Adds and applies origin-based trust.
Library/Homebrew/completions.rb Uses origin trust for completion handling.
Library/Homebrew/test/tap_spec.rb Tests custom and canonical origins.
Library/Homebrew/test/completions_spec.rb Configures the official test origin.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread Library/Homebrew/tap.rb Outdated
Signed-off-by: Patrick Linnane <patrick@linnane.io>
@p-linnane
p-linnane force-pushed the completion-origin-trust branch from 0a4c6cb to 046a0de Compare September 6, 2026 01:00

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Sep 6, 2026
Merged via the queue into main with commit 15e239f Sep 6, 2026
52 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the completion-origin-trust branch September 6, 2026 11:28
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.

3 participants