Skip to content

fix: use secure random for UUID generation#602

Open
wgtmac wants to merge 1 commit intoapache:mainfrom
wgtmac:fix-secure-uuid-generation-1584258024710464398
Open

fix: use secure random for UUID generation#602
wgtmac wants to merge 1 commit intoapache:mainfrom
wgtmac:fix-secure-uuid-generation-1584258024710464398

Conversation

@wgtmac
Copy link
Member

@wgtmac wgtmac commented Mar 24, 2026

Replaced the non-cryptographically secure std::mt19937 with std::random_device for generating UUID v4 and v7. This provides a cryptographically secure random source on modern systems.

Replaced the non-cryptographically secure std::mt19937 with std::random_device
for generating UUID v4 and v7. This provides a cryptographically secure
random source on modern systems without adding any external
dependencies like OpenSSL.

Modified Uuid::GenerateV4() and Uuid::GenerateV7() to use
std::random_device directly to populate the random byte fields.
This prevents potential predictability issues with generated UUIDs.

Co-authored-by: wgtmac <4684607+wgtmac@users.noreply.github.com>
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