graph_attack 2.4.0 → 2.4.1

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: 14073662874173af1e66adb16931c4e8817461c3f36a0ea341d75dbbafb39b1b
4
- data.tar.gz: 58f889613e4ea79ce99b19b788ca837527192c85b0b212a77ce84b2355938720
3
+ metadata.gz: dd64b8cd2ba29de2f592c23f9fa7a0a13072cc043d2530490fb49b6a8c32cba2
4
+ data.tar.gz: c01f23e62b0491feefdd4d35d5a35ff3c793f01025e4a1b847cfc23723166510
5
5
  SHA512:
6
- metadata.gz: 1e9652eb2b3ec822942e58ba9d351fabc5a913ee8c7d1b06cef5a5574b85aa40e9c8140618aedd8ca1f4a30cf2559a9426762e39e2af8918e6e9b1806bdd8101
7
- data.tar.gz: f0488943c372fa9bf2d0c48dae7d942b17cafe24ff3a81121fc97e0bd75ffe5d222bf527477d5279e4bcb04e906f327ea1baa2ccefafd9b99cfc11ee57100f83
6
+ metadata.gz: 21eebd3639e76891ea71eb37b1fb1600f9a85c4d128e9c716d1800823d7deb915d4f21595f24e9694622dd3028271eed5953861f9da2b0a92990836f0594ebef
7
+ data.tar.gz: 0f73e8ac521a9b8e0baa627499ff985c9a35f3df6cf30b2bd48dc3e5482c0655a78c72e2aca00382ecea53cae05ff16776c3e7b5222f22ddb01e63aac6a72868
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  unreleased
2
2
  ----------
3
3
 
4
+ v2.4.1
5
+ ------
6
+
7
+ Fix:
8
+ - Fix threshold behavior to allow N requests instead of N-1.
9
+
4
10
  v2.4.0
5
11
  ------
6
12
 
data/README.md CHANGED
@@ -18,7 +18,7 @@ class QueryType < GraphQL::Schema::Object
18
18
  end
19
19
  ```
20
20
 
21
- This would allow only 15 calls per minute by the same IP address.
21
+ This would allow 15 requests per minute by the same IP address, blocking the 16th and subsequent requests within that 60-second window.
22
22
 
23
23
  ## Requirements
24
24
 
@@ -27,8 +27,12 @@ module GraphAttack
27
27
  def calls_exceeded_on_query?(rate_limited_field)
28
28
  with_redis_client do |redis_client|
29
29
  rate_limit = Ratelimit.new(rate_limited_field, redis: redis_client)
30
- rate_limit.add(key)
31
- rate_limit.exceeded?(key, threshold: threshold, interval: interval)
30
+ if rate_limit.exceeded?(key, threshold: threshold, interval: interval)
31
+ true
32
+ else
33
+ rate_limit.add(key)
34
+ false
35
+ end
32
36
  end
33
37
  end
34
38
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GraphAttack
4
- VERSION = '2.4.0'
4
+ VERSION = '2.4.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graph_attack
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fanny Cheung
8
8
  - Sunny Ripert
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-21 00:00:00.000000000 Z
11
+ date: 2025-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql