Skip to content
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

Migrate from satori/go.uuid to gofrs/uuid #6554

Merged
merged 1 commit into from Mar 4, 2024

Conversation

oksanabaza
Copy link
Contributor

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Replace satori/go.uuid with gofrs/uuid to remove a CVE.

Which issue(s) this PR fixes:

Fixes # High CVEs

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Feb 22, 2024
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 22, 2024
@oksanabaza oksanabaza marked this pull request as draft February 22, 2024 15:12
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. area/vertical-pod-autoscaler labels Feb 22, 2024
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 22, 2024
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 22, 2024
@oksanabaza oksanabaza marked this pull request as ready for review February 22, 2024 23:28
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 22, 2024
@oksanabaza
Copy link
Contributor Author

@feiskyer and @x13n could you please review this PR?

@@ -263,3 +262,5 @@ replace k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation
replace k8s.io/kms => k8s.io/kms v0.29.0-alpha.3

replace k8s.io/endpointslice => k8s.io/endpointslice v0.29.0-alpha.3

replace github.com/satori/go.uuid => github.com/gofrs/uuid/v5 v5.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you are removing the usage of /satori, why do we need the replace?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

satori replace is deleted, thank you

@@ -22,7 +22,7 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"github.com/satori/go.uuid"
"github.com/gofrs/uuid"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we be using github.com/google/uuid instead? For consistency with kubernetes/kubernetes.

Are there any advantages to either?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sense as we already have github.com/google/uuid in dependency, I've replaced gofrs/uuid with github.com/google/uuid using the latest version

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 27, 2024
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 28, 2024
@@ -1,6 +1,6 @@
module k8s.io/autoscaler/cluster-autoscaler

go 1.21
go 1.21.6
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the required Go version bumped? It doesn't seem like github.com/google/uuid v1.6.0 requires anything higher than go1.21.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@towca thanks, I returned the previous version 1.21

@towca
Copy link
Collaborator

towca commented Feb 28, 2024

/assign @towca

@towca
Copy link
Collaborator

towca commented Mar 4, 2024

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 4, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: oksanabaza, towca

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 4, 2024
@k8s-ci-robot k8s-ci-robot merged commit b41a8a6 into kubernetes:master Mar 4, 2024
6 checks passed
Copy link
Member

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to click "Submit review" :(

Comment on lines 39 to 44
func GetUUIDV4() (uuidHex string) {
uuidV4 := uuid.NewV4()
uuidHex = hex.EncodeToString(uuidV4.Bytes())
uuidV4 := uuid.New()
binaryUUID, _ := uuidV4.MarshalBinary()
uuidHex = hex.EncodeToString(binaryUUID)
return
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole function can be removed in favor of uuid.NewString

@ddl-risong-na
Copy link

@oksanabaza any plans to apply the same change for previous versions, 1.27, 1.28 and 1.29? The CVEs still exist for those versions. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/cluster-autoscaler area/vertical-pod-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants