Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Safeconsole is a utility for a safe by default rails console
. Every session is wrapped in an
Active Record transaction, preventing accidental mutations on production data.
Add this line to your application's Gemfile:
gem 'safeconsole'
And then execute:
$ bundle install
Start Safeconsole session by running bin/rails safeconsole
The following commands are available in the Safeconsole session
commit
: Set the changes in the transaction to be committed to the databasenevermind
: Set the changes in the transaction to be discardedrefresh
: Start a new transaction, and discard or commit changes based on configurationstats
: Display some stats on the current Safeconsole sessioncommands
: Print the Safeconsole commands in your sessionSafeconsole is configurable. You can configure it by adding an initializer at config/initializers/safeconsole.rb
with the options outlined below
Example config, and options
# config/initializers/safeconsole.rb
Safeconsole.configure do |conf|
# App Name
# Name of the rails app, only for display purposes in the welcome message
# Default: Attempt to infer application name
conf.app_name = "My Amazing Product"
# Allow Unsafe
# Should safe console allow unsafe consoles in the listed environments
# Default: false
conf.allow_unsafe = true
# Current Environment
# What is the current runtime environment?
# Useful if Rails.env is `production` in staging like environments
# Default: Rails.env
conf.current_env = ENV["CURRENT_ENVIRONEMNT"]
# Command Timeout
# Should someone be removed from a console session with X duration of inactivity
# Default: nil
conf.command_timeout = 10.minutes
# Session Timeout
# What's the maximum duration someone should be allowed to run a console session?
# Default: nil
conf.session_timeout = 30.minutes
end
Both timeout configurations can be used together, independently, or not at all. Safeconsole spins up a background thread to monitor current session duration, to prevent hanging console sessions.
After checking out the repo, run bin/setup
to install dependencies. Then, run rspec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
There is a slimmed down Rails application in spec/rails_app
, where you can run bin/rails safeconsole
to see it in a rails app
Bug reports and pull requests are welcome on GitHub at https://github.com/aaronmiler/safeconsole. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Safeconsole project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that safeconsole demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.