FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(repository): validate custom repo URL extension against path only by Ferdinaelectro1 · Pull Request #1672 · raspberrypi/rpi-imager · GitHub

fix(repository): validate custom repo URL extension against path only - #1672

Open
Ferdinaelectro1 wants to merge 1 commit into
raspberrypi:mainfrom
Ferdinaelectro1:fix/repo-url-query-string-validation-v2
Open

Ferdinaelectro1 wants to merge 1 commit into
raspberrypi:mainfrom
Ferdinaelectro1:fix/repo-url-query-string-validation-v2

Conversation

Copy link
Copy Markdown
Contributor

Problem

isValidRepoUrl() requires the URL to end with .json or the manifest
extension, but matches this against the full URL string, including the
query string. This breaks authenticated manifest URLs such as Azure Blob
SAS links or S3 presigned URLs.

Fixes #1667

Fix

Match the extension regex against QUrl::path() instead of the raw URL
string, so query parameters and fragments no longer break the check.

Why keep the extension check

isValidRepoUrl() is used in two places:

  • the custom repository URL field (QML)
  • handleIncomingUrl(), validating repo= in rpi-imager://open?repo=...
    deep links (added in 86c3e20)

The deep link can be triggered by an external site without direct user
input, so the extension check acts as a first-pass filter before the
confirmation dialog. This PR keeps that check and only fixes how it's
matched, rather than removing it.

isValidRepoUrl() matched the .json/.rpi-imager-manifest extension
against the full URL string, so any query string or fragment after
the extension broke the match. This rejected valid, authenticated
manifest URLs such as Azure Blob SAS links or S3 presigned URLs.

Match the extension against QUrl::path() instead, so query
parameters and fragments are correctly ignored. Scheme and
extension checks are otherwise unchanged.

Fixes raspberrypi#1667
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

[BUG]: URL validation for repository manifest is too strict

1 participant


Back | FazBrowse Home | New Git URL