News for hackers. Stuff that matters.
Re:UUIDv47: Store UUIDv7 in DB, emit UUIDv4 outside (SipHash... by JimDabell on Wednesday September 17, 2025 @12:13PM (#45277706)
I like the idea.

UUIDs are often generated client-side. Am I right in thinking that this isn’t possible with this approach? Even if you let clients give you UUIDs and they gave them back the masked versions, wouldn't you be vulnerable to a client providing two UUIDs with different ts and the same rand? So this is only designed for when you are generating the UUIDv7s yourself?

Re:UUIDv47: Store UUIDv7 in DB, emit UUIDv4 outside (SipHash... by move-on-by on Wednesday September 17, 2025 @01:17PM (#45278645)
Any version of UUID except v4 on the client side would be a mistake- as you are relying on it to provide extra information such as a timestamp which might be manipulated.

Of course, UUIDv4 on the client side is not without risk either- needing to validate uniqueness and not re-use of some other ID. For the UUIDv7 on client side- you could add some sanity validation- but really I think it’s best avoided.

Re:UUIDv47: Store UUIDv7 in DB, emit UUIDv4 outside (SipHash... by JimDabell on Wednesday September 17, 2025 @01:45PM (#45279010)
There’s a whole bunch of use-cases where the ability for a user to mess with the timestamp is not a problem. Who cares if a user screws up the ordering of items in a collection only they see? But if you can attack the private key by generating many different ciphertexts for the same rand, that might let you defeat the purpose of this masking.
Re:UUIDv47: Store UUIDv7 in DB, emit UUIDv4 outside (SipHash... by move-on-by on Thursday September 18, 2025 @09:38AM (#45289553)
I concede my above comment was speaking in generalities and has plenty of exceptions. However, I do prefer to fallback on safe defaults, and letting the client choose the UUIDv7 could certainly have some unsafe consequences.
Re:UUIDv47: Store UUIDv7 in DB, emit UUIDv4 outside (SipHash... by lazide on Friday September 19, 2025 @05:56AM (#45299828)
What if a broken client implementation uses the same client ‘generated’ UUID (or very similar) for all client requests?
Re:UUIDv47: Store UUIDv7 in DB, emit UUIDv4 outside (SipHash... by knome on Wednesday September 17, 2025 @01:51PM (#45279070)
creating your uuids client side has a risk of clients toying with the uuids.

creating them server-side risks having a network error cause a client to have requested a resource be created without receiving its id due to a network error before receiving the response, risking double submissions and generally bad recovery options from the UI.

if you need users to provide uuids for consistent network operations, you can have an endpoint responsible for generating signed uuids that expire after a short interval, thereby controlling uuid-time drift (must be used within 1-5 minutes, perhaps), ensuring the client can't forge them to mess with your backend, and still provide a nice and stable client-side-uuid system.

for the uuidv47 thing, you would apply their XOR trick prior to sending the UUID to the user. you presumably just reverse the XOR trick to get the UUIDv7 back from the UUIDv4 you passed them.

Re:UUIDv47: Store UUIDv7 in DB, emit UUIDv4 outside (SipHash... by Lvl999Noob on Thursday September 18, 2025 @01:26AM (#45285773)
Why not have a transient client generated ID for idempotency but a server generated ID for long term reference and storage?
Re:UUIDv47: Store UUIDv7 in DB, emit UUIDv4 outside (SipHash... by ycombinatrix on Wednesday September 17, 2025 @02:01PM (#45279190)
>UUIDs are often generated client-side

since when?

Re:UUIDv47: Store UUIDv7 in DB, emit UUIDv4 outside (SipHash... by darkr on Wednesday September 17, 2025 @04:39PM (#45281125)
It’s not uncommon. Google AIP spec requires it for example. I think the main driver for it is implicit idempotency.
Re:UUIDv47: Store UUIDv7 in DB, emit UUIDv4 outside (SipHash... by eadmund on Thursday September 18, 2025 @06:13AM (#45287813)
The client’s ID for a resource and the server’s ID for that resource need not be the same.

Of course, adding two IDs for a resource complicates things. But so too does trusting client-generated IDs to be universally unique.