wafris 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83c6b329d3746bbf4c287cb873197fdb2ffa624d234985ca776053a9d5c9cf7b
4
- data.tar.gz: 5a8640a929b7d940d2439e6c27bd2612b353057dac92e3da6947f2a75c8c3c55
3
+ metadata.gz: e59525f95ab8d7eb6699b54e29cf5898ccd705a801f2114d19c120ec7764655e
4
+ data.tar.gz: 6c9690caf94f9c521b4bffcaecae3fa15042fc3873f2460f25e02ad68b43f1c4
5
5
  SHA512:
6
- metadata.gz: 9a3fef28735edcf3fda097bca89158c27205a7fdef8326d96f86c8e4306851210f334b5737ca0bbc909da961095fd2f88d7c2af53e99dd8df3e82d10bab8d2eb
7
- data.tar.gz: 83e364033093b4b0c87f6c08b0aa52128c88d0e94efb830f397c48eb8ddea33d4bbca1295f940934faf0b01fd7001446998323ade3324f99bc617e9c30a387ab
6
+ metadata.gz: 31a0bd63d3dcdda330336cd07367ae29c58a864beeecefe6d893eb18dad9335d84c17c3f1391d509c376f4374d7491cdb9d7616edf4b2b10dee8b34c443ee037
7
+ data.tar.gz: 61e9d0164f1082ff2d3da4181c6ccf912b1223499f96cc6011ffce4d12c7328d4f275b81e64fa5967d0dc85a9a4b926fcb609a3ea089006f3d830ac5e308f470
@@ -96,18 +96,21 @@ increment_timebucket_for("user_agent:", current_timebucket, user_agent)
96
96
  increment_timebucket_for("request_path:", current_timebucket, request_path)
97
97
  increment_timebucket_for("host:", current_timebucket, host)
98
98
 
99
+ local foobar = redis.call("ZRANGEBYSCORE", "blocked_ranges", client_ip_to_decimal, client_ip_to_decimal, "LIMIT", 0, 1)
100
+
101
+ redis.breakpoint()
102
+
99
103
  -- BLOCKING LOGIC
100
- -- Safelist Range Check
101
104
  -- TODO: ZRANGEBYSCORE is deprecated in Redis 6.2+. Replace with ZRANGE
102
- if not (next(redis.call("ZRANGEBYSCORE", "allowed_ranges", client_ip_to_decimal, "+inf", "LIMIT", 0, 1)) == nil) then
103
- return "Allowed"
104
- -- Blocklist Range Check
105
- elseif
106
- not (next(redis.call("ZRANGEBYSCORE", "blocked_ranges", client_ip_to_decimal, "+inf", "LIMIT", 0, 1)) == nil)
105
+ if
106
+ -- ZRANGEBYSCORE will always return a lua table, even if empty
107
+ -- TODO: When we introduce ranges we'll have to do an exact check followed by a range starting with decimal ip to infinity.
108
+ -- If the first result returned is "END" that means it falls in the range
109
+ next(redis.call("ZRANGEBYSCORE", "blocked_ranges", client_ip_to_decimal, client_ip_to_decimal, "LIMIT", 0, 1)) ~= nil
107
110
  then
108
111
  increment_timebucket_for("wafris:blocked:", current_timebucket, client_ip)
109
112
  return "Blocked"
110
113
  -- No Matches
111
114
  else
112
- return "Not found"
115
+ return "Allowed"
113
116
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wafris
4
- VERSION = "0.5.2"
4
+ VERSION = "0.5.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wafris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micahel Buckbee
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-05-25 00:00:00.000000000 Z
12
+ date: 2023-05-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: connection_pool