Skip to content

Commit 811846e

Browse files
committed
fix(logs): harden Lua marker guard against non-table decoded values
Guard the monotonic-check index with type(decoded) == 'table' so a corrupted Redis field that decodes to a non-table (e.g. a number) can't error the eval; our write path only ever stores JSON objects, so this is defense-in-depth.
1 parent 6c4c289 commit 811846e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

apps/sim/lib/logs/execution/progress-markers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const SET_MARKER_SCRIPT = `
4646
local existing = redis.call('HGET', KEYS[1], ARGV[1])
4747
if existing then
4848
local ok, decoded = pcall(cjson.decode, existing)
49-
if ok and decoded[ARGV[2]] and tostring(decoded[ARGV[2]]) > ARGV[3] then
49+
if ok and type(decoded) == 'table' and decoded[ARGV[2]] and tostring(decoded[ARGV[2]]) > ARGV[3] then
5050
redis.call('PEXPIRE', KEYS[1], ARGV[5])
5151
return 0
5252
end

0 commit comments

Comments
 (0)