Skip to content

Preserve GitHub token during eval#22431

Merged
p-linnane merged 1 commit into
mainfrom
preserve-github-token-eval
May 28, 2026
Merged

Preserve GitHub token during eval#22431
p-linnane merged 1 commit into
mainfrom
preserve-github-token-eval

Conversation

@MikeMcQuaid
Copy link
Copy Markdown
Member

@MikeMcQuaid MikeMcQuaid commented May 27, 2026

Fixes #22430

  • Keep $HOMEBREW_GITHUB_API_TOKEN available while formulae and casks are evaluated so private taps can keep resolving assets.
  • Share the eval scrubbing policy through ENV so formula and cask loaders do not drift.
  • Add temporary HOMEBREW_NO_EVAL_ENV_SCRUBBING for users who need a short-term escape hatch while private taps migrate.

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR.

OpenAI Codex 5.5 xhigh with local review and testing.


Copilot AI review requested due to automatic review settings May 27, 2026 16:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts Homebrew’s “sensitive env scrubbing” during formula/cask evaluation to avoid breaking private-tap workflows that rely on HOMEBREW_GITHUB_API_TOKEN at load time, while keeping scrubbing in place for other sensitive variables by default.

Changes:

  • Introduce an eval-specific env scrubbing helper that preserves HOMEBREW_GITHUB_API_TOKEN, and wire formula + cask loaders to use it.
  • Add HOMEBREW_NO_EVAL_ENV_SCRUBBING as a temporary opt-out to disable eval-time scrubbing entirely.
  • Add/extend unit tests and update Sorbet RBI for the new EnvConfig boolean.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Library/Homebrew/test/formulary_spec.rb Adds coverage for GitHub token preservation and the opt-out during formula evaluation.
Library/Homebrew/test/ENV_spec.rb Adds coverage for clear_sensitive_environment! exceptions support.
Library/Homebrew/test/cask/cask_loader_spec.rb Adds coverage for GitHub token preservation and the opt-out during cask evaluation.
Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi Adds RBI for no_eval_env_scrubbing?.
Library/Homebrew/formulary.rb Switches formula evaluation to the eval-specific env scrubbing helper.
Library/Homebrew/extend/ENV/sensitive.rb Adds exception support and eval-specific scrubbing behavior (incl. token allowlist + opt-out).
Library/Homebrew/env_config.rb Adds HOMEBREW_NO_EVAL_ENV_SCRUBBING EnvConfig entry.
Library/Homebrew/cask/cask_loader.rb Switches cask evaluation to the eval-specific env scrubbing helper.
Files not reviewed (1)
  • Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Library/Homebrew/extend/ENV/sensitive.rb
- Keep `$HOMEBREW_GITHUB_API_TOKEN` available while formulae and
  casks are evaluated so private taps can keep resolving assets.
- Share the eval scrubbing policy through `ENV` so formula and cask
  loaders do not drift.
- Add temporary `HOMEBREW_NO_EVAL_ENV_SCRUBBING` for users who need
  a short-term escape hatch while private taps migrate.
@MikeMcQuaid MikeMcQuaid force-pushed the preserve-github-token-eval branch from ebdddaf to ef45fef Compare May 27, 2026 18:23
@p-linnane p-linnane added this pull request to the merge queue May 28, 2026
Merged via the queue into main with commit 5787c4d May 28, 2026
37 checks passed
@p-linnane p-linnane deleted the preserve-github-token-eval branch May 28, 2026 01:14
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.

env scrubbing breaks private-tap downloads

4 participants