@marcusjcarey
Information wants to be free.
LOG ALL THE THINGS!
Burp
ZAP
Nikto
Brakeman
Brakeman Pro
It’s kinda hot!
Bundler Audit
GemCanary
Gemfile
# Devise Authentication
gem 'devise'
# Devise zxcvbn for password strength checks
gem 'devise_zxcvbn’
# Devise Security Extension
gem 'devise_security_extension’
# Devise Google Authenticator
gem 'devise_google_authenticator', '0.3.16'
User Model
class User < ActiveRecord::Base
…
end
Team Model
class Team < ActiveRecord::Base
has_many :users, dependent: :destroy
…
end
User Model with Team
class User < ActiveRecord::Base
belongs_to :team
…
end
set_contact
…
private
def set_contact
@contact = current_user.contacts.find_by(:uuid =>
params[:id])
end
…
set_contact with Team
…
private
def set_contact
@contact = current_user.team.contacts.find_by(:uuid =>
params[:id])
end
…
UUID Usage
class Contact < ActiveRecord::Base
belongs_to :team
before_create :create_uuid
def to_param
uuid
end
private
def create_uuid
begin
self.uuid = SecureRandom.uuid
end while self.class.exists?(:uuid => uuid)
end
end
current_user
# GET /contacts/new
def new
@contact = current_user.contacts.new
end
# GET /contacts/1/edit
def edit
end
# POST /contacts
# POST /contacts.json
def create
@contact =
current_user.contacts.new(contact_params)
current_user with Team
# GET /contacts/new
def new
@contact = current_user.team.contacts.new
end
# GET /contacts/1/edit
def edit
end
# POST /contacts
# POST /contacts.json
def create
@contact =
current_user.team.contacts.new(contact_params)
RailsConf 2015
• The World of Rails Security
• Metasecurity: Beyond Patching Vulnerabilities
vthreat.com
@vthreat
marcus@vthreat.com or alex@vthreat.com
Securing Rails Keep Ruby Weird

Securing Rails Keep Ruby Weird

Editor's Notes

  • #4 Information wants to be free
  • #5 Log all the things!