Skip to content

UUID.info parses invalid uuid as valid #41

@usarekoski

Description

@usarekoski

It seems that UUID.info/1 parses every numeric string with length 16 as uuid.

elixir-uuid version 1.2.1:

UUID.info("0000000000000000")
{:ok,
 [
   uuid: "0000000000000000",
   binary: "0000000000000000",
   type: :raw,
   version: 3,
   variant: :reserved_ncs
 ]}

In elixir-uuid version 1.2.0 behaviour is different and numeric string is parsed correctly.

UUID.info("0000000000000000")
{:error, "Invalid argument; Not a valid UUID: 0000000000000000"}

I was using UUID.info/1 to detect if arbitary string is uuid.
From README:

UUID.info/1 returns a tuple of {:ok, info} for valid cases or {:error, reason} if the argument is not a UUID string.

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