Skip to content

fix(packet): use crypto.randomInt for Packet.uuid (RFC 5452)#118

Closed
msimerson wants to merge 0 commit into
lsongdev:masterfrom
NicTool:unknown-RR-encode
Closed

fix(packet): use crypto.randomInt for Packet.uuid (RFC 5452)#118
msimerson wants to merge 0 commit into
lsongdev:masterfrom
NicTool:unknown-RR-encode

Conversation

@msimerson
Copy link
Copy Markdown
Collaborator

@msimerson msimerson commented May 25, 2026

📑 Description

Packet.uuid now returns crypto.randomInt(0x10000) instead of Math.floor(Math.random() * 1e5). This gives a CSPRNG-sourced 16-bit transaction ID (per RFC 5452 §3, anti-spoofing), and the range is now correctly clamped to [0, 0xFFFF] rather than the old [0, 99999] (which overflowed the 16-bit field for values ≥ 65536)

✅ Checks

  • My pull request adheres to the code style of this project
  • All the tests have passed

@lsongdev lsongdev marked this pull request as ready for review May 25, 2026 23:13
@msimerson msimerson closed this May 25, 2026
@msimerson msimerson force-pushed the unknown-RR-encode branch from feca86f to 972e223 Compare May 25, 2026 23:36
@msimerson msimerson changed the title fix(packet): preserve RDLENGTH+RDATA for unknown RR fix(packet): use crypto.randomInt for Packet.uuid (RFC 5452) May 25, 2026
@msimerson msimerson mentioned this pull request May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant