Skip to content

Fix bug preventing transfer to private organization #12497

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

Merged

Conversation

zeripath
Copy link
Contributor

The code assessing whether a private organization was visible to a user before allowing transfer was incorrect due to testing membership the wrong way round.

This PR fixes this issue and renames the function performing the test to be clearer.

Further looking at the API for transfer repository - no testing was performed to ensure that the acting user could actually see the new owning organization.

Signed-off-by: Andrew Thornton [email protected]

The code assessing whether a private organization was visible to a user before
allowing transfer was incorrect due to testing membership the wrong way round

This PR fixes this issue and renames the function performing the test to be
clearer.

Further looking at the API for transfer repository - no testing was
performed to ensure that the acting user could actually see the new
owning organization.

Signed-off-by: Andrew Thornton <[email protected]>
@codecov-commenter
Copy link

Codecov Report

Merging #12497 into master will decrease coverage by 0.00%.
The diff coverage is 41.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #12497      +/-   ##
==========================================
- Coverage   43.73%   43.73%   -0.01%     
==========================================
  Files         631      631              
  Lines       69873    69877       +4     
==========================================
+ Hits        30561    30562       +1     
- Misses      34352    34355       +3     
  Partials     4960     4960              
Impacted Files Coverage Δ
models/migrations/v111.go 0.00% <0.00%> (ø)
routers/repo/setting.go 15.03% <0.00%> (ø)
routers/api/v1/repo/transfer.go 50.00% <20.00%> (-3.13%) ⬇️
models/org.go 73.61% <100.00%> (ø)
models/user.go 53.75% <100.00%> (ø)
modules/process/manager.go 72.50% <0.00%> (-2.50%) ⬇️
modules/log/event.go 57.54% <0.00%> (-0.95%) ⬇️
services/pull/pull.go 41.57% <0.00%> (ø)
modules/indexer/stats/db.go 52.17% <0.00%> (+8.69%) ⬆️
modules/indexer/stats/queue.go 64.70% <0.00%> (+11.76%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f50364a...ad62c32. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 16, 2020
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 16, 2020
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 16, 2020
@techknowlogick techknowlogick merged commit d1e67d7 into go-gitea:master Aug 16, 2020
techknowlogick pushed a commit to techknowlogick/gitea that referenced this pull request Aug 16, 2020
* Fix bug preventing transfer to private organization

The code assessing whether a private organization was visible to a user before
allowing transfer was incorrect due to testing membership the wrong way round

This PR fixes this issue and renames the function performing the test to be
clearer.

Further looking at the API for transfer repository - no testing was
performed to ensure that the acting user could actually see the new
owning organization.

Signed-off-by: Andrew Thornton <[email protected]>

* change IsUserPartOfOrg everywhere
@techknowlogick techknowlogick added the backport/done All backports for this PR have been created label Aug 16, 2020
lafriks pushed a commit that referenced this pull request Aug 17, 2020
* Fix bug preventing transfer to private organization

The code assessing whether a private organization was visible to a user before
allowing transfer was incorrect due to testing membership the wrong way round

This PR fixes this issue and renames the function performing the test to be
clearer.

Further looking at the API for transfer repository - no testing was
performed to ensure that the acting user could actually see the new
owning organization.

Signed-off-by: Andrew Thornton <[email protected]>

* change IsUserPartOfOrg everywhere

Co-authored-by: zeripath <[email protected]>
@zeripath zeripath deleted the fix-membership-test-in-transfer-to-org branch August 17, 2020 16:07
@zeripath zeripath added the topic/security Something leaks user information or is otherwise vulnerable. Should be fixed! label Aug 17, 2020
@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.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/security Something leaks user information or is otherwise vulnerable. Should be fixed! type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants