require_relative 'template_rendering' require_relative 'fragment_caching' require_relative 'cache_store' module Immunio XSS_HOOKS = %w[template_render_done template_render_var] # Hook into rendering process of Rails. Plugin.load('ActionView', feature: 'xss', hooks: XSS_HOOKS) do |plugin| ActionView::TemplateRenderer.send :include, TemplateRendererHooks ActionView::Template.send :include, TemplateHooks if Rails::VERSION::MAJOR < 5 ActionController::Caching::Fragments.send(:include, FragmentCachingHooks) else AbstractController::Caching.send(:include, FragmentCachingHooks) ActiveSupport::Cache::Store.send(:include, CacheStoreHooks) end plugin.loaded! Rails.version end end