sidekiq-unique-jobs 8.0.9 → 8.0.10

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: de442ce815fcfc00992295bd4160cfcf122815282e652cccca8c73ce1e62b351
4
- data.tar.gz: f01d32c217f81f41abf34666c43acdddcb8148e6f7ca0df8146d408f9ed14f8e
3
+ metadata.gz: 8cd95f03398a1663b2afbba47f61736cfd3a0ab91fcc0d5b90d353d4f283db07
4
+ data.tar.gz: ced0a60e5fad52b5f2a66dcc29b10a221c6d39f4c4089d812327922d3b6b4e8b
5
5
  SHA512:
6
- metadata.gz: aec1ab15a3a3c1959bc137aaad674fa9e0854ca354b2226c352901f4d7d7c9cc6c8ef8d805b3b1ad680672eebca52a332de916a5e10d5f4d8b7b439bb677c7c0
7
- data.tar.gz: 9af5d9ce6dda38757fb33aa33d86c337cd40751fc55bad37ad5c3f98cb04225209953843b7ec137e9295b8da2c2a40a640c7735f1d623c17851621b577b7a03e
6
+ metadata.gz: d72a8b181407ccc09e4f11c9d8f0860df65f80373c2064ec0f7d743d2bde4273cde1e117f2983b8f71b3a2c9f17c8b9ab8808395991030617bb6b380073457be
7
+ data.tar.gz: 2908759b402bff47b1ace5c9ab666a10779085c89b90c6261b4c935fde97cbf0f8291c8bf2df48e0b46c302eaa66f169785fdf0503ad97fcf0d43a0e0fd1b47d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [v8.0.9](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v8.0.9) (2024-02-12)
4
+
5
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v8.0.8...v8.0.9)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - note: The RCE vulnerability was a false alarm, `sidekiq-unique-jobs` was not vulnerable to RCE. You can find additional information in the PR linked below.
10
+ - fix\(rce\): prevent remot code execution [\#833](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/833) ([mhenrixon](https://github.com/mhenrixon))
11
+
3
12
  ## [v8.0.8](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v8.0.8) (2024-02-12)
4
13
 
5
14
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v8.0.7...v8.0.8)
@@ -82,7 +82,7 @@ module SidekiqUniqueJobs
82
82
  # Deletes the lock regardless of if it has a pttl set
83
83
  #
84
84
  def delete!
85
- call_script(:delete, key.to_a, [job_id, config.pttl, config.type, config.limit]).to_i.positive?
85
+ call_script(:delete, key.to_a, argv).to_i.positive?
86
86
  end
87
87
 
88
88
  #
@@ -362,7 +362,11 @@ module SidekiqUniqueJobs
362
362
  end
363
363
 
364
364
  def argv
365
- [job_id, config.pttl, config.type, config.limit]
365
+ [job_id, config.pttl, config.type, config.limit, lock_score]
366
+ end
367
+
368
+ def lock_score
369
+ item[AT].to_s
366
370
  end
367
371
 
368
372
  def lock_info
@@ -375,6 +379,7 @@ module SidekiqUniqueJobs
375
379
  TYPE => config.type,
376
380
  LOCK_ARGS => item[LOCK_ARGS],
377
381
  TIME => now_f,
382
+ AT => item[AT],
378
383
  )
379
384
  end
380
385
 
@@ -13,14 +13,15 @@ local job_id = ARGV[1]
13
13
  local pttl = tonumber(ARGV[2])
14
14
  local lock_type = ARGV[3]
15
15
  local limit = tonumber(ARGV[4])
16
+ local lock_score = ARGV[5]
16
17
  -------- END lock arguments -----------
17
18
 
18
19
  -------- BEGIN injected arguments --------
19
- local current_time = tonumber(ARGV[5])
20
- local debug_lua = tostring(ARGV[6]) == "1"
21
- local max_history = tonumber(ARGV[7])
22
- local script_name = tostring(ARGV[8]) .. ".lua"
23
- local redisversion = tostring(ARGV[9])
20
+ local current_time = tonumber(ARGV[6])
21
+ local debug_lua = tostring(ARGV[7]) == "1"
22
+ local max_history = tonumber(ARGV[8])
23
+ local script_name = tostring(ARGV[9]) .. ".lua"
24
+ local redisversion = tostring(ARGV[10])
24
25
  --------- END injected arguments ---------
25
26
 
26
27
  -------- BEGIN local functions --------
@@ -15,15 +15,16 @@ local job_id = ARGV[1]
15
15
  local pttl = tonumber(ARGV[2])
16
16
  local lock_type = ARGV[3]
17
17
  local limit = tonumber(ARGV[4])
18
+ local lock_score = ARGV[5]
18
19
  -------- END lock arguments -----------
19
20
 
20
21
 
21
22
  -------- BEGIN injected arguments --------
22
- local current_time = tonumber(ARGV[5])
23
- local debug_lua = tostring(ARGV[6]) == "1"
24
- local max_history = tonumber(ARGV[7])
25
- local script_name = tostring(ARGV[8]) .. ".lua"
26
- local redisversion = ARGV[9]
23
+ local current_time = tonumber(ARGV[6])
24
+ local debug_lua = tostring(ARGV[7]) == "1"
25
+ local max_history = tonumber(ARGV[8])
26
+ local script_name = tostring(ARGV[9]) .. ".lua"
27
+ local redisversion = ARGV[10]
27
28
  --------- END injected arguments ---------
28
29
 
29
30
 
@@ -62,8 +63,16 @@ if lock_type == "until_expired" and pttl and pttl > 0 then
62
63
  log_debug("ZADD", expiring_digests, current_time + pttl, digest)
63
64
  redis.call("ZADD", expiring_digests, current_time + pttl, digest)
64
65
  else
65
- log_debug("ZADD", digests, current_time, digest)
66
- redis.call("ZADD", digests, current_time, digest)
66
+ local score
67
+
68
+ if #lock_score == 0 then
69
+ score = current_time
70
+ else
71
+ score = lock_score
72
+ end
73
+
74
+ log_debug("ZADD", digests, score, digest)
75
+ redis.call("ZADD", digests, score, digest)
67
76
  end
68
77
 
69
78
  log_debug("HSET", locked, job_id, current_time)
@@ -10,18 +10,19 @@ local digests = KEYS[7]
10
10
 
11
11
 
12
12
  -------- BEGIN lock arguments ---------
13
- local job_id = ARGV[1] -- The job_id that was previously primed
14
- local pttl = tonumber(ARGV[2])
15
- local lock_type = ARGV[3]
16
- local limit = tonumber(ARGV[4])
13
+ local job_id = ARGV[1] -- The job_id that was previously primed
14
+ local pttl = tonumber(ARGV[2])
15
+ local lock_type = ARGV[3]
16
+ local limit = tonumber(ARGV[4])
17
+ local lock_score = ARGV[5]
17
18
  -------- END lock arguments -----------
18
19
 
19
20
 
20
21
  -------- BEGIN injected arguments --------
21
- local current_time = tonumber(ARGV[5])
22
- local debug_lua = tostring(ARGV[6]) == "1"
23
- local max_history = tonumber(ARGV[7])
24
- local script_name = tostring(ARGV[8]) .. ".lua"
22
+ local current_time = tonumber(ARGV[6])
23
+ local debug_lua = tostring(ARGV[7]) == "1"
24
+ local max_history = tonumber(ARGV[8])
25
+ local script_name = tostring(ARGV[9]) .. ".lua"
25
26
  --------- END injected arguments ---------
26
27
 
27
28
 
@@ -1,22 +1,22 @@
1
1
  local function delete_from_queue(queue, digest)
2
- local per = 50
3
- local total = redis.call("LLEN", queue)
4
- local index = 0
5
- local result = nil
2
+ local total = redis.call("LLEN", queue)
3
+ local per = 50
4
+
5
+ for index = 0, total, per do
6
+ local items = redis.call("LRANGE", queue, index, index + per - 1)
6
7
 
7
- while (index < total) do
8
- local items = redis.call("LRANGE", queue, index, index + per -1)
9
8
  if #items == 0 then
10
9
  break
11
10
  end
11
+
12
12
  for _, item in pairs(items) do
13
13
  if string.find(item, digest) then
14
14
  redis.call("LREM", queue, 1, item)
15
- result = item
16
- break
15
+
16
+ return item
17
17
  end
18
18
  end
19
- index = index + per
20
19
  end
21
- return result
20
+
21
+ return nil
22
22
  end
@@ -1,19 +1,29 @@
1
1
  local function delete_from_sorted_set(name, digest)
2
- local per = 50
3
- local total = redis.call("zcard", name)
4
- local index = 0
5
- local result
2
+ local score = redis.call("ZSCORE", "uniquejobs:digests", digest)
3
+ local total = redis.call("ZCARD", name)
4
+ local per = 50
5
+
6
+ for offset = 0, total, per do
7
+ local items
8
+
9
+ if score then
10
+ items = redis.call("ZRANGE", name, score, "+inf", "BYSCORE", "LIMIT", offset, per)
11
+ else
12
+ items = redis.call("ZRANGE", name, offset, offset + per -1)
13
+ end
14
+
15
+ if #items == 0 then
16
+ break
17
+ end
6
18
 
7
- while (index < total) do
8
- local items = redis.call("ZRANGE", name, index, index + per -1)
9
19
  for _, item in pairs(items) do
10
20
  if string.find(item, digest) then
11
21
  redis.call("ZREM", name, item)
12
- result = item
13
- break
22
+
23
+ return item
14
24
  end
15
25
  end
16
- index = index + per
17
26
  end
18
- return result
27
+
28
+ return nil
19
29
  end
@@ -10,19 +10,20 @@ local digests = KEYS[7]
10
10
 
11
11
 
12
12
  -------- BEGIN lock arguments ---------
13
- local job_id = ARGV[1]
14
- local pttl = tonumber(ARGV[2])
15
- local lock_type = ARGV[3]
16
- local limit = tonumber(ARGV[4])
13
+ local job_id = ARGV[1]
14
+ local pttl = tonumber(ARGV[2])
15
+ local lock_type = ARGV[3]
16
+ local limit = tonumber(ARGV[4])
17
+ local lock_score = ARGV[5]
17
18
  -------- END lock arguments -----------
18
19
 
19
20
 
20
21
  -------- BEGIN injected arguments --------
21
- local current_time = tonumber(ARGV[5])
22
- local debug_lua = tostring(ARGV[6]) == "1"
23
- local max_history = tonumber(ARGV[7])
24
- local script_name = tostring(ARGV[8]) .. ".lua"
25
- local redisversion = ARGV[9]
22
+ local current_time = tonumber(ARGV[6])
23
+ local debug_lua = tostring(ARGV[7]) == "1"
24
+ local max_history = tonumber(ARGV[8])
25
+ local script_name = tostring(ARGV[9]) .. ".lua"
26
+ local redisversion = ARGV[10]
26
27
  --------- END injected arguments ---------
27
28
 
28
29
 
@@ -3,5 +3,5 @@
3
3
  module SidekiqUniqueJobs
4
4
  #
5
5
  # @return [String] the current SidekiqUniqueJobs version
6
- VERSION = "8.0.9"
6
+ VERSION = "8.0.10"
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-unique-jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.9
4
+ version: 8.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-12 00:00:00.000000000 Z
11
+ date: 2024-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby