
Security News
Scaling Socket from Zero to 10,000+ Organizations
Socket CEO Feross Aboukhadijeh shares lessons from scaling a developer security startup to 10,000+ organizations in this founder interview.
newshound
Advanced tools
A Ruby gem that displays real-time exceptions and job statuses in a collapsible banner for authorized users in your Rails application.
Add to your Gemfile:
gem 'newshound'
Then:
bundle install
rails generate newshound:install
The generator will create config/initializers/newshound.rb with default configuration.
# config/initializers/newshound.rb
Newshound.configure do |config|
# Enable or disable the banner
config.enabled = true
# Maximum number of exceptions to show in banner
config.exception_limit = 10
# User roles that can view the banner
config.authorized_roles = [:developer, :super_user]
# Method to call to get current user (most apps use :current_user)
config.current_user_method = :current_user
end
If the default role-based authorization doesn't fit your needs, you can provide custom logic:
# config/initializers/newshound.rb
Newshound.authorize_with do |controller|
# Your custom authorization logic
# Return true to show banner, false to hide
user = controller.current_user
user&.admin? || user&.developer?
end
# Only show in development
Newshound.authorize_with do |controller|
Rails.env.development?
end
# Check multiple conditions
Newshound.authorize_with do |controller|
user = controller.current_user
user.present? &&
(user.has_role?(:admin) || user.email.ends_with?('@yourcompany.com'))
end
# Use your existing authorization system
Newshound.authorize_with do |controller|
controller.current_user&.can?(:view_newshound)
end
Newshound uses Rails middleware to automatically inject a banner into HTML responses for authorized users. The banner:
The banner displays:
Your User model should have a role attribute that matches one of the configured authorized_roles. Common patterns:
# String enum
class User < ApplicationRecord
enum role: { user: 'user', developer: 'developer', admin: 'admin' }
end
# Symbol enum
class User < ApplicationRecord
enum role: { user: 0, developer: 1, super_user: 2 }
end
# String column
class User < ApplicationRecord
def role
@role ||= read_attribute(:role)&.to_sym
end
end
If your User model uses different attribute names, you can customize the authorization logic using Newshound.authorize_with.
# Test exception reporter
rake newshound:test_exceptions
# Test job queue reporter
rake newshound:test_jobs
# Show current configuration
rake newshound:config
# Check if banner would show for a specific user
user = User.find(123)
controller = ApplicationController.new
controller.instance_variable_set(:@current_user, user)
Newshound::Authorization.authorized?(controller)
# => true or false
rake newshound:configexception-track gem is installed and logging exceptionsrake newshound:test_exceptionsque_jobs table existsrake newshound:test_jobsauthorized_roles configurationNewshound.authorize_with# Run tests
bundle exec rspec
# Run linter
bundle exec rubocop
# Console
bin/console
This gem uses Reissue for release management. To release a new version, perform the following steps as you would with any other ruby gem:
bundle exec rake build:checksum
And then create a new release:
bundle exec rake release
The final step is to push your version bump branch, open a PR, and merge it.
If you were using the previous Slack-based version:
que-scheduler if only used for NewshoundThe banner will now appear automatically for authorized users instead of sending Slack notifications.
MIT
FAQs
Unknown package
We found that newshound demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Socket CEO Feross Aboukhadijeh shares lessons from scaling a developer security startup to 10,000+ organizations in this founder interview.

Research
Socket Threat Research maps a rare inside look at OtterCookie’s npm-Vercel-GitHub chain, adding 197 malicious packages and evidence of North Korean operators.

Research
Socket researchers identified a malicious Chrome extension that manipulates Raydium swaps to inject an undisclosed SOL transfer, quietly routing fees to an attacker wallet.