You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2021/11/18 00:09:33 UTC

[GitHub] [trafficcontrol] zrhoffman edited a comment on issue #6354: Importing TO Client: lib/go-tc/deliveryservice_ssl_keys.go:283:15: undefined: jwk.EssentialHeader

zrhoffman edited a comment on issue #6354:
URL: https://github.com/apache/trafficcontrol/issues/6354#issuecomment-972329373


   Other potential solutions:
   - Moving `tc.URISignerKeyset` and structs and functions that use `tc.URISignerKeyset` to another package
   - Updating to latest [`github.com/lestrrat/go-jwx`](https://pkg.go.dev/github.com/lestrrat/go-jwx) (archived)
   - Switching to [`github.com/lestrrat-go/jwx`](https://pkg.go.dev/github.com/lestrrat-go/jwx) (package recommended by the archived version)
   
   Using [`lestrrat-go/jwx`](https://pkg.go.dev/github.com/lestrrat-go/jwx) would involve replacing [`jwk.EssentialHeader`](https://pkg.go.dev/github.com/lestrrat/go-jwx@v0.0.0-20171104074836-2857e17763b6/jwk#EssentialHeader) with [`jwk.Key`](https://pkg.go.dev/github.com/lestrrat-go/jwx@v1.2.11/jwk#Key), then fixing the errors in our project that doing that creates:
   
   ```go
   # github.com/apache/trafficcontrol/traffic_ops/app/db/traffic_vault_migrate
   vet: traffic_ops/app/db/traffic_vault_migrate/traffic_vault_migrate_test.go:56:17: EssentialHeader not declared by package jwk
   # github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/urisigning
   traffic_ops/traffic_ops_golang/urisigning/urisigning.go:229:7: invalid operation: cannot compare skey.Algorithm == "" (mismatched types func() string and untyped string)
   traffic_ops/traffic_ops_golang/urisigning/urisigning.go:232:7: invalid operation: cannot compare skey.KeyID == "" (mismatched types func() string and untyped string)
   traffic_ops/traffic_ops_golang/urisigning/urisigning.go:235:57: cannot use skey.KeyID (value of type func() string) as type string in argument to strings.Compare
   # github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/login
   traffic_ops/traffic_ops_golang/login/login.go:327:21: undefined: jwk.FetchHTTP
   # github.com/apache/trafficcontrol/traffic_ops/testing/api/v4
   vet: traffic_ops/testing/api/v4/deliveryservices_test.go:2440:5: cannot compare kabletownSecondKeys.Keys[0].KeyID == kabletownFirstKeys.Keys[0].KeyID (operator == not defined for func() string)
   # github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/login
   vet: traffic_ops/traffic_ops_golang/login/login.go:327:21: FetchHTTP not declared by package jwk
   # github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/urisigning
   vet: traffic_ops/traffic_ops_golang/urisigning/urisigning.go:229:7: cannot compare skey.Algorithm == "" (mismatched types func() string and untyped string)
   ```
   
   That said, I don't know how long updating the package without committing `go.mod` would fix the issue, since [`lestrrat/go-jwx`](https://pkg.go.dev/github.com/lestrrat/go-jwx)/[`lestrrat-go/jwx`](https://pkg.go.dev/github.com/lestrrat-go/jwx) seems to keep making breaking changes. For example, if we kept our version of [`lestrrat-go/jwx`](https://pkg.go.dev/github.com/lestrrat-go/jwx) at `v0.9.1-0.20190702045520-e35178ac2b1f`, (currently used by `github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/login`), updating use of the [`jwk.EssentialHeader`](https://pkg.go.dev/github.com/lestrrat/go-jwx@v0.0.0-20171104074836-2857e17763b6/jwk#EssentialHeader) struct would mean replacing it with  [`jwk.Headers`](https://pkg.go.dev/github.com/lestrrat-go/jwx@v0.9.1-0.20190702045520-e35178ac2b1f/jwk#Headers) instead of replacing it with [`jwk.Key`](https://pkg.go.dev/github.com/lestrrat-go/jwx@v1.2.11/jwk#Key).
   
   If we simply updated our [`lestrrat/go-jwx`](https://pkg.go.dev/github.com/lestrrat/go-jwx) to the latest version, though, it wouldn't change again, since that repo is archived. That would mean using [`jwk.Headers`](https://pkg.go.dev/github.com/lestrrat/go-jwx@v0.0.0-20210302221443-a9d01c1b7121/jwk#Headers), as mentioned above.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org