Sha256: 77632ed27008fcb259cc67ee0cfafaa6e6eb01f9bc63b3c7c0ab4dd5b1ab8d56
Contents?: true
Size: 1.03 KB
Versions: 13
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true require 'pathname' module Datadog module AppSec # Helper methods to get vendored assets module Assets module_function def waf_rules(kind = :recommended) read("waf_rules/#{kind}.json") end def waf_processors read('waf_rules/processors.json') end def waf_scanners read('waf_rules/scanners.json') end def blocked(format: :html) (@blocked ||= {})[format] ||= read("blocked.#{format}") end def path Pathname.new(dir).join('assets') end def filepath(filename) path.join(filename) end def read(filename, mode = 'rb') File.open(filepath(filename), mode) { |f| f.read || raise('Unexpected nil IO object') } end def dir # Happens only if this file is evaluated standalone, which should not happen # Necessary to make type-checker happy with a non-nilable return value __dir__ || raise('Unexpected file eval') end end end end
Version data entries
13 entries across 13 versions & 1 rubygems