fix(stalker): canonicalize replay MAC values

This commit is contained in:
4gray committed 2026-07-27 11:36:20 +02:00
1 parent 38c07e13a3
commit 68d1555975
2 files changed
+3 -4

No files matched your search

@@ -163,7 +163,7 @@ describe('ReplayRun symbols and exact matching', () => {
'password',
'username',
]);
expect(firstSymbols['mac']).toMatch(/^02(?::[0-9a-f]{2}){5}$/);
expect(firstSymbols['mac']).toMatch(/^02(?::[0-9A-F]{2}){5}$/);
expect(firstSymbols['username']).toMatch(/^test-credential-[0-9a-f]+$/);
expect(firstSymbols['password']).not.toBe(firstSymbols['username']);
expect(firstSymbols).not.toHaveProperty('token');
@@ -636,8 +636,7 @@ describe('ReplayRun scheduled expiry and retained-byte defense', () => {
);
}
await jest.advanceTimersByTimeAsync(
REPLAY_RUN_HARD_LIFETIME_MS -
5 * (REPLAY_RUN_INACTIVITY_MS - 1)
REPLAY_RUN_HARD_LIFETIME_MS - 5 * (REPLAY_RUN_INACTIVITY_MS - 1)
);
expect(await Promise.all(settled)).toEqual(
@@ -27,7 +27,7 @@ function generatedValue(node: ReplayGenerateNode, runId: string): string {
const hash = digest(runId, node.symbol, node.valueKind);
switch (node.valueKind) {
case 'mac':
return `02:${hash.slice(0, 2)}:${hash.slice(2, 4)}:${hash.slice(4, 6)}:${hash.slice(6, 8)}:${hash.slice(8, 10)}`;
return `02:${hash.slice(0, 2)}:${hash.slice(2, 4)}:${hash.slice(4, 6)}:${hash.slice(6, 8)}:${hash.slice(8, 10)}`.toUpperCase();
case 'credential':
return `test-credential-${hash.slice(0, 24)}`;
case 'token':