-
Notifications
You must be signed in to change notification settings - Fork 668
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
use uuid.NewSHA1 package to generate uuids #997
Conversation
62fcd4c
to
10471a0
Compare
It looks like CodeQL runs on an earlier version of Go |
10471a0
to
19314fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@elezar ?
Have you tested to ensure that the generated UUID is the same for a constant seed value? |
I haven't had the chance to test this on a running k8s cluster. I'll keep you posted on that. However, I tried this sample go programme and I was able to confirm that UUID was generated deterministically for a given seed
|
We are not using these random numbers to generate a cryptographically secure random number -- we just want a unique idenfiier for a set of input IPs. I'm happy to make this change, but let's add tests that capture the behaviour since we can't have IMEX domain IDs changing across device plugin updates. |
Given the following post: https://stackoverflow.com/questions/77925673/generate-uuid-based-on-a-namespace-string-in-go Would switching to using:
https://pkg.go.dev/github.com/google/uuid#NewSHA1 or https://pkg.go.dev/github.com/google/uuid#NewMD5 where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're going to make a change such as this we should use the uuid.NewSHA1
or uuid.NewMD5
functions instead of rolling our own.
This was called out in the review of the original code in #965
4eebdd7
to
c59a4cd
Compare
88712a2
to
69e322a
Compare
Signed-off-by: Tariq Ibrahim <[email protected]>
69e322a
to
1313167
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tariq1890
Here is a post that goes into detail on the security limitations of themath/rand
package.Since the IMEX changes haven't publicised yet, I thought this would be a safe starting point to implement this change