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

Public repositories within private org are not visible to members #10144

Closed
2 of 7 tasks
proton-ab opened this issue Feb 5, 2020 · 15 comments · Fixed by #11442 or #11465
Closed
2 of 7 tasks

Public repositories within private org are not visible to members #10144

proton-ab opened this issue Feb 5, 2020 · 15 comments · Fixed by #11442 or #11465
Labels
Milestone

Comments

@proton-ab
Copy link
Contributor

proton-ab commented Feb 5, 2020

  • Gitea version (or commit ref): 1.10.3 / 1.12.0+dev-251-gd4096ab6a
  • Git version: Not relevant
  • Operating system: Not relevant
  • Database:
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist: Not relevant

Description

When repository, within an organization which has visibility set to Private, is set as public and user is part of a team that has no access specified to this repository, repository can be accessed via direct URI but can not be viewed on any list within UI.

I would expect that setting repository as public within Private organization would allow members of all teams to view it, regardless of team's permissions and team's repositories (for example I might want to make repository visible but read-only to all members of organization, while certain teams can write to different repositories).

This does not apply when organization is set as Limited. In such a case, repository is properly visible (to both members of organization as well as outside users).

Owners of org can of course see all repositories just fine.

Screenshots

chrome_2020-02-05_01-32-09
chrome_2020-02-05_01-32-25
chrome_2020-02-05_01-32-38
chrome_2020-02-05_01-32-46
chrome_2020-02-05_01-32-52
firefox_2020-02-05_01-31-20
firefox_2020-02-05_01-31-33
firefox_2020-02-05_01-31-57

@proton-ab proton-ab changed the title Public repositories within private org are not visible Public repositories within private org are not visible to members Feb 5, 2020
@lunny lunny added the type/bug label Feb 5, 2020
@stale
Copy link

stale bot commented Apr 5, 2020

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale stale bot added the issue/stale label Apr 5, 2020
@6543
Copy link
Member

6543 commented Apr 5, 2020

@proton-ab does this still be the case on 1.11.4 or master?

@stale stale bot removed the issue/stale label Apr 5, 2020
@proton-ab
Copy link
Contributor Author

@6543 yes, as a member of team that has access to certain private repositories within organization I still can not see the public repositories in that organization. I can access them directly but otherwise they are hidden.

@proton-ab
Copy link
Contributor Author

The issue seems to be present in SearchRepositoryCondition, specifically in condition that handles if opts.OwnerID > 0. Repository will be visible here only if:

  1. We are collaborators - but we are not in this case (either directly or by being in a team that has explicit access to such repository)
  2. It's public and AllPublic is true - but the organization is not public
  3. It's limited and AllLimited is true - but the organization is not limited

As you can see, all 3 cases are false, hence the repository is never shown.

@zeripath
Copy link
Contributor

Can you reproduce on try? I can't seem to reproduce this.

@proton-ab
Copy link
Contributor Author

The screenshots included are from try, I can't really link you because org has to be private.

@proton-ab
Copy link
Contributor Author

The reproduction steps however are as follow:

  • Create user A
  • Create user B
  • As user A create organization C
  • Mark organization C as private
  • In organization C create private repository D
  • In organization C create public repository E
  • In organization C create team F with write access
  • In team F in organization C, add repository D to access list
  • In organization C, add user B to team C
  • Confirm both repositories D and E are visible
  • Login as user B, confirm repository D is visible but E is not
  • Manually navigate to URL where repository E should be, confirm it opens

@zeripath
Copy link
Contributor

It's weird because I literally just did those steps on master and on try and did not have this problem...

The two users are arandomer@mailinator.com and tester@mailinator.com their passwords are their email addresses as they predate the (imho unnecessary) password rules. The private org is arprivateOrg.

Arandomer is the owner, tester_mailinator is the user.

@proton-ab
Copy link
Contributor Author

proton-ab commented Apr 20, 2020

You have added the ArPublic repository as accessible to a team 'writers' which tester@mailinator.com is part of, hence they can write to it. The bug describes situation where user is member of a team that does not have explicit access to public repository via team. I have now corrected the mistake, please check now.

zeripath added a commit to zeripath/gitea that referenced this issue May 16, 2020
Fix go-gitea#10144

Signed-off-by: Andrew Thornton <art27@cantab.net>
@lafriks lafriks added this to the 1.12.0 milestone May 17, 2020
lunny pushed a commit that referenced this issue May 17, 2020
* Allow all members of private orgs to see public repos

Fix #10144

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Update models/repo_list.go

Co-authored-by: Lauris BH <lauris@nix.lv>
zeripath added a commit to zeripath/gitea that referenced this issue May 17, 2020
Backport (go-gitea#11442)

Allow all members of private orgs to see public repos

Fix go-gitea#10144

Signed-off-by: Andrew Thornton <art27@cantab.net>
@lafriks lafriks modified the milestones: 1.12.0, 1.11.6 May 17, 2020
@CirnoT
Copy link
Contributor

CirnoT commented May 17, 2020

Maybe we should reopen it, the mentioned PR does not fix issue entirely; explore page is still missing public repo but shows private one.

chrome_2020-05-17_17-08-52

Also unsure if dashboard should show such repo or not; currently it does not since user is not contributor, but maybe being member of organization should trump that requirement for public repos?

@zeripath
Copy link
Contributor

yeah I don't think that I have solved this!

@zeripath zeripath reopened this May 17, 2020
zeripath added a commit to zeripath/gitea that referenced this issue May 17, 2020
Fix go-gitea#10144 (Again)

Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath added a commit that referenced this issue May 17, 2020
* Allow all members of private orgs to see public repos (#11442)

Backport (#11442)

Allow all members of private orgs to see public repos

Fix #10144

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Update models/repo_list.go

* Oops missed the repos we own!

Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath added a commit that referenced this issue May 17, 2020
…ix admin organizations list (#11465)

* Ensure that we can see public repositories in private organization

Fix #10144 (Again)

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Fix Admin users and organizations page

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Update models/repo_list.go

Co-authored-by: Lauris BH <lauris@nix.lv>
6543 pushed a commit to 6543-forks/gitea that referenced this issue May 17, 2020
…ix admin organizations list (go-gitea#11465)

* Ensure that we can see public repositories in private organization

Fix go-gitea#10144 (Again)

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Fix Admin users and organizations page

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Update models/repo_list.go

Co-authored-by: Lauris BH <lauris@nix.lv>
zeripath added a commit that referenced this issue May 18, 2020
…ix admin organizations list (#11465) (#11474)

* Ensure that we can see public repositories in private organization

Fix #10144 (Again)

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Fix Admin users and organizations page

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Update models/repo_list.go

Co-authored-by: Lauris BH <lauris@nix.lv>

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
@mschoettle
Copy link
Contributor

If an organization is private and public repositories are shown this also shows the (existence of the) organization, no? So what would the benefit be to have a private organization?

The reason I am asking this is: I created a private organization ("visible only to organization members") and somehow expected all repos to be invisible/private, however, I was able to clone it as an anonymous user.

@zeripath
Copy link
Contributor

@mschoettle that sounds like another bug - could you open another issue please

@CirnoT
Copy link
Contributor

CirnoT commented May 26, 2020

@mschoettle Public repositories within private organization are visible to all members of said organization. I can not reproduce your report (ability to clone public repositories of private organization by either anonymous user or user without access to organization)

@mschoettle
Copy link
Contributor

@CirnoT I just tried it on https://try.gitea.io and could reproduce it.

I opened another issue: #11651

ydelafollye pushed a commit to ydelafollye/gitea that referenced this issue Jul 31, 2020
* Allow all members of private orgs to see public repos

Fix go-gitea#10144

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Update models/repo_list.go

Co-authored-by: Lauris BH <lauris@nix.lv>
ydelafollye pushed a commit to ydelafollye/gitea that referenced this issue Jul 31, 2020
…ix admin organizations list (go-gitea#11465)

* Ensure that we can see public repositories in private organization

Fix go-gitea#10144 (Again)

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Fix Admin users and organizations page

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Update models/repo_list.go

Co-authored-by: Lauris BH <lauris@nix.lv>
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.