Conversation
- Add |escape:'javascript' to tpl_no, shipping_id variables in JS strings - Add |escape:'javascript' to class_name1/class_name2 in onclick handler - Add |h to class_name1/class_name2 in HTML error message context Refs #1335 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughウォークスルーSmarty テンプレートファイルにおいて、JavaScript コンテキスト内で使用される変数に対して 変更内容
推定コードレビュー工数🎯 2 (Simple) | ⏱️ ~10分 ポエム
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1345 +/- ##
==========================================
- Coverage 54.72% 54.39% -0.33%
==========================================
Files 84 84
Lines 10815 10815
==========================================
- Hits 5918 5883 -35
- Misses 4897 4932 +35
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
data/Smarty/templates/admin/order/product_select.tpl (1)
233-233:onclick属性内の|escape:'javascript'はHTMLエンティティのデコード後に評価されるため、二重コンテキストの考慮が必要です。
onclick="..."はまずHTMLパーサーが属性値を解析し、その後JSとして評価されます。|escape:'javascript'は"を\"に変換しますが、HTMLパーサーにとって"は属性の終了と解釈される可能性があります。理論的には
|escape:'javascript'|hのチェーンで、JS → HTML の順にエスケープすべきです。ただし、規格名に"が含まれるケースは実運用上まれであり、管理画面限定のため、リスクは低いです。♻️ より安全なエスケープチェーンの提案
- <td class="center"><a href="javascript:;" onclick="return func_submit('<!--{$arrProducts[cnt].product_id|h}-->', '<!--{$tpl_class_name1[$id]|escape:'javascript'}-->', '<!--{$tpl_class_name2[$id]|escape:'javascript'}-->'); return false;">決定</a></td> + <td class="center"><a href="javascript:;" onclick="return func_submit('<!--{$arrProducts[cnt].product_id|h}-->', '<!--{$tpl_class_name1[$id]|escape:'javascript'|h}-->', '<!--{$tpl_class_name2[$id]|escape:'javascript'|h}-->'); return false;">決定</a></td>
Summary
product_select.tplの JavaScript 文字列内でtpl_no,shipping_idに|escape:'javascript'を適用tpl_class_name1,tpl_class_name2に|escape:'javascript'を適用|hフィルタを追加※
file_manager.tplのtpl_now_dirは PHP 側でjsonEncode()済みのため安全※
design/index.tplのpage_idは|h+ NUM_CHECK 済みのため安全Test plan
Refs #1335
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
語数: 23語