-
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
XSS 対応 #1101
XSS 対応 #1101
Changes from 4 commits
9ce916a
011226c
384470e
564c846
1af6ee6
cab8505
8e27091
5f279eb
8fdfa02
3cfb45d
dffea58
c2f31cd
73bb9b1
8589855
cfeaa1a
7415bb7
911d533
02a8bb1
552a6b2
807a5a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -241,16 +241,16 @@ public function options_page() { | |
} | ||
|
||
public function option_sanitaize( $option ) { | ||
$option['contact_txt'] = stripslashes( $option['contact_txt'] ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @drill-lancer この部分でstripslashesを削除しているので、例えば Vektor's といった文字列を保存しようとすると、バックスラッシュがテキストエリアに残り、それに気づかず保存すると、倍々にバックスラッシュが増えてしまいます。 ご存知のことかもしれませんが、 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CTA関連でも同様の修正がありますが、こちらはupdate_metadata() 内で、wp_unslashが自動的にかかるのでバックスラッシュを外す処理は不要です。これに関してはstripslashesを通すのは無意味となるので、外して正解だと思います。 |
||
$option['tel_number'] = stripslashes( $option['tel_number'] ); | ||
$option['tel_icon'] = stripslashes( $option['tel_icon'] ); | ||
$option['contact_time'] = stripslashes( $option['contact_time'] ); | ||
$option['contact_link'] = stripslashes( $option['contact_link'] ); | ||
$option['button_text'] = stripslashes( $option['button_text'] ); | ||
$option['button_text_small'] = stripslashes( $option['button_text_small'] ); | ||
$option['short_text'] = stripslashes( $option['short_text'] ); | ||
$option['contact_txt'] = wp_kses_post( $option['contact_txt'] ); | ||
$option['tel_number'] = wp_kses_post( $option['tel_number'] ); | ||
$option['tel_icon'] = wp_kses_post( $option['tel_icon'] ); | ||
$option['contact_time'] = wp_kses_post( $option['contact_time'] ); | ||
$option['contact_link'] = wp_kses_post( $option['contact_link'] ); | ||
$option['button_text'] = wp_kses_post( $option['button_text'] ); | ||
$option['button_text_small'] = wp_kses_post( $option['button_text_small'] ); | ||
$option['short_text'] = wp_kses_post( $option['short_text'] ); | ||
$option['contact_image'] = esc_url( $option['contact_image'] ); | ||
$option['contact_html'] = stripslashes( $option['contact_html'] ); | ||
$option['contact_html'] = wp_kses_post( $option['contact_html'] ); | ||
return $option; | ||
} | ||
|
||
|
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.
@drill-lancer コメントに書いてある通り wp_kses_post でエスケープすると outerブロックが出力するstyle属性を無効化される ので、style 属性が消されないように wp_kses を作るなどして対応してください。