RocketChat / Rocket.Chat.Go.SDK

Go SDK for REST API and Realtime api
MIT License
60 stars 58 forks source link

Inadequate random ID generation #40

Closed jv283 closed 3 years ago

jv283 commented 3 years ago

There is problem with random ID's that are generated for every new message: https://github.com/RocketChat/Rocket.Chat.Go.SDK/blob/e4a51dfb52e48e8cef8d2f96baa3db4b558ff8c8/realtime/client.go#L95-L97 The default precision for %f is 6 which means that it will take about 1178 new messages until there is less than 50% change that all generated random ID:s are unique.

Proposition: Either increase precision of %f in fmt.Sprintf, or implement more robust way to generate random ID:s.

graywolf336 commented 3 years ago

Closed via #42