diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-08-30 02:44:58 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-30 02:44:58 +0900 |
commit | cc81cd359c82bfba27388237a455fc345dce3c9f (patch) | |
tree | 1f92775bb7ce06aab83f29dbc1077b131e6edd63 /activerecord | |
parent | 0d63712fdf8c1ccdd9e9e4300b36f0830d1259a0 (diff) | |
parent | 9b455fe6f0e5d21e8c428da5bdba7d0f3162aef7 (diff) | |
download | rails-cc81cd359c82bfba27388237a455fc345dce3c9f.tar.gz rails-cc81cd359c82bfba27388237a455fc345dce3c9f.tar.bz2 rails-cc81cd359c82bfba27388237a455fc345dce3c9f.zip |
Merge pull request #33744 from bogdanvlviv/fixes-27852
Prevent leaking of user's DB credentials on `rails db:create` failure
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/tasks/database_tasks.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/tasks/postgresql_rake_test.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/tasks/sqlite_rake_test.rb | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/tasks/database_tasks.rb b/activerecord/lib/active_record/tasks/database_tasks.rb index 62c5adac2b..8c67c6c8ba 100644 --- a/activerecord/lib/active_record/tasks/database_tasks.rb +++ b/activerecord/lib/active_record/tasks/database_tasks.rb @@ -122,7 +122,7 @@ module ActiveRecord $stderr.puts "Database '#{configuration['database']}' already exists" if verbose? rescue Exception => error $stderr.puts error - $stderr.puts "Couldn't create database for #{configuration.inspect}" + $stderr.puts "Couldn't create '#{configuration['database']}' database. Please check your configuration." raise end diff --git a/activerecord/test/cases/tasks/postgresql_rake_test.rb b/activerecord/test/cases/tasks/postgresql_rake_test.rb index e36c2b1e3f..8c6e8d79f3 100644 --- a/activerecord/test/cases/tasks/postgresql_rake_test.rb +++ b/activerecord/test/cases/tasks/postgresql_rake_test.rb @@ -112,7 +112,7 @@ if current_adapter?(:PostgreSQLAdapter) ActiveRecord::Base.stub(:connection, @connection) do ActiveRecord::Base.stub(:establish_connection, -> * { raise Exception }) do assert_raises(Exception) { ActiveRecord::Tasks::DatabaseTasks.create @configuration } - assert_match "Couldn't create database for #{@configuration.inspect}", $stderr.string + assert_match "Couldn't create '#{@configuration['database']}' database. Please check your configuration.", $stderr.string end end end diff --git a/activerecord/test/cases/tasks/sqlite_rake_test.rb b/activerecord/test/cases/tasks/sqlite_rake_test.rb index c42afd0e42..c1092b97c1 100644 --- a/activerecord/test/cases/tasks/sqlite_rake_test.rb +++ b/activerecord/test/cases/tasks/sqlite_rake_test.rb @@ -62,7 +62,7 @@ if current_adapter?(:SQLite3Adapter) def test_db_create_with_error_prints_message ActiveRecord::Base.stub(:establish_connection, proc { raise Exception }) do assert_raises(Exception) { ActiveRecord::Tasks::DatabaseTasks.create @configuration, "/rails/root" } - assert_match "Couldn't create database for #{@configuration.inspect}", $stderr.string + assert_match "Couldn't create '#{@configuration['database']}' database. Please check your configuration.", $stderr.string end end end |