GitLab registry API - UNAUTHORIZED issue

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Hi,

It seems that there is an issue with TOKEN authorization into registry (with scope field)

Command 1: TOKEN=$(curl --silent --user ${USERNAME}:${PASSWORD} -G ${AUTHURL}jwt/auth -d service=container_registry -d scope="repository:*:*" | ./jq -r '.token')
Command 2: curl -H "Authorization: Bearer ${TOKEN}" ${REGISTRY}v2/group/module/tags/list
Command 3: curl -H "Authorization: Bearer ${TOKEN}" -X "DELETE" {$REGISTRY}v2/group/module/blobs/sha256:xxx

When I run command 1 with scope="repository::" These are the errors from command 2 and command 3:

  • {"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"repository","Class":"","Name":"group/module","Action":"pull"}]}]}
  • {"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"repository","Class":"","Name":"group/module","Action":"*"}]}]}

When I run command 1 with scope="repository:group/module:*" These are the errors from command 2 and command 3:

  • {"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"repository","Class":"","Name":"group/module","Action":"pull"}]}]}
  • {"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"repository","Class":"","Name":"group/module","Action":"*"}]}]}

When I run command 1 with scope="repository:group/module:pull" These are the errors from command 2 and command 3:

  • {"name":"group/module","tags":["latest"]}
  • {"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"repository","Class":"","Name":"group/module","Action":"*"}]}]}

Is this a bug in the platfrom or I'm using wrong configuration of CURL?

Edited by 🤖 GitLab Bot 🤖