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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9139cc5240c7900afc1038f7634429d8cac065d9e22c3645e4891dd9f1fd9103
4
- data.tar.gz: d0adef9a1384d5123b7e304879fb9691ebc35e77e238b39a6348419ac8bde074
3
+ metadata.gz: 7d06214bc12e9ac02bb0989a000bbf68987a12cc15d0a3c178a1fffcfd92503f
4
+ data.tar.gz: 474f1fb57b296c594d22fb4c00126658c9209fe0f8c10a323b0f34c014893e26
5
5
  SHA512:
6
- metadata.gz: e03586c88e10498d34371303c0d87b09cb8bf643d99e8e30f5b0b19a6ab2851476f6290c547b74d6cfd7c819b281269ccf76d706bc5e42dd03131fa49d4965cf
7
- data.tar.gz: 44b8afe56864c015efc19ee2a00ede9167f53bfe471ec7e74ef5ec5d05414522c2835c173e3c5005248447b2241d15c8b1c20e38ed5d4981d986e6d8456ab823
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, keyboard, or focus events.
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:
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Otori
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
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 ||= config.default_delay
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))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: otori
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wout