Repository navigation
Conversation
- 商品検索のモーダル: category_id を整数の ID として検証し、不正な値は 400 にする。 セッションに残った以前の検索条件の不正な ID は条件から外す - 並び替え: おすすめ商品の ID と並び順を integer として検証し、数値以外や範囲外は 400 にする (型エラーで 500 になっていた) - 登録・編集: 表示だけの ID の項目を disabled にし、送られた値で ID を書き換えない (数値以外は RecommendProduct::setId() の型宣言で 500 になっていた) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
nanasess
marked this pull request as ready for review
October 14, 2026 05:11
This was referenced Oct 16, 2026
おすすめ商品の編集で商品を送らない、または空の値を送ると、フォームが商品を null に 変換し、RecommendProduct::setProduct() (Product 型) への書き込みで例外になっていた。 setProduct() を null も受け付けるようにする。商品が無いことは従来どおりフォームの POST_SUBMIT で入力エラーにし、編集画面を表示する (おすすめ商品は更新しない)。 プロパティと getProduct() はもともと null を許している。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
OWASP ZAP のスキャン (EC-CUBE/ec-cube#7190) で見つかった、想定外の値を送ると 500 (システムエラー) になる箇所を、400 または入力エラーにします。クエリはパラメータ化されており、インジェクションの形跡はありません。入力値の型を確かめないまま、DB やエンティティへ渡していたことが原因です。スキャンで見つかった箇所に加え、同じ形 (送信されたかを確かめずに
isValid()を呼ぶ、null を受けないセッターに null が渡るフォーム) をプラグイン全体から洗い出しています (前者は該当なし)。本体側の同種の修正は EC-CUBE/ec-cube#7227 です。
変更内容
Controller/RecommendSearchModelController.phpcategory_idを整数の ID として検証し、不正な値は 400 にする。ページ送り (GET) で、セッションに残った以前の検索条件の不正な ID は条件から外すController/RecommendController.phpsort_no/move) で、おすすめ商品の ID と並び順を integer として検証し、数値以外や範囲外は 400 にする。数値以外の並び順はRecommendProduct::setSortno(?int)の型宣言で、数値以外の ID は DB の型エラーで 500 になっていたForm/Type/RecommendProductType.phpdisabledにし、送られた値でおすすめ商品の ID を書き換えない。数値以外はRecommendProduct::setId(?int)の型宣言で 500 になっていたEntity/RecommendProduct.phpsetProduct()が null も受け付けるようにする。編集で商品を送らない・空の値を送ると、フォームが商品を null に変換し、setProduct(Product)の型宣言で 500 になっていた。商品が無いことは従来どおりフォームのPOST_SUBMITで入力エラー (「商品を追加してください。」) にし、編集画面を表示する。プロパティとgetProduct()はもともと null を許している整数の範囲は、DB の
integerに合わせて 2147483647 までとしています。ID の項目は readonly の表示用で、これまでも送られた値を使う処理はありません (更新は URL の ID で読み込んだおすすめ商品に対して行う)。
disabledにすると、送られた値はフォームに反映されず、読み込んだおすすめ商品の ID がそのまま残ります。テスト
Tests/全体: 37 件成功 (PostgreSQL 18、EC-CUBE 4.4 の最新)Resource/rector.phpが参照するSymfonySetList::SYMFONY_74が定義されておらず、設定の読み込みで止まります (この PR の変更を入れる前から同じ)🤖 Generated with Claude Code