antispam 0.2.10 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b9976b110e83413c117ba4e2aadebe3ee782a2e22075b4d005b8ee23f859b6c
4
- data.tar.gz: b103e465db532012980a7a37e01d0b337a11bf58c5182e6951471ee2a344c427
3
+ metadata.gz: deb7098b89c7771c3a67061353ea1333960830b49a5181487ae0ffddb5aaab40
4
+ data.tar.gz: 7ada271f3c917b2869cb4a92fa7d5b70606d9c5020c4d4eb5e44934d25abcad9
5
5
  SHA512:
6
- metadata.gz: c74852eabd842ab4d54b5dc99cc99224ee40c930d4a1e047a77506c3cc4a6a04bb445c0a92d3946dbdbf81116c1f9334046e4631574af9001b4b13bfee8eebaf
7
- data.tar.gz: 34c5bd57b1db3f574f16a7b467a9e16fb3eb01271a172491eca71d6362f454f8df42cd4c468bfa7059e72466904fbe778f5e26aa7748f29c45bf53820ffb72bf
6
+ metadata.gz: d3ef0076d08ed077460f8b98f90b38b4bcada5a6c50916a8fada274afea6c3786f04ce311471aace68a39dd732193c09cb15b2afa43ce5502ee577a5c3fe70e5
7
+ data.tar.gz: 41eda0779322117d6a2235b5ef8a5303e3ce6d7c9dcb66cecae9b2252d98b793364a9e6014f51858419a84a2f39896b44549462d1e8f91608248c35d2a88e29e
@@ -8,32 +8,31 @@ module Antispam
8
8
  scrutinize_countries_except: nil,
9
9
  verbose: false
10
10
  )
11
- if (options[:methods])
12
- return if request.get? unless options[:methods].include?(:get)
13
- return if request.post? unless options[:methods].include?(:post)
14
- return if request.put? unless options[:methods].include?(:put)
15
- return if request.patch? unless options[:methods].include?(:patch)
16
- return if request.delete? unless options[:methods].include?(:delete)
11
+ if methods
12
+ return if request.get? && !methods.include?(:get)
13
+ return if request.post? && !methods.include?(:post)
14
+ return if request.put? && !methods.include?(:put)
15
+ return if request.patch? && !methods.include?(:patch)
16
+ return if request.delete? && !methods.include?(:delete)
17
17
  else
18
18
  return if request.get?
19
19
  end
20
+
20
21
  return if skip_if_user_whitelisted
21
- return if controller_name.in?["validate","challenges"]
22
+ return if controller_name.in?(%w[validate challenges])
23
+
22
24
  ip = request.remote_ip
23
- # First, check IP blacklists.
24
- if (options[:ip_blacklists])
25
- if options[:ip_blacklists][:default]
26
- options[:ip_blacklists][:httpbl] = options[:ip_blacklists][:default]
27
- options[:ip_blacklists].delete(:default)
28
- end
29
- check_ip_against_blacklists(ip, options[:ip_blacklists], options[:verbose])
30
- end
31
- # Second, check for weird countries.
32
- if (options[:scrutinize_countries_except])
33
-
25
+
26
+ # Handle IP blacklists
27
+ if ip_blacklists
28
+ ip_blacklists[:httpbl] ||= ip_blacklists.delete(:default)
29
+ check_ip_against_blacklists(ip, ip_blacklists, verbose)
34
30
  end
35
- Rails.logger.info "Completed IP database check. #{ip}" if options[:verbose]
36
- end
31
+
32
+ # Country checks, if necessary
33
+ # (expand logic as needed)
34
+ Rails.logger.info "Completed IP database check. #{ip}" if verbose
35
+ end
37
36
  # Checks the specific blacklists
38
37
  def check_ip_against_blacklists(ip, lists, verbose)
39
38
  results = []
@@ -1,3 +1,3 @@
1
1
  module Antispam
2
- VERSION = '0.2.10'
2
+ VERSION = '0.2.11'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: antispam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Kopf