Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

管理画面URLを「cart」にした場合、カート画面への遷移時に管理画面が表示される #5343

Merged
merged 7 commits into from Jun 1, 2023

Conversation

watarukashii
Copy link
Contributor

@watarukashii watarukashii commented Apr 4, 2022

概要(Overview・Refs Issue)

#4710

管理画面URLをcartにした場合、カートへの遷移ができない
cartに限らず、フロントのパスと同じパスを設定すると発生します

方針(Policy)

RouterInterface をもとにフロントのURLを抽出の上、比較

テスト(Test)

相談(Discussion)

マイナーバージョン互換性保持のための制限事項チェックリスト

  • 既存機能の仕様変更はありません
  • フックポイントの呼び出しタイミングの変更はありません
  • フックポイントのパラメータの削除・データ型の変更はありません
  • twigファイルに渡しているパラメータの削除・データ型の変更はありません
  • Serviceクラスの公開関数の、引数の削除・データ型の変更はありません
  • 入出力ファイル(CSVなど)のフォーマット変更はありません

レビュワー確認項目

  • 動作確認
  • コードレビュー
  • E2E/Unit テスト確認(テストの追加・変更が必要かどうか)
  • 互換性が保持されているか
  • セキュリティ上の問題がないか
    • 権限を超えた操作が可能にならないか
    • 不要なファイルアップロードがないか
    • 外部へ公開されるファイルや機能の追加ではないか
    • テンプレートでのエスケープ漏れがないか

@@ -142,6 +155,24 @@ public function buildForm(FormBuilderInterface $builder, array $options)
;
}

private function getRouteCollection()
{
$fountRoutesUrlList = [];

Choose a reason for hiding this comment

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

$frontRoutesUrlList のtypoでしょうか?(違っていたら無視してください)

@codecov-commenter
Copy link

codecov-commenter commented Apr 4, 2022

Codecov Report

Merging #5343 (991274f) into 4.2 (66eb03d) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@             Coverage Diff              @@
##                4.2    #5343      +/-   ##
============================================
- Coverage     82.54%   82.53%   -0.01%     
- Complexity     6401     6408       +7     
============================================
  Files           475      475              
  Lines         25734    25759      +25     
============================================
+ Hits          21241    21260      +19     
- Misses         4493     4499       +6     
Flag Coverage Δ
E2E 69.44% <100.00%> (+<0.01%) ⬆️
Unit 79.72% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/Eccube/Form/Type/Admin/SecurityType.php 99.24% <100.00%> (+0.12%) ⬆️

... and 2 files with indirect coverage changes

* フロントURL一覧を取得
* @return string
*/
private function getRouteCollection(): string
Copy link
Contributor

Choose a reason for hiding this comment

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

helpやproductsといったパスはエラーにできますか?

@chihiro-adachi
Copy link
Contributor

@watarukashii
テストコード書いてもらうことはできますでしょうか?

@watarukashii
Copy link
Contributor Author

@watarukashii テストコード書いてもらうことはできますでしょうか?

@chihiro-adachi products や cart といった文言のみの登録はエラーとし、
products_admin や、 admin_cart といった文言は登録可能とするように調整いたしました。
テストコードの追加等ございましたら、ご指摘いただければと思います。引き続きよろしくおねがいします

@chihiro-adachi chihiro-adachi changed the title 管理画面URLを「cart」にした場合、カート画面への遷移時に管理画面が表示される #4710 管理画面URLを「cart」にした場合、カート画面への遷移時に管理画面が表示される Apr 21, 2022
@carkn carkn changed the base branch from 4.1 to 4.2 May 8, 2023 02:05
@@ -80,6 +89,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
new Assert\Regex([
'pattern' => '/\A\w+\z/',
]),
new Assert\Regex([
'pattern' => "/\A^(?!($routes)$).*\z/",
Copy link
Contributor

Choose a reason for hiding this comment

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

@watarukashii
こちらの変数 $routes が未定義変数となっております。修正をお願い致します。

Copy link
Contributor

Choose a reason for hiding this comment

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

いや、これは @dotani1111 さんのrebase処理が引き起こしてるっぽいですね。
こちらで修正いたします。

@shinya shinya self-assigned this May 26, 2023
@shinya
Copy link
Contributor

shinya commented May 26, 2023

@watarukashii
お手数ですが、上記レビュー内容の反映をお願いできればと思います。

@shinya
Copy link
Contributor

shinya commented May 29, 2023

レビューの指摘事項、こちらで修正いたしました。
(テストも一部追加しました)

@@ -76,6 +76,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$denyHosts = implode("\n", $denyHosts);

$routes = $this->getRouteCollection();
dump($routes);
Copy link
Contributor

Choose a reason for hiding this comment

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

@watarukashii
dumpの削除をお願いします。

@chihiro-adachi
Copy link
Contributor

@shinya
ラベル設定とマイルストーンの設定お願いします。
※ラベルのfix-meは、指摘事項が修正されたら解除お願いします。

@shinya shinya modified the milestones: 4.1.x, 4.2.2 May 30, 2023
@shinya
Copy link
Contributor

shinya commented May 30, 2023

@chihiro-adachi
ご指摘ありがとうございます。承知です。
まだ @kiy0taka さんの指摘があるのでapprove頂き次第消すようにします。

@shinya shinya merged commit 0bf8995 into EC-CUBE:4.2 Jun 1, 2023
188 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants