From e79624b97279def43e4e7f187c5ed2f5d07fafaa Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Tue, 3 Jul 2018 12:51:33 +0100 Subject: Fix the Terraform HTTP backend in production Skip the authenticate_user! before action for the Terraform controller methods, and refactor the code to improve readability. --- app/controllers/terraform_http_backend_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/terraform_http_backend_controller.rb b/app/controllers/terraform_http_backend_controller.rb index eeff7b0..9e38dc7 100644 --- a/app/controllers/terraform_http_backend_controller.rb +++ b/app/controllers/terraform_http_backend_controller.rb @@ -19,7 +19,11 @@ # . class TerraformHttpBackendController < ApplicationController - skip_before_action :verify_authenticity_token, only: %w(create show destroy) + # These controller methods are for use by Terraform + TERRAFORM_CONTROLLER_METHODS = %w(create show destroy) + + skip_before_action :verify_authenticity_token, only: TERRAFORM_CONTROLLER_METHODS + skip_before_action :authenticate_user!, only: TERRAFORM_CONTROLLER_METHODS def self.credentials @_credentials ||= begin @@ -38,7 +42,7 @@ class TerraformHttpBackendController < ApplicationController http_basic_authenticate_with( **credentials, - only: %(create show destroy) + only: TERRAFORM_CONTROLLER_METHODS ) def index -- cgit v1.2.3