Signed Glide URLs return 400 when the site URL is on a different domain from the app
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
- #15515 @lazerg による — マージされずにクローズ
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 35/100
調査の方向性
Start with GlideController::validateSignature(), where the issue identifies the URL-path calculation. Check how its existing tests cover signature validation, then add regression coverage for a site URL on a different domain and for a site URL with a path prefix. Done means both cases validate signed Glide URLs correctly; an open linked pull request indicates work is already underway.
索引モデルが issue の本文から書いたものです。
説明
Bug description
With image_manipulation.secure enabled, every Glide request returns 400 Signature is not valid. if the site's url in sites.yaml is on a different domain from the one serving Statamic.
We hit this running Statamic headless. The site URLs point at our frontend (https://www.example.com) so entry URLs come out right, while Statamic and its /img route are on https://cms.example.com.
GlideController::validateSignature() works out the path to check like this:
$path = Str::after($this->request->url(), Site::current()->absoluteUrl());
For a request to https://cms.example.com/img/..., the site URL is https://www.example.com. That isn't part of the request URL, so Str::after() returns the whole URL. The signature was generated over /img/..., so it never matches.
One possible fix is to fall back to the request path when the site URL isn't a prefix of the request URL:
$url = $this->request->url();
$siteUrl = Site::current()->absoluteUrl();
$path = Str::startsWith($url, $siteUrl)
? Str::after($url, $siteUrl)
: $this->request->getPathInfo();
Sites with a path prefix (/de/img/...) still take the first branch, so their URLs keep working. Using getPathInfo() on its own would break them.
How to reproduce
- Set a site's
urlinresources/sites.yamlto a different domain from the app, for examplehttps://www.example.comwhile the app runs onhttp://localhost. - Leave
statamic.assets.image_manipulation.secureat its default oftrue. - Generate a URL with
Image::manipulate('image.jpg', ['w' => 300]). It comes back relative, as/img/image.jpg?w=300&s=.... - Request it from the app:
http://localhost/img/image.jpg?w=300&s=.... The response is400 Signature is not valid.
If you change the site URL to http://localhost, the same URL passes the signature check.
Logs
N/A
Environment
Statamic 6.33.0, league/glide 4.1.0, PHP 8.5.0, Laravel 13.32.0. The same line is still in GlideController in 6.34.0.
Installation
Existing Laravel app
Additional details
My colleague Andrius Gluzeckis found this.
- 主要言語
- PHP
- スター
- 4.9k
- フォーク
- 647
- 平均マージ
- 1日 45分
- マージ済み PR(30日)
- 221
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
statamic/cms のほかの issue
-
forms ui
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
accessibility
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
antlers
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
Nav: link to the site root with an anchor (/#section) gets is_parent on every page対応中かも @duncanmcclean が今日担当しました。 オープンnavigations
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
Multiple Choice and Checkboxes no longer offer "Inline", but the default views still use it対応中かも @duncanmcclean が今日担当しました。 オープンforms
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
sync-en
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
vimeo/psalm#15150 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
taskforcesh/bullmq#5238 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] v-change-database-password reports success but doesn't change the password when MySQL validate_password rejects it対応中かも @bfs2021 が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Automattic/jetpack#55517 ·
メンテナーはふだん 1 日以内に返信