Sha256: c02db5348a40eaadab206d38363571c54911d1975993dbad1a6824aa3bfefce4
Contents?: true
Size: 836 Bytes
Versions: 39
Compression:
Stored size: 836 Bytes
Contents
# typed: ignore # Copyright (c) 2015 Sqreen. All Rights Reserved. # Please refer to our terms for more information: https://www.sqreen.com/terms.html require 'sqreen/rules/regexp_rule_cb' module Sqreen module Rules # FIXME: Tune this as Rack capable callback? # If: # - we have a 404 # - the path is a typical bot scanning request # Then we deny the ressource and record the attack. class URLMatchesCB < RegexpRuleCB def post(rv, _inst, args, _budget = nil, &_block) return unless rv.is_a?(Array) && rv.size > 0 && rv[0] == 404 env = args[0] path = env['SCRIPT_NAME'].to_s + env['PATH_INFO'].to_s found = match_regexp(path) infos = { :path => path, :found => found } record_event(infos) if found advise_action(nil) end end end end
Version data entries
39 entries across 39 versions & 1 rubygems