Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UUID.info parses invalid uuid as valid #41

Open
usarekoski opened this issue Dec 2, 2019 · 1 comment · May be fixed by #43
Open

UUID.info parses invalid uuid as valid #41

usarekoski opened this issue Dec 2, 2019 · 1 comment · May be fixed by #43

Comments

@usarekoski
Copy link

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.

@msudgh
Copy link

msudgh commented Jan 5, 2020

I explored info function and it seems that just validates the given UUID based on being a binary value.
It'd be better to be validated with a Regex.

pablocostass pushed a commit to pablocostass/elixir-uuid that referenced this issue Feb 25, 2020
@pablocostass pablocostass linked a pull request Feb 25, 2020 that will close this issue
ryanwinchester referenced this issue in sevenshores/elixir-uuid-utils Oct 21, 2020
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 a pull request may close this issue.

2 participants