8000 Consider using XID for UUIDs · Issue #930 · absmach/supermq · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Consider using XID for UUIDs #930

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

Closed
drasko opened this issue Nov 4, 2019 · 9 comments
Closed

Consider using XID for UUIDs #930

drasko opened this issue Nov 4, 2019 · 9 comments

Comments

@drasko
Copy link
Contributor
drasko commented Nov 4, 2019

FEATURE REQUEST

  1. Is there an open issue addressing this request? If it does, please add a "+1" reaction to the
    existing issue, otherwise proceed to step 2.

  2. Describe the feature you are requesting, as well as the possible use case(s) for it.

Mainflux curently uses UUIDv4, which is great for the purpose, but can have some drawbacks explained here:

  • Length (128 bit)
  • Non-sortable

I am not sure that we need sortable UUIDs, but I think shortening the length of the ID can be beneficial for clients that go over cellular or satelite connections and saving any byte on bandwidth (multiplied by millions of devices) can be beneficial.

As described in this text, xid seem interesting indeed.

On the other hand, as API key (token) is also in the form of UUID, maybe lowering its length can have negative impact on security.

  1. Indicate the importance of this feature to you (must-have, should-have, nice-to-have).
    nice-to-have
@MisterScience5
Copy link
MisterScience5 commented Aug 22, 2020

I could use this feature, as we're creating a product that implements the SIM7020 chipset for 4G NB-IOT communications.

The chipset lacks PPP support, so the internal client has to be used, and this only supports a maximum username for MQTT connections of 32 characters, which makes connecting to MF with the standard ID's impossible.

For us this feature is a should-have, because of the aforementioned limitations of the SIM7020, however we are working on a workaround.

@drasko
Copy link
Contributor Author
drasko commented Sep 7, 2020

I am not sure if we can make ID format optional - it is not good idea, can create havoc :).

But it would not be so hard to replace UUIDv4 currently used with XID.

@MisterScience5 did you succeed to solve your problem, or we should look into this issue more carefully? I am reluctant of changing ID format now, without huge need. I would rather leave this for post-1.0 version.

@MisterScience5
Copy link

I am in the process of doing so - just using HTTPS as the modem handles that (somewhat) better.

As a sidenote, getting MQTTS working on the modem is a nightmare too, so for me this is not critical - I will adapt:)

@drasko
Copy link
Contributor Author
drasko commented Sep 7, 2020

Great to hear that you've found a workaround. We are always striving in making Mainflux better and more complete, we just need to estimate where is good to make an engineering compromise.

We need to understand better this problem and probably address it when we have more time. For now it is low priority.

@drasko
Copy link
Contributor Author
drasko commented Oct 31, 2020

https://blog.kowalczyk.info/article/JyRZ/generating-good-unique-ids-in-go.html

http://antoniomo.com/blog/2017/06/03/unique-ids-in-golang-part-3/

https://forum.cockroachlabs.com/t/best-practice-for-xid-primary-keys/2655

I know you’ve looked into adding ULIDs, (github.com/cockroachdb/cockroach/issues/24733) but my vote is for xid's; solves the same problem in less space and doens’t require a lock when used concurrently (github.com/rs/xid/issues/42).

@drasko
Copy link
Contributor Author
drasko commented Oct 31, 2020

One more thing to note is that it would be good to have true randomness and unpredictability of UUIDs, as they can be used for tokens (passwords) as well.

Related to this I asked a question about xid randomness here: rs/xid#63

Reference: https://security.stackexchange.com/questions/165987/is-uuid-v4-cryptographically-safe-for-passwords

@drasko drasko added this to the 0.12.0 milestone Nov 1, 2020
@drasko drasko modified the milestones: 0.12.0, 0.13.0 Nov 22, 2020
@drasko drasko changed the title Consider using xid for UUIDs Consider using XID for UUIDs Nov 25, 2020
@drasko
Copy link
Contributor Author
drasko commented Nov 25, 2020

I am concerned about the state of XID development: questions are not responded in a timely fashion, issues hanging for a long time: https://github.com/rs/xid/issues

Because of low responsiveness, I would disqualify this format and pick ULID as a better candidate.

ULID Go implementation seems to be very active.

@drasko
Copy link
Contributor Author
drasko commented Dec 3, 2020

@drasko drasko assigned manuio and unassigned dborovcanin Apr 3, 2021
@manuio manuio modified the milestones: 0.13.0, 0.14.0 Jan 11, 2022
@drasko
Copy link
Contributor Author
drasko commented Jan 11, 2023

After many considerations, we have decided to stick with UUIDv4 as the only standardized (by IETF) specification. Sticking to standards is important.

Both ULID and XID are not yet officially standardized.

@drasko drasko closed this as completed Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0