0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CSRF(クロスサイトリクエストフォージェリ)対策について 

Posted at

CSRF(クロスサイトリクエストフォージェリ)とは

Webアプリケーションに存在する脆弱性、もしくはその脆弱性を利用した攻撃方法のことです。掲示板や問い合わせフォームなどを処理するWebアプリケーションが、本来拒否すべき他サイトからのリクエストを受信し処理してしまいます。

わかりやすい説明はこちら
ー 参考 外部からPOSTできない?RailsのCSRF対策をまとめてみた
https://qiita.com/KumatoraTiger/items/cc6a1107374cce500e6d

実際にCSRF(クロスサイトリクエストフォージェリ)対策を無効にする

development(検証環境)用

config
└── environments
└── development.rb <--ここ編集

# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker

config.action_controller.allow_forgery_protection = false #追記

production(本番環境) 用

config
└── environments
└── production.rb <--ここ編集


# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false

config.action_controller.allow_forgery_protection = false  #追記

最後に DB migrate

データベースのマイグレーションを行います。

$ bundle exec rake db:migrate

アウトプット用で記事を参考にしながら書きました。

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?