Skip to content

use of uuid4.hex() for token generation is not secure #12

@socketpair

Description

@socketpair

binascii.b2a_base64(os.urandom(24))[:-1] is faster and much secure since:

  1. does not involve uuid, that is not suitable for secure token generations
  2. use OS provided much more secure random as opposed to python random
  3. generate 32-byte length string too, but, 64**24 = 2**144 random items, while your way generates 256**16 = 2**128 variants

it needs to be checked for special symbols like / and +

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions