-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Ensure that restricted users can access repos for which they are members #17460
Ensure that restricted users can access repos for which they are members #17460
Conversation
There is a small bug in the way that repo access is checked in repoAssignment: Accessibility is checked by checking if the user has a marked access to the repository instead of checking if the user has any team granted access. This PR changes this permissions check to use HasAccess() which does the correct test. There is also a fix in the release api ListReleases where it should return draft releases if the user is a member of a team with write access to the releases. The PR also adds a testcase. Signed-off-by: Andrew Thornton <art27@cantab.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to reproduce the issue detailed in #17003, but the unit test and fix make sense.
Looks like the check before was only for AccessMode > 0, which didn't take into account UnitsMode.
To clarify, AccessMode
is set when a user is given access in repo settings, while UnitsMode
is set in team settings and handles permissions for each of the repo sections?
If you just checkout the testcase without the rest of the changes Gitea will fail the test.
yup exactly that.
Yes this appears to be the case. |
…ers (go-gitea#17460) Backport go-gitea#17460 There is a small bug in the way that repo access is checked in repoAssignment: Accessibility is checked by checking if the user has a marked access to the repository instead of checking if the user has any team granted access. This PR changes this permissions check to use HasAccess() which does the correct test. There is also a fix in the release api ListReleases where it should return draft releases if the user is a member of a team with write access to the releases. The PR also adds a testcase. Signed-off-by: Andrew Thornton <art27@cantab.net>
Codecov Report
@@ Coverage Diff @@
## main #17460 +/- ##
=======================================
Coverage ? 45.48%
=======================================
Files ? 791
Lines ? 88697
Branches ? 0
=======================================
Hits ? 40347
Misses ? 41831
Partials ? 6519
Continue to review full report at Codecov.
|
…ers (#17460) (#17464) Backport #17460 There is a small bug in the way that repo access is checked in repoAssignment: Accessibility is checked by checking if the user has a marked access to the repository instead of checking if the user has any team granted access. This PR changes this permissions check to use HasAccess() which does the correct test. There is also a fix in the release api ListReleases where it should return draft releases if the user is a member of a team with write access to the releases. The PR also adds a testcase. Signed-off-by: Andrew Thornton <art27@cantab.net>
Frontport go-gitea#17457 ## [1.15.6](https://github.com/go-gitea/gitea/releases/tag/v1.15.6) - 2021-10-28 * BUGFIXES * Prevent panic in serv.go with Deploy Keys (go-gitea#17434) (go-gitea#17435) * Fix CSV render error (go-gitea#17406) (go-gitea#17431) * Read expected buffer size (go-gitea#17409) (go-gitea#17430) * Ensure that restricted users can access repos for which they are members (go-gitea#17460) (go-gitea#17464) * Make commit-statuses popup show correctly (go-gitea#17447) (go-gitea#17466) * TESTING * Add integration tests for private.NoServCommand and private.ServCommand (go-gitea#17456) (go-gitea#17463)
Frontport #17457 ## [1.15.6](https://github.com/go-gitea/gitea/releases/tag/v1.15.6) - 2021-10-28 * BUGFIXES * Prevent panic in serv.go with Deploy Keys (#17434) (#17435) * Fix CSV render error (#17406) (#17431) * Read expected buffer size (#17409) (#17430) * Ensure that restricted users can access repos for which they are members (#17460) (#17464) * Make commit-statuses popup show correctly (#17447) (#17466) * TESTING * Add integration tests for private.NoServCommand and private.ServCommand (#17456) (#17463)
…ers (go-gitea#17460) There is a small bug in the way that repo access is checked in repoAssignment: Accessibility is checked by checking if the user has a marked access to the repository instead of checking if the user has any team granted access. This PR changes this permissions check to use HasAccess() which does the correct test. There is also a fix in the release api ListReleases where it should return draft releases if the user is a member of a team with write access to the releases. The PR also adds a testcase. Signed-off-by: Andrew Thornton <art27@cantab.net>
Frontport go-gitea#17457 ## [1.15.6](https://github.com/go-gitea/gitea/releases/tag/v1.15.6) - 2021-10-28 * BUGFIXES * Prevent panic in serv.go with Deploy Keys (go-gitea#17434) (go-gitea#17435) * Fix CSV render error (go-gitea#17406) (go-gitea#17431) * Read expected buffer size (go-gitea#17409) (go-gitea#17430) * Ensure that restricted users can access repos for which they are members (go-gitea#17460) (go-gitea#17464) * Make commit-statuses popup show correctly (go-gitea#17447) (go-gitea#17466) * TESTING * Add integration tests for private.NoServCommand and private.ServCommand (go-gitea#17456) (go-gitea#17463)
There is a small bug in the way that repo access is checked in
repoAssignment: Accessibility is checked by checking if the user has a
marked access to the repository instead of checking if the user has any
team granted access.
This PR changes this permissions check to use HasAccess() which does the
correct test. There is also a fix in the release api ListReleases where
it should return draft releases if the user is a member of a team with
write access to the releases.
The PR also adds a testcase.
Fix #17003
Fix #17041
Signed-off-by: Andrew Thornton art27@cantab.net