Skip to content

bug: currentTime and utcOffset parameters are inaccessible inside template logic #115

@Sup-ri-tha

Description

@Sup-ri-tha

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions