[New-bugs-announce] [issue36757] uuid constructor accept invalid strings (extra dash)

Cédric Cabessa report at bugs.python.org
Tue Apr 30 05:19:48 EDT 2019


New submission from Cédric Cabessa <cedric.cabessa at gmail.com>:

UUID constructor accept string with too many dashes or keyword like urn: / uuid:

For eg, this code do not raise

```
>>> import uuid
>>> uuid.UUID('0be--468urn:urn:urn:urn:54-4bf9-41----------d4-9697-41d735uuid:4fbe85uuid:')
UUID('0be46854-4bf9-41d4-9697-41d7354fbe85')
```

For the context, we use a validator based on `uuid.UUID` for an API.
Some customer send string with a UUID followed by extra `-`, the validator let it pass but the sql connector raise an exception

We workaround this in our validator, but UUID constructor should not accept string like the one in exemple

----------
components: Library (Lib)
messages: 341141
nosy: Cédric Cabessa
priority: normal
severity: normal
status: open
title: uuid constructor accept invalid strings (extra dash)
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36757>
_______________________________________


More information about the New-bugs-announce mailing list