Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Switch to form3-tech/jwt-go. #1822

Merged
merged 4 commits into from Feb 24, 2021
Merged

Switch to form3-tech/jwt-go. #1822

merged 4 commits into from Feb 24, 2021

Conversation

dlorenc
Copy link
Contributor

@dlorenc dlorenc commented Dec 21, 2020

What does this PR achieve? Why do we need it?

The old library is abaondoned and has some severe CVEs in it. The form3-tech
fork has fixed those CVEs and is the most popular fork. CVE is here:
https://snyk.io/vuln/SNYK-GOLANG-GITHUBCOMDGRIJALVAJWTGO-596515

Does this PR fix issues?

Fixes #

Notes for the reviewer

I understand this is going toward maintenance mode. Hoping to get this update in to help unblock other libraries that import heketi from updating.

@centos-ci
Copy link
Collaborator

Can one of the admins verify this patch?

@raghavendra-talur
Copy link
Member

@centos-ci ok-to-test

@dlorenc
Copy link
Contributor Author

dlorenc commented Dec 21, 2020

The test was failing with something that looked unrelated. I added a commit that I think addresses this.

@dlorenc
Copy link
Contributor Author

dlorenc commented Dec 21, 2020

The build error looks like some kind of timeout. Is there a way to rerun it?

@phlogistonjohn
Copy link
Contributor

/retest this please

@dlorenc
Copy link
Contributor Author

dlorenc commented Jan 6, 2021

This time it looked like a vagrant issue:

14:30:12 + vagrant plugin install vagrant-libvirt
14:30:25 Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
14:30:41 Building native extensions.  This could take a while...
14:30:43 Vagrant failed to properly resolve required dependencies. These
14:30:43 errors can commonly be caused by misconfigured plugin installations
14:30:43 or transient network issues. The reported error is:
14:30:43 
14:30:43 nokogiri requires Ruby version < 3.1.dev, >= 2.5.

@iamniting
Copy link
Member

Python tests are also getting failed in Github actions. It looks like this got introduced now in the new python version.

2021-01-06T14:08:20.5728022Z >       headers['Authorization'] = b'bearer ' + token
2021-01-06T14:08:20.5728729Z E       TypeError: can't concat str to bytes
>>> 'hello' + 'hello'
'hellohello'
>>> b'hello' + 'hello'
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    b'hello' + 'hello'
TypeError: can't concat str to bytes

@phlogistonjohn
Copy link
Contributor

The changes generally look pretty reasonable. The changes to glide look minimal, which is very important, so thanks for keeping them small.

Once some of the CI issues are sorted out we can do proper reviews.

One small request would be to fold your 2 changesets together as having the test fix in with the import changes is more bisection friendly.

@dlorenc
Copy link
Contributor Author

dlorenc commented Jan 10, 2021

One small request would be to fold your 2 changesets together as having the test fix in with the import changes is more bisection friendly.

All set! I'll keep poking at the CI stuff, not sure if I'll be able to fix it though.

@phlogistonjohn
Copy link
Contributor

Looks like a legitimate build failure due to one of our other dependencies, github.com/auth0/go-jwt-middleware still relying on the previous jwt lib. But looking at that project's readme on github its also been switched to use this fork. Perhaps the glide entry for that lib just needs to be tweaked too, @dlorenc ? Were you able to build with the current glide config locally?

@dlorenc
Copy link
Contributor Author

dlorenc commented Jan 20, 2021

Looks like a legitimate build failure due to one of our other dependencies, github.com/auth0/go-jwt-middleware still relying on the previous jwt lib. But looking at that project's readme on github its also been switched to use this fork. Perhaps the glide entry for that lib just needs to be tweaked too, @dlorenc ? Were you able to build with the current glide config locally?

All set! Looks like things are passing now.

@phlogistonjohn
Copy link
Contributor

Great, thanks! The centos ci seems to be having an issue with glide timing out (possibly a network issue?). I want to take a little more time to see if we can sort that out, but another week passes w/o centos ci passing one of may just need to run some tests manually and then we can get on with preparing to merge

@dlorenc
Copy link
Contributor Author

dlorenc commented Jan 20, 2021

Great, thanks! The centos ci seems to be having an issue with glide timing out (possibly a network issue?). I want to take a little more time to see if we can sort that out, but another week passes w/o centos ci passing one of may just need to run some tests manually and then we can get on with preparing to merge

Is there a way to rerun it? The glide steps take several minutes on my laptop. I think that happened earlier to me too, but a rerun fixed it.

@iamniting
Copy link
Member

/retest this please

@iamniting
Copy link
Member

The above comment will run the CI again. But I tried many times on the other PR it is not helping out.

@phlogistonjohn
Copy link
Contributor

@iamniting I think @dlorenc is suggesting to run the glide command more than once in the test, not to start the CI job again.
It's worth a try I think.

@phlogistonjohn
Copy link
Contributor

phlogistonjohn commented Jan 20, 2021

I have an experiment at #1833 to try a Fonzie-type approach to getting the CI to do anything.

@iamniting
Copy link
Member

Cool this one has also passed, Now centos CI is on track

Copy link
Contributor

@phlogistonjohn phlogistonjohn left a comment

Choose a reason for hiding this comment

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

Tests are now passing and everything seems to check out. Thanks!

@phlogistonjohn
Copy link
Contributor

@raghavendra-talur PTAL, thanks.

@@ -42,7 +42,7 @@ func init() {
}
}

// From https://github.com/dgrijalva/jwt-go/pull/139 it is understood
// From https://github.com/form3tech-oss/jwt-go/pull/139 it is understood
Copy link
Member

Choose a reason for hiding this comment

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

This change does not make sense. The PR is only available in the dgrijalva repo. We can keep the comment as-is or modify the comment to not refer to any PR altogether.

glide.yaml Outdated
@@ -1,10 +1,11 @@
package: github.com/heketi/heketi
import:
- package: github.com/auth0/go-jwt-middleware
version: 36081240882bbf356af6efb152969e4b0bcf4456
Copy link
Member

Choose a reason for hiding this comment

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

This commit is from 2019 and as @phlogistonjohn mentioned, it will bring in dgrijalva/jwt-go as its dependency. I suggest that the version be bumped up to v1.0.0. v1.0.0 uses the fork "github.com/form3tech-oss/jwt-go".

glide.yaml Outdated
@@ -1,10 +1,11 @@
package: github.com/heketi/heketi
import:
- package: github.com/auth0/go-jwt-middleware
version: 36081240882bbf356af6efb152969e4b0bcf4456
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
version: 36081240882bbf356af6efb152969e4b0bcf4456
version: v1.0.0

@phlogistonjohn
Copy link
Contributor

@dlorenc have you seen @raghavendra-talur 's feedback? Do you plan on making changes in reponse?

Dan Lorenc and others added 3 commits February 23, 2021 13:17
The old library is abaondoned and has some severe CVEs in it. The form3-tech
fork has fixed those CVEs and is the most popular fork. CVE is here:
https://snyk.io/vuln/SNYK-GOLANG-GITHUBCOMDGRIJALVAJWTGO-596515

Also switch the key size in the jwt_test to 512, this appears required for go 1.13

Signed-off-by: Dan Lorenc <dlorenc@google.com>
Signed-off-by: Raghavendra Talur <rtalur@redhat.com>
With the migration to form3-tech/jwt-go repo, one of the string replaces
also edited a link in the comment to an issue in the old jwt repo. This
commit reverses the edit.

Signed-off-by: Raghavendra Talur <rtalur@redhat.com>
@phlogistonjohn phlogistonjohn merged commit 69b5267 into heketi:master Feb 24, 2021
@dlorenc dlorenc deleted the jwt branch May 12, 2021 14:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants