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

your-app
# 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)
The BroHub dashboard: the sidebar lists SafeBro, EnvBro, DeadBro and CacheBro, and the DeadBro overview shows 434 requests in 24 hours with throughput and p95 charts.
One dashboard in your app: every section in the sidebar, each only for the people allowed in.
SafeBro · auditconfig.features << :safe

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.

  1. The console asks firstIt reads who's there from CONSOLE_USER (set it server-side in authorized_keys) and asks for a reason before the first prompt.
  2. Secrets stay lockedEncrypted attributes read as ciphertext. Credentials, secret ENV values, key files and the systems you list raise until unlock!.
  3. Commands are checked before they runeval, system, reopening protected classes and touching the audit tables are blocked. Commands mentioning secrets are flagged.
  4. 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.
production console
$ 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.
A SafeBro console session under review: the reason given, every command with flagged ones in red, the unlock window in amber, and the Appropriate or Flag verdict form.
Reviewing a session: the reason, every command, what was flagged and the unlock window.
config/initializers/bro_hub.rb
# 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.

EnvBro · configconfig.features << :env

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.

  1. ProposeThe developer sees key names, never values. They add, change or remove keys and download the new encrypted file.
  2. 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.
  3. DeployOn boot EnvBro recognises the file it built and marks the proposal live, including after a rollback.
EnvBro reviewing a proposed credentials file: 3 changed keys (1 added, 1 changed, 1 removed) with masked values, reveal links, and the proposal's author, base version and deploy status.
The reviewer sees which keys changed, values masked until revealed, and whether it's live yet.
config/initializers/bro_hub.rb
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
EnvBro's Propose a change page: one new key added, a new value typed for secret_key_base, stripe.secret_key ticked for removal, other values shown as unchanged dots.
Proposing: key names only. Add a key, type a new value, or tick remove.
EnvBro's audit log: a deploy of credentials not made by EnvBro, a proposal created that is not deployed yet, and a review viewed, each with the key names involved.
Every proposal, review, reveal and deploy, with key names, never values.
CacheBro · cacheconfig.features << :cache

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.
CacheBro's purge preview for views/*: 9 keys match, a list of the matching keys, and a Purge 9 keys button. Nothing has been deleted yet.
A purge shows how many keys match and which, before anything is deleted.
config/initializers/bro_hub.rb
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 ]
CacheBro listing 17 keys in the manager:cache namespace, each with its expiry and size.
Every key in your cache namespace, with expiry and size.
One cache key opened in CacheBro: its store, expiry and size, with the value hidden because this person may not reveal values.
Without the reveal permission you see that a key exists, not what it holds.
CacheBro's audit log: admin@example.com purged views/* in Rails.cache, 9 keys, with filters for revealed, deleted, purged and flushed.
Every reveal, delete, purge and flush is logged with the key or pattern and the count.
DeadBro · performanceconfig.features << :apm

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.

The DeadBro errors page inside BroHub: ten distinct errors grouped by fingerprint, with count, first seen and last seen.
Your app's errors, grouped by fingerprint, without leaving the admin.
  • 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.
Gemfile and initializer
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.

The combined BroHub audit log: twelve events with time, user, feature, event and target, filterable by user and event.
Each person only sees the rows of features they may audit.

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.

Gemfile
gem "bro_hub"

2. Run the installer

It writes the initializer, mounts the dashboard and creates the tables. Safe to run again.

terminal
bin/rails g bro_hub:install --migrate

3. Say who may do what

Everything is denied until you allow it.

bro_hub.rb
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.