{"id":13878015,"url":"https://github.com/salsify/safer_rails_console","last_synced_at":"2025-06-10T15:39:19.636Z","repository":{"id":39706975,"uuid":"92854496","full_name":"salsify/safer_rails_console","owner":"salsify","description":"Make rails console less dangerous!","archived":false,"fork":false,"pushed_at":"2024-11-12T21:17:09.000Z","size":168,"stargazers_count":146,"open_issues_count":11,"forks_count":16,"subscribers_count":38,"default_branch":"master","last_synced_at":"2025-01-13T18:50:40.674Z","etag":null,"topics":["gem","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/salsify.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-30T16:39:27.000Z","updated_at":"2024-11-21T18:37:06.000Z","dependencies_parsed_at":"2023-10-10T16:55:41.547Z","dependency_job_id":"5e056a2d-0c7f-48e7-aa81-04446abbbbae","html_url":"https://github.com/salsify/safer_rails_console","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salsify%2Fsafer_rails_console","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salsify%2Fsafer_rails_console/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salsify%2Fsafer_rails_console/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salsify%2Fsafer_rails_console/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/salsify","download_url":"https://codeload.github.com/salsify/safer_rails_console/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salsify%2Fsafer_rails_console/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259104095,"owners_count":22805808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gem","hacktoberfest"],"created_at":"2024-08-06T08:01:37.584Z","updated_at":"2025-06-10T15:39:19.603Z","avatar_url":"https://github.com/salsify.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# SaferRailsConsole\n\n[![Build Status](https://circleci.com/gh/salsify/safer_rails_console.svg?style=svg)](https://circleci.com/gh/salsify/safer_rails_console)\n[![Gem Version](https://badge.fury.io/rb/safer_rails_console.svg)](https://badge.fury.io/rb/safer_rails_console)\n\nThis gem makes Rails console sessions less dangerous in specified environments by warning, color-coding, and auto-sandboxing PostgreSQL and MySQL connections. In the future we'd like to extend this to make other external connections read-only too (e.g. disable job queueing, non-GET HTTP requests, etc.)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'safer_rails_console'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install safer_rails_console\n\nAdd the following line to the end of 'config/boot.rb' in your Rails application.\n```ruby\nrequire 'safer_rails_console/patches/boot'\n```\n\n## Usage\n\nThe quickest way to demo this gem is to run `bundle exec rails console --sandbox`.\n\nSeveral ways to explicitly enable or disable the sandbox are added to Rails console as flags with the last install step.  The order of precedence is `-s`, `-r`, then `-w` if multiple sandbox related flags are specified.\n```ruby\nbundle exec rails console --help  \n\nUsage: rails console [environment] [options]\n    -s, --[no-]sandbox               Explicitly enable/disable sandbox mode.\n    -w, --writable                   Alias for --no-sandbox.\n    -r, --read-only                  Alias for --sandbox.\n    -e, --environment=name           Specifies the environment to run this console under (test/development/production).\n                                     Default: development\n        --debugger                   Enable the debugger.\n```\n\nThis gem is autoloaded via Railties.  The following defaults can be configured from 'environments' or 'application.rb':\n```ruby\n# Set what console is used. Currently, only 'irb' is supported. 'pry' and other consoles are to be added.\nconfig.safer_rails_console.console = 'irb'  \n\n# Mapping environments to shortened names. `false` to disable.\nconfig.safer_rails_console.environment_names = {\n                                                 'development' =\u003e 'dev',\n                                                 'staging' =\u003e 'staging',\n                                                 'production' =\u003e 'prod'\n                                               }  \n# Mapping environments to console prompt colors. See colors.rb for colors. `false` to disable.\nconfig.safer_rails_console.environment_prompt_colors = {\n                                                         'development' =\u003e SaferRailsConsole::Colors::GREEN,\n                                                         'staging' =\u003e SaferRailsConsole::Colors::YELLOW,\n                                                         'production' =\u003e SaferRailsConsole::Colors::RED\n                                                       }  \n\n# Set environments which should default to sandbox. `false` to disable.\nconfig.safer_rails_console.sandbox_environments = %w{production}  \n\n# Set 'true' to have a prompt that asks the user if sandbox should be enabled/disabled if it was not explicitly specified (via. --[no-]sandbox)\nconfig.safer_rails_console.sandbox_prompt = false  \n\n# Set environments that should have a warning. `false` to disable.\nconfig.safer_rails_console.warn_environments = %w{production}  \n\n# Set warning message that should appear in the specified environments.\nconfig.safer_rails_console.warn_text = \"WARNING: YOU ARE USING RAILS CONSOLE IN PRODUCTION!\\n\" \\\n                                       'Changing data can cause serious data loss. ' \\\n                                       'Make sure you know what you\\'re doing.'\n```\n\nconfiguration settings can also be overridden using ENV variables. The following ENV vars can be used:\n```\n# Set the color prompt to a new color. See colors.rb for a listing of supported colors.\nSAFER_RAILS_CONSOLE_PROMPT_COLOR=red/yellow/green\n\n# Set the short name for the rails console prompt\nSAFER_RAILS_CONSOLE_ENVIRONMENT_NAME=short-name\n\n# Set the warning text to be displayed when warning for the environments rails consoled is enabled\nSAFER_RAILS_CONSOLE_WARN_TEXT=New warning prompt text\n\n# Enable or disable sandboxing of the rails console\nSAFER_RAILS_CONSOLE_SANDBOX_ENVIRONMENT=true/false\n\n# Enable or disable warning prompt of the rails console\nSAFER_RAILS_CONSOLE_WARN_ENVIRONMENT=true/false\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `wwtd` to simulate the entire build matrix (ruby version / rails version) or `appraisal` to test against each supported rails version with your active ruby version. Run `rubocop` to check for style. \n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/salsify/safer_rails_console. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalsify%2Fsafer_rails_console","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsalsify%2Fsafer_rails_console","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalsify%2Fsafer_rails_console/lists"}