bot_challenge_page 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 84489b3222b7f78c52f1d952362c0105c3bbd0973311e7847246ae2182b42eac
|
|
4
|
+
data.tar.gz: 99bfc469263b9bc6101733e864273e7a956ececa7c66f41ee52f163257518be3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7bee70170d8b41a3b431cef8d706d4f34ed28a8f48ab6b82d268fe37c5fcfbfb5bfeae9835bb70afb655b57137e81d0f034204a7ea4deef30b63a130a9218874
|
|
7
|
+
data.tar.gz: ac1b97fa558e63c3a3128d46dabf563af13ec0def315ed98454f9c7328f3299a6c07f91fd1c68b0c792304a05d4778038ebcd1edd2131d885bb10469751c4249
|
|
@@ -49,11 +49,12 @@ module BotChallengePage
|
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
# Does the session already contain a bot detect pass that is good for this request
|
|
53
|
-
#
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
# Does the session already contain a bot detect pass that is good for this request?
|
|
53
|
+
#
|
|
54
|
+
# Does make sure any cookie/session pass is valid for this client/request and not
|
|
55
|
+
# expired.
|
|
56
|
+
#
|
|
57
|
+
def bot_challenge_passed?(request)
|
|
57
58
|
session_data = request.session[self.bot_challenge_config.session_passed_key]
|
|
58
59
|
|
|
59
60
|
return false unless session_data && session_data.kind_of?(Hash)
|
|
@@ -63,9 +64,17 @@ module BotChallengePage
|
|
|
63
64
|
fingerprint = session_data[self::SESSION_FINGERPRINT_KEY]
|
|
64
65
|
|
|
65
66
|
(Time.now - Time.iso8601(datetime) < self.bot_challenge_config.session_passed_good_for ) &&
|
|
66
|
-
(fingerprint == self.bot_challenge_config.session_valid_fingerprint.call(request))
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
(fingerprint == self.bot_challenge_config.session_valid_fingerprint.call(request))
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Used by the guard action: #bot_challenge_passed?, and if so also calls the
|
|
71
|
+
# after_session_passed hook. Has side effects (the hook), so app code that just wants
|
|
72
|
+
# to check should use #bot_challenge_passed? instead.
|
|
73
|
+
def _bot_detect_passed_good?(controller)
|
|
74
|
+
return false unless bot_challenge_passed?(controller.request)
|
|
75
|
+
|
|
76
|
+
controller.instance_exec(self, &self.bot_challenge_config.after_session_passed)
|
|
77
|
+
true
|
|
69
78
|
end
|
|
70
79
|
end
|
|
71
80
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bot_challenge_page
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jonathan Rochkind
|
|
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
180
180
|
- !ruby/object:Gem::Version
|
|
181
181
|
version: '0'
|
|
182
182
|
requirements: []
|
|
183
|
-
rubygems_version:
|
|
183
|
+
rubygems_version: 3.7.1
|
|
184
184
|
specification_version: 4
|
|
185
185
|
summary: Show a bot challenge interstitial for Rails, usually using Cloudflare Turnstile
|
|
186
186
|
test_files: []
|