-
-
Notifications
You must be signed in to change notification settings - Fork 57
bug: currentTime and utcOffset parameters are inaccessible inside template logic #115
Description
Problem
trigger() and init() in TemplateArchiveProcessor accept currentTime and utcOffset as parameters but these values never reach the executing logic.
Both methods pass them in arguments but omit them from argumentNames:
// trigger()
argumentNames: ['data', 'request', 'state'],
arguments: [data, request, state, currentTime, utcOffset] // currentTime and utcOffset unnamed
evalDangerously() builds new Function(...argumentNames, code) - only named arguments are accessible. currentTime and utcOffset silently become undefined with no error or warning.
Impact
Any template logic relying on currentTime for deterministic evaluation (e.g. audit replays, timezone-aware calculations) will silently receive undefined and fall back to the server's live clock instead.
Reproduction
Add console.log('currentTime received:', currentTime) inside trigger() in logic.ts and run npm run test -> output confirms currentTime is undefined
despite being passed by the caller.