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/16 22:57:53 UTC

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

zrhoffman opened a new issue #6354:
URL: https://github.com/apache/trafficcontrol/issues/6354


   <!--
   ************ STOP!! ************
   If this issue identifies a security vulnerability, DO NOT submit it! Instead, contact
   the Apache Traffic Control Security Team at security@trafficcontrol.apache.org and follow the
   guidelines at https://apache.org/security regarding vulnerability disclosure.
   
   - For *SUPPORT QUESTIONS*, use the #traffic-control channel on the ASF slack (https://s.apache.org/tc-slack-request)
   or the Traffic Control Users mailing list (send an email to users-subscribe@trafficcontrol.apache.org to subscribe).
   - Before submitting, please **SEARCH GITHUB** for a similar issue or PR
       * https://github.com/apache/trafficcontrol/issues
       * https://github.com/apache/trafficcontrol/pulls
   -->
   
   <!-- Do not submit security vulnerabilities or support requests here - see above -->
   ## This Bug Report affects these Traffic Control components:
   <!-- delete all those that don't apply -->
   - Traffic Ops
   
   ## Current behavior:
   <!-- Describe how the bug happens -->
   Running `go get github.com/apache/trafficcontrol/traffic_ops/v4-client` using `go 1.17.3 fails:
   
   ```
   /home/user/go/pkg/mod/github.com/apache/trafficcontrol@v6.0.1+incompatible/lib/go-tc/deliveryservice_ssl_keys.go:283:15: undefined: jwk.EssentialHeader
   ```
   
   ## Expected behavior:
   <!-- Describe what the behavior would be without the bug -->
   Getting the Traffic Ops v4 client should suceed.
   
   ## Steps to reproduce:
   <!-- If the current behavior is a bug, please provide the *STEPS TO REPRODUCE* and
   include the applicable TC version.
   -->
   1. Make sure you are using Go 1.17.3. I was unable to reproduce #6354 using
       ```
       go version devel go1.18-f659183972 Tue Nov 16 19:41:37 2021 +0000 linux/amd64
       ```
   2. Make sure there is no `go.mod` in your directory or any parent directory.
   3.  ```go
       [user@computer directory]$ go get github.com/apache/trafficcontrol/traffic_ops/v4-client
       go: downloading github.com/apache/trafficcontrol v6.0.1+incompatible
       go: downloading github.com/lestrrat/go-jwx v0.0.0-20210302221443-a9d01c1b7121
       go: downloading github.com/go-ozzo/ozzo-validation v3.6.0+incompatible
       go: downloading github.com/jmoiron/sqlx v1.3.4
       go: downloading github.com/lib/pq v1.10.4
       go: downloading github.com/influxdata/influxdb v1.9.5
       go: downloading golang.org/x/net v0.0.0-20211116212703-e8b54dec6f95
       go: downloading github.com/json-iterator/go v1.1.12
       go: downloading github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496
       go: downloading github.com/modern-go/reflect2 v1.0.2
       go: downloading github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
       go: downloading github.com/pkg/errors v0.9.1
       go: downloading github.com/lestrrat/go-pdebug v0.0.0-20180220043741-569c97477ae8
       go: downloading github.com/davecgh/go-spew v1.1.1
       # github.com/apache/trafficcontrol/lib/go-tc
       /home/user/go/pkg/mod/github.com/apache/trafficcontrol@v6.0.1+incompatible/lib/go-tc/deliveryservice_ssl_keys.go:283:15: undefined: jwk.EssentialHeader
       ```


-- 
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



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

Posted by GitBox <gi...@apache.org>.
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) (which would not fix #6354).
   
   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



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

Posted by GitBox <gi...@apache.org>.
rawlinp commented on issue #6354:
URL: https://github.com/apache/trafficcontrol/issues/6354#issuecomment-972026586


   Ok, so this is related to the discussion in https://github.com/apache/trafficcontrol/pull/6305 where we decided to create an orphaned tag where the `go.mod` file is removed in order for packages to be able to import the latest TO API client.
   
   From a TO client perspective, I think all it needs `jwk.EssentialHeader` for is for marshalling/unmarshalling JSON responses. I think we could just copy that struct into lib/go-tc instead of having lib/go-tc depend on `jwk`.


-- 
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



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

Posted by GitBox <gi...@apache.org>.
zrhoffman closed issue #6354:
URL: https://github.com/apache/trafficcontrol/issues/6354


   


-- 
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



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

Posted by GitBox <gi...@apache.org>.
zrhoffman edited a comment on issue #6354:
URL: https://github.com/apache/trafficcontrol/issues/6354#issuecomment-972285193


   > Ok, so this is related to the discussion in https://github.com/apache/trafficcontrol/pull/6305 where we decided to create an orphaned tag where the `go.mod` file is removed in order for packages to be able to import the latest TO API client.
   
   Right, committing `go.mod` in the `v#.#.#` tags that pkg.go.dev uses and adding `v#` to the module path would fix this issue.
   
   > From a TO client perspective, I think all it needs `jwk.EssentialHeader` for is for marshalling/unmarshalling JSON responses. I think we could just copy that struct into lib/go-tc instead of having lib/go-tc depend on `jwk`.
   
   This issue also affects anyone trying to import anything from `lib/go-tc`, so importers of the client would still have this issue after copying that struct into `lib/go-tc`. Steps to reproduce:
   
   ```go
   [user@host directory]$ go mod init my-module
   go: creating new go.mod: module my-module
   [user@host directory]$ <<'GO' cat > my-module.go
   package my_module
   import "github.com/apache/trafficcontrol/lib/go-tc"
   var myVariable Alert
   GO
   [user@host directory]$ go mod tidy
   go: finding module for package github.com/apache/trafficcontrol/lib/go-tc
   go: found github.com/apache/trafficcontrol/lib/go-tc in github.com/apache/trafficcontrol v6.0.1+incompatible
   go: finding module for package github.com/jmoiron/sqlx
   go: finding module for package github.com/go-ozzo/ozzo-validation/is
   go: finding module for package github.com/json-iterator/go
   go: finding module for package github.com/influxdata/influxdb/client/v2
   go: finding module for package github.com/lestrrat/go-jwx/jwk
   go: finding module for package github.com/lib/pq
   go: finding module for package github.com/go-ozzo/ozzo-validation
   go: found github.com/go-ozzo/ozzo-validation in github.com/go-ozzo/ozzo-validation v3.6.0+incompatible
   go: found github.com/go-ozzo/ozzo-validation/is in github.com/go-ozzo/ozzo-validation v3.6.0+incompatible
   go: found github.com/influxdata/influxdb/client/v2 in github.com/influxdata/influxdb v1.9.5
   go: found github.com/json-iterator/go in github.com/json-iterator/go v1.1.12
   go: found github.com/lestrrat/go-jwx/jwk in github.com/lestrrat/go-jwx v0.0.0-20210302221443-a9d01c1b7121
   go: found github.com/lib/pq in github.com/lib/pq v1.10.4
   go: found github.com/jmoiron/sqlx in github.com/jmoiron/sqlx v1.3.4
   go: finding module for package github.com/lestrrat/go-pdebug
   go: found github.com/lestrrat/go-pdebug in github.com/lestrrat/go-pdebug v0.0.0-20180220043741-569c97477ae8
   [user@host directory]$ go build
   # github.com/apache/trafficcontrol/lib/go-tc
   /home/user/go/pkg/mod/github.com/apache/trafficcontrol@v6.0.1+incompatible/lib/go-tc/deliveryservice_ssl_keys.go:283:19: undefined: jwk.EssentialHeader
   [user@host directory]$
   ```


-- 
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



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

Posted by GitBox <gi...@apache.org>.
zrhoffman commented on issue #6354:
URL: https://github.com/apache/trafficcontrol/issues/6354#issuecomment-971907961


   Note `go build` does not fail if you first `go get` the version of `github.com/lestrrat/go-jwx/jwk` that ATC uses:
   
   ```go
   [user@host directory]$ go mod init my-module
   go: creating new go.mod: module my-module
   [user@host directory]$ echo 'package my_module;import "github.com/apache/trafficcontrol/traffic_ops/v4-client"; var myVariable client.Session' > my-package.go
   [user@host directory]$ go get github.com/lestrrat/go-jwx@v0.0.0-20171104074836-2857e17763b6
   go get: added github.com/lestrrat/go-jwx v0.0.0-20171104074836-2857e17763b6
   [user@host directory]$ go mod tidy
   go: finding module for package github.com/apache/trafficcontrol/traffic_ops/v4-client
   go: found github.com/apache/trafficcontrol/traffic_ops/v4-client in github.com/apache/trafficcontrol v6.0.1+incompatible
   go: finding module for package github.com/stretchr/testify/assert
   go: finding module for package github.com/json-iterator/go
   go: finding module for package github.com/lib/pq
   go: finding module for package github.com/influxdata/influxdb/client/v2
   go: finding module for package github.com/go-ozzo/ozzo-validation/is
   go: finding module for package github.com/go-ozzo/ozzo-validation
   go: finding module for package github.com/jmoiron/sqlx
   go: finding module for package golang.org/x/net/publicsuffix
   go: found github.com/go-ozzo/ozzo-validation in github.com/go-ozzo/ozzo-validation v3.6.0+incompatible
   go: found github.com/go-ozzo/ozzo-validation/is in github.com/go-ozzo/ozzo-validation v3.6.0+incompatible
   go: found github.com/influxdata/influxdb/client/v2 in github.com/influxdata/influxdb v1.9.5
   go: found github.com/json-iterator/go in github.com/json-iterator/go v1.1.12
   go: found github.com/lib/pq in github.com/lib/pq v1.10.4
   go: found golang.org/x/net/publicsuffix in golang.org/x/net v0.0.0-20211116231205-47ca1ff31462
   go: found github.com/jmoiron/sqlx in github.com/jmoiron/sqlx v1.3.4
   go: found github.com/stretchr/testify/assert in github.com/stretchr/testify v1.7.0
   [user@host directory]$ go build
   [user@host directory]$
   ```


-- 
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



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

Posted by GitBox <gi...@apache.org>.
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



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

Posted by GitBox <gi...@apache.org>.
zrhoffman commented 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 using  [`jwk.Headers`](https://pkg.go.dev/github.com/lestrrat-go/jwx@v0.9.1-0.20190702045520-e35178ac2b1f/jwk#Headers) instead of  [`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



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

Posted by GitBox <gi...@apache.org>.
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)
   ```
   
   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) (which would not fix #6354).
   
   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



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

Posted by GitBox <gi...@apache.org>.
zrhoffman commented on issue #6354:
URL: https://github.com/apache/trafficcontrol/issues/6354#issuecomment-972285193


   > Ok, so this is related to the discussion in https://github.com/apache/trafficcontrol/pull/6305 where we decided to create an orphaned tag where the `go.mod` file is removed in order for packages to be able to import the latest TO API client.
   
   Right, committing `go.mod` in the `v#.#.#` tags that pkg.go.dev uses and added `v#` to the module path would fix this issue.
   
   > From a TO client perspective, I think all it needs `jwk.EssentialHeader` for is for marshalling/unmarshalling JSON responses. I think we could just copy that struct into lib/go-tc instead of having lib/go-tc depend on `jwk`.
   
   This issue also affects anyone trying to import anything from `lib/go-tc`, so importers of the client would still have this issue after copying that struct into `lib/go-tc`. Steps to reproduce:
   
   ```go
   [user@host directory]$ go mod init my-module
   go: creating new go.mod: module my-module
   [user@host directory]$ <<'GO' cat > my-module.go
   package my_module
   import "github.com/apache/trafficcontrol/lib/go-tc"
   var myVariable Alert
   GO
   [user@host directory]$ go mod tidy
   go: finding module for package github.com/apache/trafficcontrol/lib/go-tc
   go: found github.com/apache/trafficcontrol/lib/go-tc in github.com/apache/trafficcontrol v6.0.1+incompatible
   go: finding module for package github.com/jmoiron/sqlx
   go: finding module for package github.com/go-ozzo/ozzo-validation/is
   go: finding module for package github.com/json-iterator/go
   go: finding module for package github.com/influxdata/influxdb/client/v2
   go: finding module for package github.com/lestrrat/go-jwx/jwk
   go: finding module for package github.com/lib/pq
   go: finding module for package github.com/go-ozzo/ozzo-validation
   go: found github.com/go-ozzo/ozzo-validation in github.com/go-ozzo/ozzo-validation v3.6.0+incompatible
   go: found github.com/go-ozzo/ozzo-validation/is in github.com/go-ozzo/ozzo-validation v3.6.0+incompatible
   go: found github.com/influxdata/influxdb/client/v2 in github.com/influxdata/influxdb v1.9.5
   go: found github.com/json-iterator/go in github.com/json-iterator/go v1.1.12
   go: found github.com/lestrrat/go-jwx/jwk in github.com/lestrrat/go-jwx v0.0.0-20210302221443-a9d01c1b7121
   go: found github.com/lib/pq in github.com/lib/pq v1.10.4
   go: found github.com/jmoiron/sqlx in github.com/jmoiron/sqlx v1.3.4
   go: finding module for package github.com/lestrrat/go-pdebug
   go: found github.com/lestrrat/go-pdebug in github.com/lestrrat/go-pdebug v0.0.0-20180220043741-569c97477ae8
   [user@host directory]$ go build
   # github.com/apache/trafficcontrol/lib/go-tc
   /home/user/go/pkg/mod/github.com/apache/trafficcontrol@v6.0.1+incompatible/lib/go-tc/deliveryservice_ssl_keys.go:283:19: undefined: jwk.EssentialHeader
   [user@host directory]$
   ```


-- 
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