otori 0.4.0 → 0.5.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 +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +18 -1
- data/lib/otori/validator.rb +1 -0
- data/lib/otori/version.rb +1 -1
- data/lib/otori.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: 7d06214bc12e9ac02bb0989a000bbf68987a12cc15d0a3c178a1fffcfd92503f
|
|
4
|
+
data.tar.gz: 474f1fb57b296c594d22fb4c00126658c9209fe0f8c10a323b0f34c014893e26
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f58ff908079e04df4436fcf0266e22cc1453c020a295f4e2fe6f0317664efd587ec7e2dbf45c6492035823ec212414a86939aab81d7176fb595bf65fba4d4fcc
|
|
7
|
+
data.tar.gz: 686f43334060ddc3067be606224c9b07b5a1e1fefc6519faa3e75cc1fc572f4967909d60ea08b32f35c53053408b6dfd79dd71e7c29067387e49c94fb4899e93
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.5.0] - 2026-10-13
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Passing `wait: false` to `Otori.reason` / `Otori.caught?` (and the
|
|
15
|
+
Rails/Hanami `honeypot` macros) skips the timing check entirely while
|
|
16
|
+
keeping the filled-field check active. Useful for forms where
|
|
17
|
+
password-manager autofill or sticky-session returns make even a short
|
|
18
|
+
timer prone to false positives. `wait: nil` continues to fall back to
|
|
19
|
+
`config.default_delay`; only an explicit `false` disables timing.
|
|
20
|
+
|
|
10
21
|
## [0.4.0] - 2026-10-13
|
|
11
22
|
|
|
12
23
|
### Added
|
data/README.md
CHANGED
|
@@ -18,7 +18,8 @@ techniques into one gem:
|
|
|
18
18
|
|
|
19
19
|
1. **Invisible fields**. Bots fill out every field, including ones hidden with CSS.
|
|
20
20
|
2. **Timing checks**. Bots submit forms instantly, humans need more time.
|
|
21
|
-
3. **Input signals**. Bots don't tend to trigger mouse, touch, scroll,
|
|
21
|
+
3. **Input signals**. Bots don't tend to trigger mouse, touch, scroll,
|
|
22
|
+
keyboard, or focus events.
|
|
22
23
|
|
|
23
24
|
When either of the first two checks fail, the submission is quietly rejected.
|
|
24
25
|
The bot thinks it succeeded and moves on. The third one can be used to reject
|
|
@@ -173,6 +174,14 @@ honeypot "note" do |_req, _res|
|
|
|
173
174
|
end
|
|
174
175
|
```
|
|
175
176
|
|
|
177
|
+
Pass `wait: false` to skip the timing check entirely while keeping the
|
|
178
|
+
filled-field check active. Useful on login or password-reset forms where
|
|
179
|
+
password-manager autofill routinely beats any reasonable timer:
|
|
180
|
+
|
|
181
|
+
```ruby
|
|
182
|
+
honeypot "user[website]", wait: false
|
|
183
|
+
```
|
|
184
|
+
|
|
176
185
|
To act on the input-signals rating, evaluate it inside `handle`:
|
|
177
186
|
|
|
178
187
|
```ruby
|
|
@@ -243,6 +252,14 @@ class SignUpsController < ApplicationController
|
|
|
243
252
|
end
|
|
244
253
|
```
|
|
245
254
|
|
|
255
|
+
Pass `wait: false` to skip the timing check entirely while keeping the
|
|
256
|
+
filled-field check active. Useful on forms where password-manager autofill
|
|
257
|
+
beats any reasonable timer (login, password reset):
|
|
258
|
+
|
|
259
|
+
```ruby
|
|
260
|
+
honeypot :username, wait: false, only: :create
|
|
261
|
+
```
|
|
262
|
+
|
|
246
263
|
When the honeypot is tripped, the request halts with `:no_content` by default.
|
|
247
264
|
To customize the response, pass a block. The block optionally receives the
|
|
248
265
|
catch reason (`:filled` or `:too_fast`), handy for logging or branching:
|
data/lib/otori/validator.rb
CHANGED
|
@@ -10,6 +10,7 @@ module Otori
|
|
|
10
10
|
|
|
11
11
|
def elapsed?(timestamp_ms, wait_seconds, now: monotonic_ms)
|
|
12
12
|
return true if Otori.config.disable_delay
|
|
13
|
+
return true if wait_seconds == false
|
|
13
14
|
return false if timestamp_ms.nil?
|
|
14
15
|
|
|
15
16
|
(now - timestamp_ms.to_i) >= (wait_seconds.to_f * 1000)
|
data/lib/otori/version.rb
CHANGED
data/lib/otori.rb
CHANGED
|
@@ -35,7 +35,7 @@ module Otori
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def reason(name, params:, session:, wait: nil)
|
|
38
|
-
wait
|
|
38
|
+
wait = config.default_delay if wait.nil?
|
|
39
39
|
session_key = config.session_key(name)
|
|
40
40
|
stored = session_get(session, session_key)
|
|
41
41
|
filled = Validator.filled?(param_value(params, name))
|