Re: UUID version 6 proposal, initial feedback

Brad Peabody <bradgareth@gmail.com> Wed, 04 July 2018 08:52 UTC

Return-Path: <bradgareth@gmail.com>
X-Original-To: ietf@ietfa.amsl.com
Delivered-To: ietf@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D6B47130DC1 for <ietf@ietfa.amsl.com>; Wed, 4 Jul 2018 01:52:27 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.999
X-Spam-Level:
X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RpzzKJJuqwEX for <ietf@ietfa.amsl.com>; Wed, 4 Jul 2018 01:52:24 -0700 (PDT)
Received: from mail-pf0-x230.google.com (mail-pf0-x230.google.com [IPv6:2607:f8b0:400e:c00::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2716F130E23 for <ietf@ietf.org>; Wed, 4 Jul 2018 01:52:24 -0700 (PDT)
Received: by mail-pf0-x230.google.com with SMTP id s21-v6so2349086pfm.6 for <ietf@ietf.org>; Wed, 04 Jul 2018 01:52:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=/7diuNc8siPPn8gpufkUmwqxJudYdPEN9zwKaovxR04=; b=IPwBBKpIuWKLEmk4hVpM3QiCNCGgWErUYebs5ybI5qnkDPXTOd2j2+i6Ax55QcnQOv AlVSYxOqwzDH4YGFLIP4ULr5a2QFXzHqcjhxmK39up+4v3fvCOtlijLRKT+JoFFg/0Bf 4Z7DeGJJpDzr0iiY2sLFbzlxi2JHdX8TgjJ6bg4hy87P136ck9azIDLLSeS2axAQC5cv uygLGwVrOraHYj1Iftan5n9a8kTQRS0BeAE8OXXDaDzXXHPyZ2jDdrM9r74wNiC8a/UF dHMA8PDKIp/SAJHW2fEsEVRQ/DdjEavls0p2IS54peVasV4ETkv6UwhDw10QxR8t/1Ta Eflg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=/7diuNc8siPPn8gpufkUmwqxJudYdPEN9zwKaovxR04=; b=Cdw7OOUAb9uN3o1/tqMSjGeQToGHHhnI+OusuE8Px1xMLhnYEs8cA6R4DXYmGDr3DY VFWR+PjPKoGHIwtAl1u1ckDJWATcEa9RrQtd2TUmUapDwkhNGfxPDaFzPf0NtLQ3KaLK 4Z8J0HNlGDaW0CYjM6M9CbeItEkYETWDTGyuoNDF0Mm3Eh2ZAb3jMxasSgbh2GjCsUF7 d0/Bu9+tj8WiAH4IGk77SBGa6rUi46uUqhaMivjs5rSv/MEN0VVewMVoZmd79wnnrX6o JaAL37s6BwDg2y61DUt8nP/BjQsOclAJlOVHmNUUrBt+2Nds4RdsjrupKPEsaGtrmEM/ c8cw==
X-Gm-Message-State: APt69E2/vttAhqLq5WXY/ENHGq+zPlOyVzmlYUshvzwM5T/o7lH/eKQH lGVMzTgN5qHQeuYUCo69Ylo=
X-Google-Smtp-Source: AAOMgpevpegA4jsJ1mjx7gi3xMJxnZneIUOjcFmG7534DJe221iJsxbF19nKeLOJlii3VxqGpELOjw==
X-Received: by 2002:a63:26c3:: with SMTP id m186-v6mr1120405pgm.56.1530694343651; Wed, 04 Jul 2018 01:52:23 -0700 (PDT)
Received: from [192.168.1.102] (cpe-23-242-42-48.socal.res.rr.com. [23.242.42.48]) by smtp.gmail.com with ESMTPSA id 14-v6sm5912764pfw.19.2018.07.04.01.52.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Jul 2018 01:52:22 -0700 (PDT)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\))
Subject: Re: UUID version 6 proposal, initial feedback
From: Brad Peabody <bradgareth@gmail.com>
In-Reply-To: <CABkgnnXSxqqinyK4QiwVv-VuzAraHFUGCrm0K0e9dJX_F80bWg@mail.gmail.com>
Date: Wed, 04 Jul 2018 01:52:21 -0700
Cc: IETF discussion list <ietf@ietf.org>, ben@benramsey.com
Content-Transfer-Encoding: quoted-printable
Message-Id: <076C4555-C150-43F0-9D09-CFDF09D0F0A8@gmail.com>
References: <D0894516-3F20-4545-BD7D-BE4FA96FAF75@gmail.com> <CABkgnnXSxqqinyK4QiwVv-VuzAraHFUGCrm0K0e9dJX_F80bWg@mail.gmail.com>
To: Martin Thomson <martin.thomson@gmail.com>
X-Mailer: Apple Mail (2.3273)
Archived-At: <https://mailarchive.ietf.org/arch/msg/ietf/1f-oT1T8K4CkOgg3Kkg5t2igULM>
X-BeenThere: ietf@ietf.org
X-Mailman-Version: 2.1.26
Precedence: list
List-Id: IETF-Discussion <ietf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ietf>, <mailto:ietf-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ietf/>
List-Post: <mailto:ietf@ietf.org>
List-Help: <mailto:ietf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ietf>, <mailto:ietf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Jul 2018 08:52:28 -0000

Thanks Martin,

Those are really good points and I agree.

I’m a bit concerned about moving entirely away from the existing format, as I think there are some useful properties - particularly the ability to extract the time stamp. Also by producing newer versions of UUIDs that are the same size and layout a lot of existing software will continue to work (for example, Cassandra understands UUIDs and works with my prototype “version 6” UUIDs without any modification).

But the points you bring up are quite relevant.  I’m not sure how to address the clock skew leakage that might occur, but definitely the counters and MAC address can go the way of the buffalo. Simply reading from /dev/urandom, et al makes so much more sense these days.

I think there is also real potential in the idea of making them variable length.  If you need compatibility with existing UUID schemes you can use the 128 bit length, but you can also go longer if you require more guarantee of uniqueness or un-guess-ability.

The only other thing that has me pondering on this is how important is the property of being able to tell “is this a valid UUID, and if so what type”.  If we don’t care about this, then it might make sense to have two additional formats - a base64 which is as compact as reasonably possible while still being ASCII, and a base32 which is case-insensitive - they both have merit depending on the use case.  But then add the fact that it’s variable length and it becomes impossible to distinguish the format reliably (i.e you might read the base32 value as base64 by accident).  I can think of some ways to work around this in the format using specific characters in one and not the other, but it starts to feel really hacky.  I’m just not sure if this is actually important for real-world applications.  Many applications just use the UUID opaquely, but not all.  And again, extracting the timestamp can be useful - but then is it reasonable to also say “if you want the time, you’ll need to know the format, you won’t be able to automatically tell the difference between a base64 and base32 UUID”.  One possible simple solution: For UUIDs longer than 128 bits, put a period after the first 128 bits and then encode the rest.  This would make it possible with a few basic checks to tell which encoding format, and would remain URL safe.  And is simple to implement.

All that said, it seems to me we’re headed for a spec that has the following properties:

- Encodes timestamp
- Sorts correctly as raw bytes
- Has the version field in the same place for compatibility
- Supports the existing 128-bit hex representation (NNNNNNNN-NNNN-NNNN-NNNN-NNNNNNNNNNNN) for compatibility but also...
- Specifies alternative (url-safe) base64 encoding for compact string representation while still sorting correctly; and also a base32 encoding where case-insensitivity is required (ideally with a way to scan the string and easily tell which encoding format is being used)
- Instead of existing dangerous bits like counter and MAC address, use secure random data available from OS
- Can be arbitrarily longer as needed, filled with additional random data.

Does that seem about right?

Also, when things settle in terms of the high level requirements, at what point should a rough draft of the spec on this be written?  (And is there some sort of outline I would follow?)

-Brad 


> On Jul 3, 2018, at 7:11 PM, Martin Thomson <martin.thomson@gmail.com> wrote:
> 
> Nice presentation.
> 
> I've always been skeptical of the value of UUIDs.  It's very easy to
> make a unique string.  Formatting it in a particular way, however,
> serves no real purpose and it might not be necessary for your use
> case.
> 
> UUIDs (aside from v4) also have some nasty properties.  For instance,
> revealing a MAC address is now considered problematic.  As is exposing
> the output of a clock, which has been used in interesting ways to
> undermine privacy (clock skew can be used for de-anonymisation, even
> for determining CPU load).  Counters and timers also allow an observer
> to correlate the creation of different identifiers.
> 
> Why not make a string with the properties you desire?  You might need
> more than 120 bits to achieve all that, but that's just another reason
> not to use UUIDs.  A library that provided these functions (maybe
> while addressing the above concerns), would be a valuable addition.
> On Wed, Jul 4, 2018 at 10:42 AM Brad Peabody <bradgareth@gmail.com> wrote:
>> 
>> I would like to get some initial feedback, and suggested next steps, on the idea of making an RFC that covers a version 6 for UUIDs.  It would have an embedded timestamp and sorting by its raw bytes results in a sequence equivalent to sorting by time.  This is not addressed by existing UUID types.  (The closest one is version 1, but due to the byte encoding it does not sort correctly.)
>> 
>> There is also seems to be some ambiguity in the existing RFC on when to increment the counter field which I think can be clarified.
>> 
>> I did a prototype implementation and basic write-up on the details here: https://bradleypeabody.github.io/uuidv6/
>> 
>> I’m also thinking of covering the base64 encoding form which retains the sorting properties but makes it human readable and is significantly shorter than the long hex encoded form.
>> 
>> Having these things is very useful when considering UUIDs as database primary keys, which is becoming more and more common in distributed systems; and indeed this is the main motivation.
>> 
>> Any help or advice on moving forward with this would be appreciated.
>> 
>> - Brad
>>