-
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
広告アラートで意図したwp_ksesフィルタリングが適用されていなかったのを修正 #1121
Conversation
global $allowedposttags; | ||
if ( isset( $allowedposttags['ins'] ) ) { | ||
$allowedposttags['ins']['style'] = 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.
@mtdkei これってどこかで使ってます(・w・?
/** | ||
* Allow data-nosnippet attribute on div tags for kses filtering. | ||
*/ | ||
public static function modify_wp_kses_allowed_html( $allowed_tags, $context ) { | ||
// 必要な属性やタグを追加 | ||
if ( 'post' === $context ) { | ||
$allowed_tags['div']['data-nosnippet'] = true; | ||
} | ||
return $allowed_tags; | ||
} |
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.
@mtdkei これも使ってなくない(・w・?
@kurudrive |
@kurudrive |
あ...まてよ...僕も広告の挿入と勘違いしてましたw |
@kurudrive |
チケットへのリンク / 変更の理由(元のissueがあればリンクを貼り付ければOK)
広告アラートで意図したwp_ksesフィルタリングが適用されていなかったため、iframe等の不要なタグが通過する問題が発生していました。
どういう変更をしたか?
data-nosnippet属性がwp_ksesフィルタリングで失われないよう、divタグに属性を追加insのstyleがwp_ksesフィルタリングで失われないよう、設定を追加→下二つは広告アラートに不要な変更でした。
実装者はレビュワーに回す前に以下の事を確認してチェックをつけてください。
ソースコードについて
デザイン・UI
→内部的な変更なのでスキップ。
プログラムの変更の場合
テストを書かないのは普通ではありません。書けるテストは極力書くようにしてください。
書いていない場合は書かない理由を記載してください。
その他
変更内容について何を確認したか、どういう方法で確認をしたかなど
onmouseover="alert('XSS')
などの要素が「カスタムアラートコンテント」から削除されることを確認しました。以下をコピペして確認しました。
また、上記の変更により、本来のアラートテキストやアラートコンテントの機能を阻害していないことを確認しました。
アラートコンテントは以下をコピペして、フロントエンド上の表示がパターン上と同じ見た目のままになっていることを確認しました。
https://patterns.vektor-inc.co.jp/vk-patterns/pr-alert/
確認URL
( どこかのデモサイトかテストサーバーにデプロイ済みなどで確認できる場合はそのURL )
レビュワーの確認方法・確認する内容など
実装者と同じ確認を行ってください。
広告アラート機能については以下をご参照ください。
https://ex-unit.nagoya/ja/about/pr-alert
レビュワーに回す前の確認事項
レビュワー向け
確認して変更が反映されていない場合の確認事項