Skip to content

Container registry cannot be set to private #24174

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

Open
unixbird opened this issue Apr 17, 2023 · 19 comments
Open

Container registry cannot be set to private #24174

unixbird opened this issue Apr 17, 2023 · 19 comments
Labels
issue/not-a-bug The reported issue is the intended behavior or the problem is not inside Gitea topic/packages

Comments

@unixbird
Copy link

Description

Found that there isn't a way to make a container image private meaning anyone can pull the image even if the image is part of a private repo.

Gitea Version

1.19.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

I deploy gitea using kubernetes with kubectl and kubeadm.

Database

None

@KN4CK3R KN4CK3R added issue/not-a-bug The reported issue is the intended behavior or the problem is not inside Gitea topic/packages and removed type/bug labels Apr 17, 2023
@KN4CK3R
Copy link
Member

KN4CK3R commented Apr 17, 2023

Package visibility is the same as owner visibility. If the user or organization is private, the packages are private too. A linked repository does not change the visibility but that may change in future.

@TheDevMinerTV
Copy link

It would be cool to have it like GHCR's "every container has it's own visibility setting".

@facorazza
Copy link

Personally, I'd like to change the visibility of packages from the linked repository

@bbenouarets
Copy link

I would also like it if you could control visibility via the containers or the repository.

@lunny
Copy link
Member

lunny commented Jan 23, 2024

For a private orgniazation/user, all the containers of it will be private. For all the public orgniazation/user, all the containers of it will be public.
So I think the requirement here is private containers on public orgniazation/user. Maybe you can change the title to that.

@lippoliv
Copy link

lippoliv commented Feb 12, 2024

I discovered it today, while migrating from GitLab. I was scared. I think this can be improved, while keeping in mind how Gitea deals with repos:

  • A repo belongs to a owner
  • A repo has a visibility (which differs to the owner)

I think it would be cool if packages (all package types, not just containers) follow the same principle. They can have the owners visbility by default, but users should be able to overwrite it.

(for me my migration now will get hard, probably I temporarily need to put all owners to private visibility)

@lippoliv
Copy link

Another use-case (more serious):

  1. Org is private
  2. Repo is private
  3. Some extern user is member of Repo, but NOT on the ORG
  4. Now there's a new package, but he cannot download (404)

@bmbkr
Copy link

bmbkr commented Feb 14, 2024

Personally, I'd like to change the visibility of packages from the linked repository

This way makes the most sense to me. It differs the least from the current behavior of mirroring visibility of the user's profile.

@syed-2969
Copy link

Hey guys, Can someone please help me to understand how can setup docker container registry in gitea ? I have installed gitea but in packages & registry I didn't find the container registry. Please can someone help me with guiding / pointing to right documentation ?

@frenchcharly
Copy link

frenchcharly commented Jun 4, 2024

Hello there,

I think I'm in the correct issue:

  1. Have Gitea setup.
  2. Have a private Organization
  3. Have 2 private repositories owned by said Organization
  4. Have a docker image pushed and available under the Packages tab for each of those repositories.
  5. Each Package was setup using "Link this package to a repository" in its settings page.
  6. User account is owner of the Organization & Repositories

Gitlab CI/CD can push to GItea, no worries, so can I, manually, when building from multiple machines (linux/macOS).

Now, the rub : in any production / staging / dev environment i have, after a successful login to Gitea via docker login, I always get Error response from daemon: unauthorised: reqPackageAccess when trying to pull the image.

In order for me to be able to pull the image, the only solution i have is to set the Organization to public.

Can provide more details if needed but pretty sure that's not expected behaviour from a "private" registry.

@KN4CK3R
Copy link
Member

KN4CK3R commented Jun 5, 2024

Thank you for the steps. I will have a look later 👍

@KN4CK3R
Copy link
Member

KN4CK3R commented Jul 7, 2024

@frenchcharly I can't reproduce the behaviour.

Have a docker image pushed and available under the Packages tab for each of those repositories.

You uploaded two images and linked image 1 to repo 1 and image 2 to repo 2?

I created a private org and two private repositories in that org. I pushed an image to the org and linked it to repo 1 (linking a package does not change the permissions at the moment, so this should not change anything). Then I created a new team with view rights and added a second user to this team. This user can now pull the image without problems.

If the pull-user is not in the team I get the expected error
Error response from daemon: failed to resolve reference "...": unexpected status from HEAD request to ...: 401 Unauthorized
Adding the user again, the pull works.

@frenchcharly
Copy link

frenchcharly commented Jul 7, 2024

This user can now pull the image without problems.
If the pull-user is not in the team I get the expected error Error response from daemon: failed to resolve reference "...": unexpected status from HEAD request to ...: 401 Unauthorized Adding the user again, the pull works.

Push/pull : encountered no problems whatsoever.
My issue is that the images are accessible via Gitea GUI to any anonymous user.
I had to switch to using Harbor because I couldn't make the images truly private, and that is not optional in my use case.

@KN4CK3R
Copy link
Member

KN4CK3R commented Jul 7, 2024

What's the url which makes the packages visible? If the owner is not public, every url should result in a 404 error.

@frenchcharly
Copy link

What's the url which makes the packages visible? If the owner is not public, every url should result in a 404 error.

As I stated, I had to switch to Harbor because publicly accessible images were a non-starter in my use case. I could try to spin a vm from a backup I have to get you that information, but all I did was explore the Gitea instance in a private browser session and I could access and download the images. Including supposedly private images.

@mcrapts
Copy link

mcrapts commented Aug 26, 2024

@KN4CK3R This is true, but sometimes the owner is public but repositories are not. Images linked to a private repository will still show up in the public user page. I agree with @frenchcharly this is unacceptable and makes the container registry unusable for me.

@edantes-1845
Copy link

Hi, everyone.
I have the same behavior with 1.22.1 version. Any Member of organization (with NO ACCESS to packages) can pull packages from this organization. Is it correct behavior?

image

@lunny
Copy link
Member

lunny commented Sep 10, 2024

Hi, everyone. I have the same behavior with 1.22.1 version. Any Member of organization (with NO ACCESS to packages) can pull packages from this organization. Is it correct behavior?

image

It depends on org is public, limited or private.

@bvandevliet
Copy link
Contributor

This issue seems related: #20596

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/not-a-bug The reported issue is the intended behavior or the problem is not inside Gitea topic/packages
Projects
None yet
Development

No branches or pull requests