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

Token generated with higher access rights than requested #20232

Closed
mlacko64 opened this issue Apr 5, 2024 · 4 comments
Closed

Token generated with higher access rights than requested #20232

mlacko64 opened this issue Apr 5, 2024 · 4 comments
Assignees

Comments

@mlacko64
Copy link

mlacko64 commented Apr 5, 2024

If you are reporting a problem, please make sure the following information are provided:

Expected behavior and actual behavior:
Token generation seems to be ignoring access righs limitation in request. In example below I requested just pull permissions, but as request was made with admin user, I received also push and delete rights.

I expect to receive just permissions I requested.

Steps to reproduce the problem:
Please provide the steps to reproduce this problem.

Token request:

curl -k -X GET -H "Authorization: Basic mybasicstringhere" 'https://10.242.0.37:5443/service/token?service=harbor-registry&scope=repository:ocp-mirror/oc-mirror-metadata:pull'
{"token":"myloooooongtokenhere","access_token":"","expires_in":1800,"issued_at":"2024-04-05T07:41:16Z"}

When I decoded token with jwt-decode.payload , it shows delete, pull and push permissions.

  "access": [
    {
      "type": "repository",
      "name": "ocp-mirror/oc-mirror-metadata",
      "actions": [
        "delete",
        "pull",
        "push"
      ]
    }
  ]

Versions:
Please specify the versions of following systems.

  • harbor version: v2.10.1
  • docker engine version: 24.0.5
  • docker-compose version: 1.29.2

Additional context:

  • Harbor config files: You can get them by packaging harbor.yml and files in the same directory, including subdirectory.
  • Log files: You can get them by package the /var/log/harbor/ .
@MinerYang
Copy link
Contributor

MinerYang commented Apr 8, 2024

Did you request the token with admin privilege ?

@wy65701436 wy65701436 self-assigned this Apr 8, 2024
@mlacko64
Copy link
Author

mlacko64 commented Apr 8, 2024

I used default admin account created during Harbor installation
I requested just pull permission to one project scope=repository:ocp-mirror/oc-mirror-metadata:pull

@MinerYang
Copy link
Contributor

MinerYang commented Apr 8, 2024

Admin would have full access of projects/repository regardless of permissions you requested.

@mlacko64
Copy link
Author

mlacko64 commented Apr 8, 2024

so it a feature, thanks for explanation

@mlacko64 mlacko64 closed this as completed Apr 8, 2024
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