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

Not permitted to update Repository Description using Personal Access Tokens #1927

Closed
jmb12686 opened this issue Dec 14, 2019 · 8 comments
Closed

Comments

@jmb12686
Copy link

Problem description

Ability to update Docker Hub repository description (README) is not allowed when using personal access tokens. This significantly impacts the usability of 2FA (2 factor authentication) and degrades the security posture when attempting to automate all aspects of a build and deploy pipeline to Docker Hub. To note: Using Docker Hub automated builds is not an option for me or my organization at this time.

Furthermore, this functionality was allowed for personal access tokens between 1-2 months ago, until recently when I attempted to run an automated CI job to update my repository description. What is the rationale to limit usability of 2FA and personal access tokens? What options are available besides turning of 2FA and/or using Docker Hub automated builds?

Current Error:

➜ LOGIN_PAYLOAD="{\"username\": \"jmb12686\", \"password\": \"REDACTED\"}"
➜ TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d ${LOGIN_PAYLOAD} https://hub.docker.com/v2/users/login/ | jq -r .token)
➜ README_FILEPATH=${README_FILEPATH:="./README.md"}
➜ REPO_URL="https://hub.docker.com/v2/repositories/jmb12686/cadvisor/"
➜ curl -v -H "Authorization: JWT ${TOKEN}" -X PATCH --data-urlencode full_description@${README_FILEPATH} ${REPO_URL}
*   Trying 3.92.111.237...
* TCP_NODELAY set
* Connected to hub.docker.com (3.92.111.237) port 443 (#0)
.....truncating curl output......
{"detail": "access to the resource is forbidden with personal access token"}%
➜ 

Security Issues

N/A - Though security is affected due to the requirement now that user credentials (not personal access tokens) are necessary to update Hub repository description thru API. 2FA must be disabled now too.

@manishtomar
Copy link
Contributor

This is intentional. Personal access tokens (for now) are only meant to access hub registry (docker push|pull) primarily for CI use-case. We deliberately do not allow all API access. Otherwise it defeats the purpose of having 2FA if everything can be accessed via token without second factor. Longer term we do plan to add scopes to tokens to allow other APIs.

Also please note that Hub APIs (while easy to decipher from the browser) are not officially supported. We do realize lot of people use it anyways and will work towards officially supporting it by providing documentation.

Furthermore, this functionality was allowed for personal access tokens between 1-2 months ago

This was a mistake. We never intended to roll out with full API access. We've since disabled it.

@jmb12686
Copy link
Author

jmb12686 commented Dec 15, 2019

@manishtomar Thank you for clarifying. However, I strongly feel that CI use-cases for updating Docker Hub repository descriptions should be accounted for in your security / access models. Using personal access tokens to push/pull defeats far more purposes of 2FA than updating repository documentation.

In the end, updating a repository documentation by manually logging in, copy, and paste is a sub-optimal experience. Please consider supporting this within the docker cli or via some other official programmatic method.

@softprops
Copy link

I agree with @jmb12686. This is especially true for those doing continuous integration and deployment.

@manishtomar
Copy link
Contributor

@jmb12686 Thank you for the feedback. We will consider it.

@mwz
Copy link

mwz commented Jan 2, 2020

I'm also in a similar situation and had updates to the description on dockerhub automated in my CI workflow. Not being able to do this automatically any more is rather inconvenient and a bit annoying tbh. I'm strongly in support for having this capability exposed via a cli or an API call. Thanks for your consideration @manishtomar 👍

@SuperSandro2000
Copy link

So right now I need to disable 2FA to update my descriptions automatically?
Sounds like API Token should be able to be used for the API.

solidnerd added a commit to solidnerd/docker-bookstack that referenced this issue May 9, 2020
disable dockerhub description update action due to an uncovered api security issue.

docker/hub-feedback#1927

Signed-off-by: solidnerd <niclas@mietz.io>
solidnerd added a commit to solidnerd/docker-bookstack that referenced this issue May 9, 2020
disable dockerhub description update action due to an uncovered api security issue.

docker/hub-feedback#1927

Signed-off-by: solidnerd <niclas@mietz.io>
solidnerd added a commit to solidnerd/docker-bookstack that referenced this issue May 9, 2020
disable dockerhub description update action due to an uncovered api security issue.

docker/hub-feedback#1927

Signed-off-by: solidnerd <niclas@mietz.io>
@manishtomar
Copy link
Contributor

Created roadmap item related to this: docker/roadmap#115. Please consider upvoting if you are interested in it.

@stronk7
Copy link

stronk7 commented Aug 14, 2021

It's really unfortunate that docker/roadmap#115 , rolled recently, did not address the ability to update descriptions via PAT, when it was created specifically because of this. And now, it's closed too.

stronk7 added a commit to moodlehq/moodle-php-apache that referenced this issue Aug 14, 2021
First attempt to switch the automated building of moodle-php-apache
images from DockerHub to GHA. Main reason being that the former doesn't
support multiarch builds (only multiarch storage).

Link: docker/hub-feedback#1874

Experimentally we'll be, also, sending the images to both DockerHub
and GitHub registries in case we need to switch some day.

This requires:

1. Some secrets to be created or used:
  - DOCKERHUB_USERNAME (to create)
  - DOCKERHUB_TOKEN (to create)
  - DOCKERHUB_PASSWORD (to create, grrr, descriptions cannot be updated
    using PATs, see docker/hub-feedback#1927 (comment))
  - GH_USERNAME (to create)
  - GITHUB_TOKEN (to use)
2. Autobuilds @ DockerHub to be disabled (this takes exactly on them)
stronk7 added a commit to moodlehq/moodle-php-apache that referenced this issue Aug 14, 2021
First attempt to switch the automated building of moodle-php-apache
images from DockerHub to GHA. Main reason being that the former doesn't
support multiarch builds (only multiarch storage).

Link: docker/hub-feedback#1874

Experimentally we'll be, also, sending the images to both DockerHub
and GitHub registries in case we need to switch some day.

This requires:

1. Some secrets to be created or used:
  - DOCKERHUB_USERNAME (to create)
  - DOCKERHUB_TOKEN (to create)
  - DOCKERHUB_PASSWORD (to create, grrr, descriptions cannot be updated
    using PATs, see docker/hub-feedback#1927 (comment))
  - GH_USERNAME (to create)
  - GITHUB_TOKEN (to use)
2. Autobuilds @ DockerHub to be disabled (this takes exactly on them)
stronk7 added a commit to moodlehq/moodle-php-apache that referenced this issue Aug 14, 2021
First attempt to switch the automated building of moodle-php-apache
images from DockerHub to GHA. Main reason being that the former doesn't
support multiarch builds (only multiarch storage).

Link: docker/hub-feedback#1874

Experimentally we'll be, also, sending the images to both DockerHub
and GitHub registries in case we need to switch some day.

This requires:

1. Some secrets to be created or used:
  - DOCKERHUB_USERNAME (to create)
  - DOCKERHUB_TOKEN (to create)
  - DOCKERHUB_PASSWORD (to create, grrr, descriptions cannot be updated
    using PATs, see docker/hub-feedback#1927 (comment))
  - GH_USERNAME (to create)
  - GITHUB_TOKEN (to use)
2. Autobuilds @ DockerHub to be disabled (this takes exactly on them)
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

6 participants