Personal Telegram developer console for GitHub
test: enforce owner-bound compact approval callbacks
davoodmehraban89 committed
Oct 3, 2026 at 05:30 UTC
1281c45ca0c246d15786bc3f8039d81ad5e0b1d1
1 file changed
+6
-1
test/approval.test.js
+6
-1
@@ -25,6 +25,8 @@ test('ApprovalService issues and verifies a signed owner-bound token', async ()
25
input: { repoId: 7, runId: 9 }
26
});
27
28
+ assert.ok(`approve:${token}`.length <= 64, 'approval callback must fit Telegram callback_data');
29
+
30
const payload = await service.verify(token, {
31
ownerId: '42',
32
pluginId: 'github',
@@ -61,7 +63,10 @@ test('ApprovalService rejects tampered, expired and mismatched tokens', async ()
63
64
await assert.rejects(() => service.verify(`${token}x`, { ownerId: '42' }), /invalid approval/i);
65
await assert.rejects(() => service.verify(token, { ownerId: '99' }), /owner/i);
64
- await assert.rejects(() => service.verify(token, { actionId: 'github.workflow.run.rerun_failed' }), /action/i);
66
+ await assert.rejects(() => service.verify(token, {
67
+ ownerId: '42',
68
+ actionId: 'github.workflow.run.rerun_failed'
69
+ }), /action/i);
70
now += 2000;
71
await assert.rejects(() => service.verify(token, { ownerId: '42' }), /expired/i);
72
});