Skip to content

Pull invalid path components into a constant - #24418

Merged
MikeMcQuaid merged 1 commit into
mainfrom
invalid-path-components
Nov 1, 2026
Merged

MikeMcQuaid merged 1 commit into
mainfrom
invalid-path-components

Conversation

@p-linnane

Copy link
Copy Markdown
Contributor

Tap.fetch, Keg#aliases and Cask::Artifact::App each listed "", . and .. as path components to reject, so this shares one list as Utils::INVALID_PATH_COMPONENTS.


  • 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.

Claude Code (Opus 5.5) wrote the change and ran brew lgtm --online.


- `Tap.fetch`, `Keg#aliases` and `Cask::Artifact::App` each listed
  `""`, `.` and `..` as path components to reject; share one list as
  `Utils::INVALID_PATH_COMPONENTS`.

Signed-off-by: Patrick Linnane <patrick@linnane.io>
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 569a5cde-02ff-4305-8608-d2232eb9782e
Commits

Reviewing files that changed from the base of the PR and between 1f55ebf and 5854474.

Files selected for processing: 4
  • Library/Homebrew/cask/artifact/app.rb
  • Library/Homebrew/keg.rb
  • Library/Homebrew/tap.rb
  • Library/Homebrew/utils.rb

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved validation of app staging paths, keg aliases and tap names. Invalid path components are now rejected consistently, helping prevent malformed paths and names from being accepted.

The change adds a shared constant for invalid path components. The staged-path, alias and tap-name checks now use it instead of inline lists. The alias and tap-name checks still reject names containing /.

Changes: Path component validation

Layer / File(s) Summary
Shared invalid-component checks
Library/Homebrew/utils.rb, Library/Homebrew/cask/artifact/app.rb, Library/Homebrew/keg.rb, Library/Homebrew/tap.rb
Utils::INVALID_PATH_COMPONENTS defines the empty string, "." and "..". The staged-path, alias and tap-name checks use this constant. The alias and tap-name checks retain their slash rejection.
Merge Risk: Minimal · up to 58544

No concrete merge-blocking defect was identified in the validation centralization.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: centralising invalid path components in a shared constant.
Description check Passed The description accurately explains that three locations now share Utils::INVALID_PATH_COMPONENTS.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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

Thanks!

@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Nov 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 1, 2026
@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Nov 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 1, 2026
@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Nov 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 1, 2026
@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit bb45d71 Nov 1, 2026
54 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the invalid-path-components branch November 1, 2026 14:41
@p-linnane p-linnane mentioned this pull request Nov 1, 2026
7 of 8 tasks
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.

2 participants

⌂ 换网址