[issue41552] uuid.uuid1() on macOS doesn't generate unique IDs

2020-08-14 Thread Terry Greeniaus


New submission from Terry Greeniaus :

I'm using Python 3.8.5 on a 2016 MacBook Pro running macOS Catalina 10.15.3.  
This model has a touch bar and macOS communicates with the touch bar via a 
dedicated "iBridge" network interface.  The iBridge network interface uses a 
fixed MAC address that is common across all MacBook Pro models 
(ac:de:48:00:11:22).

Normally uuid.uuid1() picks up my WiFi MAC address (which is obviously unique), 
but this evening I noticed it was generating UUIDs based on the iBridge MAC 
address.  Since the iBridge MAC is shared across all MacBook Pro laptops, 
there's no way to guarantee that the UUIDs are now universally unique.  I'm not 
sure what triggered uuid.uuid1() to start using my iBridge interface although 
there was an Internet outage here at some point so maybe the network interfaces 
got reordered.  The iBridge interface (en5) does appear before my WiFi 
interface (en0) in the output of ifconfig now.

Here's a quick example of the problem:

greent7@avocado:~$ python3
Python 3.8.5 (default, Jul 21 2020, 10:48:26)
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import uuid
>>> uuid.uuid1()
UUID('32bbad32-de12-11ea-a0ee-acde48001122')

And here's the output from ifconfig:

greent7@avocado:~$ ifconfig
lo0: flags=8049 mtu 16384
options=1203
inet 127.0.0.1 netmask 0xff00
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
nd6 options=201
gif0: flags=8010 mtu 1280
stf0: flags=0<> mtu 1280
en5: flags=8863 mtu 1500
ether ac:de:48:00:11:22
inet6 fe80::aede:48ff:fe00:1122%en5 prefixlen 64 scopeid 0x4
nd6 options=201
media: autoselect
status: active
en0: flags=8863 mtu 1500
options=400
ether 78:4f:43:5e:b9:86
inet6 fe80::1c4b:d303:b374:c2f3%en0 prefixlen 64 secured scopeid 0x5
inet6 fd00:1cab:c0ac:fc82:80e:f701:8302:6287 prefixlen 64 autoconf 
secured
inet6 fd00:1cab:c0ac:fc82:1c38:9f17:2073:8eb prefixlen 64 autoconf 
temporary
inet 192.168.0.11 netmask 0xff00 broadcast 192.168.0.255
nd6 options=201
media: autoselect
status: active
en3: flags=8963 mtu 1500
options=460
ether 82:46:1a:46:5c:01
media: autoselect 
status: inactive
en1: flags=8963 mtu 1500
options=460
ether 82:46:1a:46:5c:00
media: autoselect 
status: inactive
en4: flags=8963 mtu 1500
options=460
ether 82:46:1a:46:5c:05
media: autoselect 
status: inactive
en2: flags=8963 mtu 1500
options=460
ether 82:46:1a:46:5c:04
media: autoselect 
status: inactive
bridge0: flags=8822 mtu 1500
options=63
ether 82:46:1a:46:5c:00
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x2
member: en1 flags=3
ifmaxaddr 0 port 7 priority 0 path cost 0
member: en2 flags=3
ifmaxaddr 0 port 9 priority 0 path cost 0
member: en3 flags=3
ifmaxaddr 0 port 6 priority 0 path cost 0
member: en4 flags=3
ifmaxaddr 0 port 8 priority 0 path cost 0
media: 
status: inactive
p2p0: flags=8843 mtu 2304
options=400
ether 0a:4f:43:5e:b9:86
media: autoselect
status: inactive
awdl0: flags=8943 mtu 1484
options=400
ether f6:38:1e:e0:6c:3f
inet6 fe80::f438:1eff:fee0:6c3f%awdl0 prefixlen 64 scopeid 0xc
nd6 options=201
media: autoselect
status: active
llw0: flags=8863 mtu 1500
options=400
ether f6:38:1e:e0:6c:3f
inet6 fe80::f438:1eff:fee0:6c3f%llw0 prefixlen 64 scopeid 0xd
nd6 options=201
media: autoselect
status: active
utun0: flags=8051 mtu 1380
inet6 fe80::afc9:f21a:4d82:2c8d%utun0 prefixlen 64 scopeid 0xe
nd6 options=201
utun1: flags=8051 mtu 2000
inet6 fe80::4b52:18b4:5f46:4edf%utun1 prefixlen 64 scopeid 0xf
nd6 options=201

--
components: macOS
messages: 375387
nosy: ned.deily, ronaldoussoren, terrygreeniaus
priority: normal
severity: normal
status: open
title: uuid.uuid1() on macOS doesn't generate unique IDs
type: behavior
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue41552>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41552] uuid.uuid1() on certain Macs does not generate unique IDs

2020-08-14 Thread Terry Greeniaus


Terry Greeniaus  added the comment:

xoring does not guarantee uniqueness and has a good chance of discarding it, so 
it seems like a bad idea to me.

Suppose I have exactly two adapters with MAC addresses 0 and 3.
Suppose you have exactly two adapters with MAC addresses 1 and 2.

We'll both xor all our addresses and both get 0 ^ 3 == 1 ^ 2.  This trivially 
extends to 48 bits.

Suppose I have exactly two adapters from the same manufacturer.  The xor will 
throw away all of the "uniqueness" guaranteed by the manufacturer OUI and 
replace it with 0.

Suppose you have exactly two adapters from a different manufacturer (and 
nothing else).  The xor will throw away all of your "uniqueness" guaranteed by 
the manufacturer OUI and replace it with 0.

Now the only uniqueness between your UUIDs and my UUIDs will be the timestamp 
and the low-order bits of the xor'd MAC, whereas without the xor your UUIDs and 
my UUIDs would have absolutely been guaranteed to be unique since they are from 
different manufacturers with different OUIs.

I realize that the documentation for uuid1() states that it isn't guaranteed to 
give unique addresses if the time synchronization necessary isn't supported by 
the platform, so I suppose this could even be a documentation fix if no real 
solution can be found, but that would be really undesirable.

--

___
Python tracker 
<https://bugs.python.org/issue41552>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com