Do not use uuid.uuid4() for generating security-critical secrets
45 views
Skip to first unread message
laundmo
unread,
Oct 21, 2025, 11:55:42 AMOct 21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to py4web
In various places, py4web uses uuid.uuid4() for generating secrets.
uuids are not meant to be used for security-critical applications. The UUID specification and the python documentation for uuid.uuid4() do not make any guarantees about security.
For CPython, the uuid.uuid4() implementation happens to use os.urandom as the underlying randomness source, which is in fact documented as "suitable for cryptographic use." but this is an implementation detail and should not be relied upon. Other python implementations might implement uuid4 differently, which would make running py4web on them insecure.
The places where uuid4 is used for (seemingly) cryptographic purposes: