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

Cannot configure a scopes for new personal access token #187

Closed
jaythamke opened this issue Oct 13, 2021 · 4 comments
Closed

Cannot configure a scopes for new personal access token #187

jaythamke opened this issue Oct 13, 2021 · 4 comments

Comments

@jaythamke
Copy link

Description

  1. Cannot configure the token scope (read, write , ... etc) while creating new token using hub-tool.
  2. When the token metadata is fetched using inspect sub-command, it does not return token scope information even the scope is configured through Docker Hub's web UI.

I tried with Docker Hub API - Get /v2/access-tokens and I could get following response -

The token created by hub-tool does not have scopes slice and another token has it.

Host: "https://hub.docker.com"
GET v2/access-tokens/

{
  "count": 2,
  "next": null,
  "previous": null,
  "active_count": 1,
  "results": [
    {
      "uuid": "82d03067-**********",
      "client_id": "HUB",
      "creator_ip": "**********",
      "creator_ua": "hub-tool/",
      "created_at": "2021-10-12T14:37:15.697655Z",
      "last_used": "2021-10-13T13:25:42.769907Z",
      "generated_by": "manual",
      "is_active": true,
      "token": "",
      "token_label": "hubtool"
    },
    {
      "uuid": "9742a045-**********",
      "client_id": "HUB",
      "creator_ip": "**********",
      "creator_ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/**********",
      "created_at": "2020-11-16T15:27:33.658268Z",
      "last_used": "2021-10-06T09:38:19.48988Z",
      "generated_by": "manual",
      "is_active": false,
      "token": "",
      "token_label": "Testing in general",
      "scopes": [
        "repo:admin"
      ]
    }
  ]
}

Steps to reproduce the issue:

  1. Create token using hub-tool - hub-tool token create --description "<useful description>"

  2. On successful token creation verify the token in docker-hub web UI -
    Snag_89b9b0

  3. Create token via web UI and you can configure the token scope, see another token in above image.

Describe the results you received:

Describe the results you expected:

Additional information you deem important (e.g. issue happens only occasionally):

Output of hub-tool --version:

panic: runtime error: slice bounds out of range [:7] with length 0

goroutine 1 [running]:
github.com/docker/hub-tool/internal/commands.NewRootCmd.func2(0xc0003b8580, 0xc00004a640, 0x0, 0x1, 0x0, 0x0)
        github.com/docker/hub-tool/internal/commands/root.go:97 +0x193
github.com/spf13/cobra.(*Command).execute(0xc0003b8580, 0xc0000b8010, 0x1, 0x1, 0xc0003b8580, 0xc0000b8010)
        github.com/spf13/cobra@v1.1.1/command.go:850 +0x472
github.com/spf13/cobra.(*Command).ExecuteC(0xc0003b8580, 0xc00007a000, 0xc0003b0400, 0xcbdbf0)
        github.com/spf13/cobra@v1.1.1/command.go:958 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.1.1/command.go:895
github.com/spf13/cobra.(*Command).ExecuteContext(...)
        github.com/spf13/cobra@v1.1.1/command.go:888
main.main()
        github.com/docker/hub-tool/main.go:72 +0x5aa

hub-tool tag and commit info:

tag: v0.4.3
commit: a01a01bd3b91e6616dfad794a7c10ea855acac9c

Output of docker version:

Client: Docker Engine - Community
 Version:           19.03.6
 API version:       1.40
 Go version:        go1.12.16
 Git commit:        369ce74a3c
 Built:             Thu Feb 13 01:27:49 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.6
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.16
  Git commit:       369ce74a3c
  Built:            Thu Feb 13 01:26:21 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker info:

Client:
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 2
 Server Version: 19.03.6
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339
 runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
 init version: fec3683
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 4.15.0-88-generic
 Operating System: Ubuntu 18.04.4 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 8.355GiB
 Name: ubuntu1804.localdomain
 ID: USKZ:ZN6V:76NY:CDEM:T4JR:P5Z3:7QA4:UYI5:DTHN:AAP4:WQFN:TH2N
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: jayeshthamke189
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional environment details (AWS, VirtualBox, physical, etc.):

  • vmware 16
@jaythamke jaythamke changed the title Cannot configure a scope of personal access token during creation Cannot configure a scopes of personal access token during creation Oct 13, 2021
@jaythamke jaythamke changed the title Cannot configure a scopes of personal access token during creation Cannot configure a scopes for new personal access token Oct 13, 2021
@zdhamasha
Copy link

Any updates

@mat007
Copy link
Member

mat007 commented Oct 17, 2021

I think #185 tries to address this?

@jaythamke
Copy link
Author

I think #185 tries to address this?

Thanks @mat007 for pointing out! Yes, I expected the same feature.

@jaythamke
Copy link
Author

Closing this issue as the feature - #185 is in-progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants