-
Notifications
You must be signed in to change notification settings - Fork 1
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
[ CTA ] ブロックで作成したCTAがエスケープされまくって崩れる不具合を修正 #1104
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kurudrive ありがとうございます!
気になった点コメントさせて頂きました。
), | ||
); | ||
?> | ||
<?php $allowed_html = Vk_Call_To_Action::allowed_html(); ?> | ||
<textarea name="vkExUnit_cta_text" id="vkExUnit_cta_text" rows="10em" cols="50em"><?php echo wp_kses( get_post_meta( get_the_id(), 'vkExUnit_cta_text', true ), $allowed_html ); ?></textarea> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kurudrive postmetaの保存時に wp_kses_post をかけているので、$allowed_htmlを指定する意味がないと思いますが、いかがでしょうか。ここでかけるとしたら、wp_kses_postですかね。
allowed_htmlをわざわざ設定しているのはどうしてでしょう。xss対応としては wp_kses_post で十分だと思います。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mthaichi ありがとうございまっする。
まぁ保存時にかけてるのでエスケープ不要論はありますが、他から書き換える事は不可能ではないので、念の為てきない感じです。
allowed に指定したのは Outer ブロックのstyleタグなど wp_kses_post が通さなくて表示が崩れたりするので、独自に用意していましたが、まぁここはそんなブロックのコードゴリっと書かれないと思いましたので wp_kses_posts に変更しましたん(・w・
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kurudrive 修正頂いたコードで問題ないと思います。
CTA編集画面の本文で指定したブロックは特にXSS考慮はいらないと思います。metaboxで指定されたテキストについて、表示時にHTMLを除去したらいいとおもうですが、view-actionbox.phpをみると細々やってるので、それ以上いらないかなぁという見解です。
), | ||
'span' => array( | ||
'id' => array(), | ||
'class' => array(), | ||
'itemprop' => array(), | ||
'itemscope' => array(), | ||
'itemtype' => array(), | ||
'style' => array(), | ||
'style' => array( | ||
'opacity' => array(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kurudrive この指定はあくまでHTML属性レベルの話だと思うので、styleの中にopacityとか指定はできないと理解していますが、いかがでしょうか。別の箇所に書きましたが、保存時にwp_kses_postをかけているのでXSS対応としては十分で、ここで細かく指定する意味がないように思います。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mthaichi あー、りがとうございまっする。テストしてた時の名残でした!不要ですので削除しました!
@kurudrive 修正ありがとうございました! |
@mthaichi 確認ありがとうございまするー! |
チケットへのリンク / 変更の理由(元のissueがあればリンクを貼り付ければOK)
#1101 でエスケープを追加したが、
厳しすぎてかなり表示が崩れてしまう
どういう変更をしたか?
実装者はレビュワーに回す前に以下の事を確認してチェックをつけてください。
ソースコードについて
デザイン・UI
プログラムの変更の場合
テストを書かないのは普通ではありません。書けるテストは極力書くようにしてください。
書いていない場合は書かない理由を記載してください。
その他
変更内容について何を確認したか、どういう方法で確認をしたかなど
レビュワーの確認方法・確認する内容など
その他コードに問題があるかどうか
レビュワーに回す前の確認事項
レビュワー向け
確認して変更が反映されていない場合の確認事項