Skip to content

Use host check instead of substring search for GitLab URLs - #242

Merged
swissspidy merged 1 commit into
mainfrom
fix/host-check
Aug 3, 2026
Merged

Use host check instead of substring search for GitLab URLs#242
swissspidy merged 1 commit into
mainfrom
fix/host-check

Conversation

@swissspidy

@swissspidy swissspidy commented Aug 3, 2026

Copy link
Copy Markdown
Member

Adding some hardening to make the check more robust.

Summary by CodeRabbit

  • Bug Fixes
    • Improved GitLab repository detection for HTTPS and SSH URLs.
    • GitLab token authentication now works reliably with alternate URL casing and parsed hostnames.

@swissspidy swissspidy added this to the 2.7.4 milestone Aug 3, 2026
@swissspidy
swissspidy requested a review from a team as a code owner August 3, 2026 07:38
Copilot AI review requested due to automatic review settings August 3, 2026 07:38
@swissspidy swissspidy added the command:package Related to 'package' command label Aug 3, 2026
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d1285111-b4fa-44a0-be60-13a9a19874b0

📥 Commits

Reviewing files that changed from the base of the PR and between 6edd81a and 156c3d2.

📒 Files selected for processing (1)
  • src/Package_Command.php

📝 Walkthrough

Walkthrough

GitLab token authentication now uses parsed URL hosts and available tokens. GitLab repository detection now recognizes HTTPS hosts regardless of casing and retains support for GitLab SSH URLs.

Changes

GitLab URL handling

Layer / File(s) Summary
GitLab authentication and repository detection
src/Package_Command.php
ZIP downloads and package lookups now apply GitLab token authentication correctly. Repository detection uses parsed HTTPS hosts and supports GitLab SSH URLs.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: replacing substring searches with host checks for GitLab URLs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/host-check

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

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Package_Command.php 0.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

Pull request overview

This PR hardens GitLab URL detection in the package install/validation flow by switching from substring checks to host-based checks, making token/header injection decisions more robust and less error-prone.

Changes:

  • Use parse_url(..., PHP_URL_HOST) + case-normalization to detect gitlab.com for attaching PRIVATE-TOKEN headers when downloading from GitLab URLs.
  • Ensure GitLab fallback lookups in get_package_by_shortened_identifier() correctly apply GITLAB_TOKEN headers.
  • Improve GitLab URL detection in check_git_package_name() by using host checks (and a stricter SSH prefix check).

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

@swissspidy
swissspidy merged commit e33f1a1 into main Aug 3, 2026
77 of 79 checks passed
@swissspidy
swissspidy deleted the fix/host-check branch August 3, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:package Related to 'package' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants