FIX: escape sso_secret string when migrating to sso_provider_secret (#6634)

This commit is contained in:
Maja Komel 2018-11-20 15:28:37 +01:00 committed by Régis Hanol
parent 9672c92045
commit 592f8c1637
1 changed files with 3 additions and 1 deletions

View File

@ -2,8 +2,10 @@ class AddSsoProviderSecretsToSiteSettings < ActiveRecord::Migration[5.2]
def up
return unless SiteSetting.enable_sso_provider && SiteSetting.sso_secret.present?
sso_secret = SiteSetting.sso_secret
sso_secret_insert = ActiveRecord::Base.connection.quote("*|#{sso_secret}")
execute "INSERT INTO site_settings(name, data_type, value, created_at, updated_at)
VALUES ('sso_provider_secrets', 8, '*|#{sso_secret}', now(), now())"
VALUES ('sso_provider_secrets', 8, #{sso_secret_insert}, now(), now())"
end
def down