aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2019-03-24 16:22:21 -0500
committerGitHub <noreply@github.com>2019-03-24 16:22:21 -0500
commitb4ca05ea43b1033c3f65d23d3b7b624e0e293a35 (patch)
tree6a254229b7231dac2aa2d5f7392f2a2c64b1ba15 /railties/lib
parent4ec486145290efb4059b64e84a2bfd9e157bf787 (diff)
parentb27105252bce6a69f6d57c05d4ea28d20e84f8ae (diff)
downloadrails-b4ca05ea43b1033c3f65d23d3b7b624e0e293a35.tar.gz
rails-b4ca05ea43b1033c3f65d23d3b7b624e0e293a35.tar.bz2
rails-b4ca05ea43b1033c3f65d23d3b7b624e0e293a35.zip
Merge pull request #35723 from sikachu/disable-sandbox-flag
Add config.disable_sandbox option to Rails console
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/application/configuration.rb4
-rw-r--r--railties/lib/rails/commands/console/console_command.rb6
2 files changed, 9 insertions, 1 deletions
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb
index 83a7b6cf01..b79dbdbc6f 100644
--- a/railties/lib/rails/application/configuration.rb
+++ b/railties/lib/rails/application/configuration.rb
@@ -18,7 +18,8 @@ module Rails
:session_options, :time_zone, :reload_classes_only_on_change,
:beginning_of_week, :filter_redirect, :x, :enable_dependency_loading,
:read_encrypted_secrets, :log_level, :content_security_policy_report_only,
- :content_security_policy_nonce_generator, :require_master_key, :credentials
+ :content_security_policy_nonce_generator, :require_master_key, :credentials,
+ :disable_sandbox
attr_reader :encoding, :api_only, :loaded_config_version, :autoloader
@@ -65,6 +66,7 @@ module Rails
@credentials.content_path = default_credentials_content_path
@credentials.key_path = default_credentials_key_path
@autoloader = :classic
+ @disable_sandbox = false
end
def load_defaults(target_version)
diff --git a/railties/lib/rails/commands/console/console_command.rb b/railties/lib/rails/commands/console/console_command.rb
index e35faa5b01..7a9eaefea1 100644
--- a/railties/lib/rails/commands/console/console_command.rb
+++ b/railties/lib/rails/commands/console/console_command.rb
@@ -26,6 +26,12 @@ module Rails
@options = options
app.sandbox = sandbox?
+
+ if sandbox? && app.config.disable_sandbox
+ puts "Error: Unable to start console in sandbox mode as sandbox mode is disabled (config.disable_sandbox is true)."
+ exit 1
+ end
+
app.load_console
@console = app.config.console || IRB