LoginSignup
1
0

More than 3 years have passed since last update.

JSでajaxを利用する際のセキュリティ注意点2つ

Last updated at Posted at 2020-07-13

1. innerHTMLではなくinnerTextを利用すること

  • 自動的にテキストエンコードされXSSが防げる

2. (ajaxに限らず)URLパラメータなど、ユーザの入力値をそのまま画面上に出力しないこと

おまけ

  • JSは宣言なしで変数に代入すると常にグローバル変数になるため注意
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0