Skip to content

plugins: homebrew: Add "brew audit" to allowlist #494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MTCoster
Copy link
Contributor

@MTCoster MTCoster commented Oct 3, 2024

Overview

Allow the homebrew plugin to provide the token for the audit subcommand. Also re-sort the existing subcommands.

Type of change

  • Created a new plugin
  • Improved an existing plugin
  • Fixed a bug in an existing plugin
  • Improved contributor utilities or experience

How To Test

$ brew audit --online <cask>

Changelog

Allow the homebrew plugin to provide the token for the audit subcommand.

Copy link
Contributor

github-actions bot commented Oct 3, 2024

⚠️ This PR contains unsigned commits. To get your PR merged, please sign those commits (git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}) and force push them to this branch (git push --force-with-lease).

If you're new to commit signing, there are different ways to set it up:

Sign commits with gpg

Follow the steps below to set up commit signing with gpg:

  1. Generate a GPG key
  2. Add the GPG key to your GitHub account
  3. Configure git to use your GPG key for commit signing
Sign commits with ssh-agent

Follow the steps below to set up commit signing with ssh-agent:

  1. Generate an SSH key and add it to ssh-agent
  2. Add the SSH key to your GitHub account
  3. Configure git to use your SSH key for commit signing
Sign commits with 1Password

You can also sign commits using 1Password, which lets you sign commits with biometrics without the signing key leaving the local 1Password process.

Learn how to use 1Password to sign your commits.

Watch the demo

Copy link
Member

@edif2008 edif2008 left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! 😄

I've left only one question that is related to backwards compatibility when it comes to adding authentication for the Shell plugin to new subcommands that didn't require it before.

@@ -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).

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