Sha256: d494d1745a159f343f4bc91ad9d4e66b673caa73beb034accdd26120866b7d3f
Contents?: true
Size: 1.46 KB
Versions: 25
Compression:
Stored size: 1.46 KB
Contents
module Immunio module CookieHooks extend ActiveSupport::Concern included do # TODO: should anything be checked to make sure @parent_jar exists if method_defined? :[] # Not sure when this wouldn't exist. # The following won't work because of the names: # alias_method_chain :[], :immunio if method_defined? :[] alias_method :lookup_without_immunio, :[] alias_method :[], :lookup_with_immunio end end def lookup_with_immunio(name) Request.time "plugin", "#{Module.nesting[0]}::#{__method__}" do raw_cookie_value = @parent_jar[name] cookie_value = Request.pause "plugin", "#{Module.nesting[0]}::#{__method__}" do lookup_without_immunio(name) end if !raw_cookie_value.nil? and cookie_value.nil? Immunio.run_hook! "action_dispatch", "bad_cookie", key: name, value: raw_cookie_value end cookie_value end end end end class ActionDispatch::Cookies if defined? SignedCookieJar SignedCookieJar.send :include, Immunio::CookieHooks end if defined? UpgradeLegacySignedCookieJar UpgradeLegacySignedCookieJar.send :include, Immunio::CookieHooks end if defined? EncryptedCookieJar EncryptedCookieJar.send :include, Immunio::CookieHooks end if defined? UpgradeLegacyEncryptedCookieJar UpgradeLegacyEncryptedCookieJar.send :include, Immunio::CookieHooks end end
Version data entries
25 entries across 25 versions & 1 rubygems