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 +4 -4
- data/lib/antispam/tools.rb +19 -20
- data/lib/antispam/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: deb7098b89c7771c3a67061353ea1333960830b49a5181487ae0ffddb5aaab40
|
4
|
+
data.tar.gz: 7ada271f3c917b2869cb4a92fa7d5b70606d9c5020c4d4eb5e44934d25abcad9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3ef0076d08ed077460f8b98f90b38b4bcada5a6c50916a8fada274afea6c3786f04ce311471aace68a39dd732193c09cb15b2afa43ce5502ee577a5c3fe70e5
|
7
|
+
data.tar.gz: 41eda0779322117d6a2235b5ef8a5303e3ce6d7c9dcb66cecae9b2252d98b793364a9e6014f51858419a84a2f39896b44549462d1e8f91608248c35d2a88e29e
|
data/lib/antispam/tools.rb
CHANGED
@@ -8,32 +8,31 @@ module Antispam
|
|
8
8
|
scrutinize_countries_except: nil,
|
9
9
|
verbose: false
|
10
10
|
)
|
11
|
-
if
|
12
|
-
return if request.get?
|
13
|
-
return if request.post?
|
14
|
-
return if request.put?
|
15
|
-
return if request.patch?
|
16
|
-
return if request.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?[
|
22
|
+
return if controller_name.in?(%w[validate challenges])
|
23
|
+
|
22
24
|
ip = request.remote_ip
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
-
|
36
|
-
|
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 = []
|
data/lib/antispam/version.rb
CHANGED