omniauth: protect against CSRF (#4102)

Configure OmniAuth pour éviter de potentielles CSRF
This commit is contained in:
Pierre de La Morinerie 2019-07-15 18:16:42 +02:00 committed by GitHub
commit 5a70ae7a8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 1 deletions

View file

@ -39,6 +39,7 @@ gem 'lograge'
gem 'logstash-event' gem 'logstash-event'
gem 'mailjet' gem 'mailjet'
gem 'omniauth-github' gem 'omniauth-github'
gem 'omniauth-rails_csrf_protection', '~> 0.1'
gem 'openid_connect' gem 'openid_connect'
gem 'openstack' gem 'openstack'
gem 'pg' gem 'pg'

View file

@ -386,6 +386,9 @@ GEM
omniauth-oauth2 (1.6.0) omniauth-oauth2 (1.6.0)
oauth2 (~> 1.1) oauth2 (~> 1.1)
omniauth (~> 1.9) omniauth (~> 1.9)
omniauth-rails_csrf_protection (0.1.2)
actionpack (>= 4.2)
omniauth (>= 1.3.1)
open4 (1.3.4) open4 (1.3.4)
openid_connect (1.1.6) openid_connect (1.1.6)
activemodel activemodel
@ -731,6 +734,7 @@ DEPENDENCIES
mailjet mailjet
mina! mina!
omniauth-github omniauth-github
omniauth-rails_csrf_protection (~> 0.1)
openid_connect openid_connect
openstack openstack
pg pg

View file

@ -1,6 +1,6 @@
.super-admin.flex.justify-center .super-admin.flex.justify-center
%div %div
%h2 Espace Admin %h2 Espace Admin
= link_to administration_github_omniauth_authorize_path, class: "button large" do = link_to administration_github_omniauth_authorize_path, method: :post, class: "button large" do
%span.icon.lock %span.icon.lock
Connexion avec GitHub Connexion avec GitHub

View file

@ -0,0 +1,4 @@
# OmniAuth GET requests may be vulnerable to CSRF.
# Ensure that OmniAuth only uses POST requests.
# See https://github.com/omniauth/omniauth/wiki/Resolving-CVE-2015-9284
OmniAuth.config.allowed_request_methods = [:post]