Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions plugins/homebrew/brew.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ func HomebrewCLI() schema.Executable {
NeedsAuth: needsauth.IfAll(
needsauth.NotForHelpOrVersion(),
needsauth.IfAny(
needsauth.ForCommand("search"),
needsauth.ForCommand("audit"),
Copy link
Member

Choose a reason for hiding this comment

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

How will this affect current users that don't expect to be asked to authorize the Shell plugin for this subcommand?

Is this something that we want to accept from now on?

Copy link
Member

@SimonBarendse SimonBarendse Apr 24, 2025

Choose a reason for hiding this comment

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

Just quickly checked brew audit usage and it does seem like there are use cases where you would not require authentication.

So I think we need to scope this down so that auth is only provided when it's required. For:

  • Security: provide access least privilege only when needed.
  • Productivity: only bother user with authorization prompt when needed.

I imagine a flag like --online or --tap may indicate there's a need for auth, but I'll defer to @MTCoster who has more context on the use cases for this command.

We can implement using needsauth.IfAll combined with the current needsauth.ForCommand and a new to be created in needsauth/helpers.go WhenContainsArgs (which can share most of its logic with existing NotWhenContainsArgs).

needsauth.ForCommand("bump"),
needsauth.ForCommand("bump-cask-pr"),
needsauth.ForCommand("bump-formula-pr"),
needsauth.ForCommand("update"),
needsauth.ForCommand("upgrade"),
needsauth.ForCommand("install"),
needsauth.ForCommand("reinstall"),
needsauth.ForCommand("search"),
needsauth.ForCommand("update"),
needsauth.ForCommand("upgrade"),
),
),
Uses: []schema.CredentialUsage{
Expand Down
Loading