Free and open source · built by the DeadBro team
The admin tools every Rails app ends up building, in one engine.
BroHub mounts one dashboard in your app with four tools you switch on one at a time: an audited production console, credentials changes without the key, a Redis cache browser and your DeadBro stats. One gem, one migration, one audit log.
MIT licenseRails 7.1+Ruby 3.3+v0.3.0
# Gemfile gem "bro_hub" $ bundle install $ bin/rails g bro_hub:install --features=env,safe,cache --migrate create config/initializers/bro_hub.rb route mount BroHub::Engine => "/bro_hub" migrate CreateBroHubTables BroHub is installed. Open: /bro_hub/safe /bro_hub/env /bro_hub/cache /bro_hub/audit (the combined audit log)
Every production console session recorded, sensitive data locked until someone says why.
:envEnvBroChange encrypted credentials without handing out the master key.
:cacheCacheBroSearch, inspect and purge your Redis cache, with every action audited.
:apmDeadBroYour DeadBro performance stats inside your own admin.
A production console that asks who you are and why you're there.
SafeBro hooks rails console in production. It records every command, encrypted at rest, keeps secrets locked until the person types unlock! and gives a reason, and gives your reviewers a page to approve or flag each session.
- The console asks firstIt reads who's there from
CONSOLE_USER(set it server-side inauthorized_keys) and asks for a reason before the first prompt. - Secrets stay lockedEncrypted attributes read as ciphertext. Credentials, secret
ENVvalues, key files and the systems you list raise untilunlock!. - Commands are checked before they run
eval,system, reopening protected classes and touching the audit tables are blocked. Commands mentioning secrets are flagged. - Someone reviews itSessions that unlocked data or tripped a rule are marked for attention. Reviewers approve or flag with notes, and can't review their own sessions.
$ CONSOLE_USER=jane rails console You have access to production data here. That's a big deal. Everything you type is recorded and reviewed. jane, why are you using this console today? > Fixing invoice 12, ticket #4521 myapp(prod):001> Invoice.find(12).customer.email => "{\"p\":\"iu6+LfnNlurC6sL++J...\"}" # ciphertext while locked myapp(prod):002> ENV["STRIPE_SECRET_KEY"] SafeBro: flagged for review - Access to env is protected. (STRIPE_SECRET_KEY) Run unlock! to continue. myapp(prod):003> unlock! :env Before you access sensitive data, say why and where we can find the consent or ticket that covers it. > Ticket #4521: customer asked us to rotate their key Unlocked. Type lock! to protect it again.
# Who may review console sessions config.safe.can_audit = ->(user) { user.admin? } # Map a hub user to their console name, # so nobody approves their own session config.safe.console_username = ->(user) { user.console_name } # Systems that need unlock! before the console can reach them config.safe.protected_urls = [ ENV["REDIS_URL"], "https://search.internal:9200" ] config.safe.retention = 90.days
A deterrent and an audit trail, not a sandbox. Ruby is too dynamic to sandbox, and SafeBro says so. It catches mistakes, makes people stop and explain, and leaves a record. For a hard boundary, keep the key off shell hosts and give console users a restricted database role.
Change production credentials without sharing the master key.
A developer picks keys by name and types the new values. EnvBro builds the re-encrypted production.yml.enc in memory and hands it back to commit on a branch. Nobody on the team needs production.key, and EnvBro never writes to the credentials file itself.
- ProposeThe developer sees key names, never values. They add, change or remove keys and download the new encrypted file.
- ReviewA reviewer uploads the file from the pull request and sees exactly which keys changed. Values stay masked unless the reviewer may reveal them, and every reveal is audited.
- DeployOn boot EnvBro recognises the file it built and marks the proposal live, including after a rollback.
config.env.can_propose = ->(user) { user.developer? } # add, change, remove keys
config.env.can_review = ->(user) { user.lead? } # see what changed, masked
config.env.can_reveal = ->(user) { user.admin? } # see values, always audited
Look inside your Redis cache before you clear it.
Find the keys behind a stale page, see their size and expiry, and purge only those. No redis-cli on a production box, no Rails.cache.clear that takes everything with it.
- Search keysPlain text matches anywhere;
*and?make a pattern. Each key shows its expiry and size. - Reveal a valueIts own permission, always audited, because cached values can hold personal data.
- Purge with a previewYou see the count and a sample of what a pattern matches before anything is deleted.
- Flush a namespaceType the store's name to confirm. Keys outside your cache namespace are never touched.
config.cache.can_view_keys = ->(user) { user.developer? }
config.cache.can_view_values = ->(user) { user.lead? }
config.cache.can_purge = ->(user) { user.lead? }
config.cache.can_flush = ->(user) { user.admin? }
config.cache.reason_required_for = %i[ purge flush ]
Your DeadBro stats, next to the tools you fix things with.
If your app already runs the dead_bro agent, BroHub reads your stats with the same API key. Slow endpoints, errors and SQL show up in the same admin where you open a console session or purge a cache key.
- OverviewRequests, error rate, throughput and p95 per hour, the slowest endpoints and the latest deploy.
- Endpoints, errors and SQLRanked by mean time, error rate and total time, with N+1 and slow-query markers.
- Deploys and statusRevisions with the errors since each, and whether the agent in this process is on and sending.
gem "dead_bro" # the agent you already run config.features = %i[ safe env cache apm ] config.apm.can_view = ->(user) { user.developer? }
The only feature that needs a DeadBro account. The other three work on their own, with no account and nothing sent anywhere.
One audit log for all of it.
Every feature writes its key moments to one table, shown at /bro_hub/audit. It keeps key names, patterns, counts and reasons. It never keeps secret values, cache values or the text of console commands.
Set up in three steps.
Turn on only what you need. A feature that's off has no routes, no menu entry and no console hooks.
1. Add the gem
One line in your Gemfile.
gem "bro_hub"2. Run the installer
It writes the initializer, mounts the dashboard and creates the tables. Safe to run again.
bin/rails g bro_hub:install --migrate
3. Say who may do what
Everything is denied until you allow it.
BroHub.configure do |config| config.features = %i[ env safe ] config.safe.can_audit = ->(u) { u.admin? } config.env.can_review = ->(u) { u.admin? } end
Questions
Is it free?
Yes. BroHub is MIT licensed. Only the DeadBro section uses a DeadBro account, and you can leave it off.
Which Rails versions?
Rails 7.1 and newer on Ruby 3.3 and newer. The console feature hooks IRB 1.13 and newer.
Where does the dashboard live?
Inside your app, at the path you choose (default /bro_hub). Pages inherit from your ApplicationController, so your sign-in runs first.
Does it store secrets?
No. The audit log holds names, counts and reasons. Console commands are stored encrypted, in their own table, and old sessions are purged after 90 days by default.
I use console1984 and audits1984.
SafeBro is written from scratch, not a fork of either. It records and reviews console sessions in one place and also locks credentials, secret ENV values and key files. Don't run it alongside them: both would record every command twice.
How do I remove it?
bin/rails g bro_hub:uninstall writes a migration that drops BroHub's tables and removes the initializer and the mount.
Built by the people who make DeadBro.
BroHub is the admin half. DeadBro is the monitoring half: Rails APM with request traces, SQL and errors, in one place.