فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

test(A06): reject malformed clock input in offline lease

davoodmehraban89 committed Oct 19, 2026 at 10:47 UTC 1d8e5ede88eb4cd148bdcc44438abf136921538a
1 file changed +10
tests/a06-signed-license-integration.test.mjs
+10
@@ -66,3 +66,13 @@ test('A06: a caller-supplied forged public key is not automatically trusted by t
66 const attackerToken = await sign(payload);
67 assert.equal(await validateOfflineActivation(attackerToken, null, payload.installationId, NOW), false);
68 });
69 +
70 +test('A06: invalid wall-clock inputs cannot validate a signed offline lease', async () => {
71 + const { pub, payload, sign } = await newSignedExample();
72 + const token = await sign(payload);
73 + for (const invalidNow of [NaN, Infinity, -Infinity, -1, 1.5, Number.MAX_VALUE, null, undefined, '2026-10-15']) {
74 + assert.equal(await validateOfflineActivation(token, pub, payload.installationId, invalidNow),
75 + false, String(invalidNow));
76 + }
77 + assert.equal(await validateOfflineActivation(token, pub, payload.installationId, NOW), true);
78 +});