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

Only show users that the doer has access to #20169

Closed
wants to merge 5 commits into from

Conversation

Gusted
Copy link
Contributor

@Gusted Gusted commented Jun 28, 2022

  • Don't show users to the doer hasn't access to(user's visibility set to private or limited).
  • This PR fixes this problem for User's followers and User's followings and uses a unified option struct(given only one condition changes, it's not worth the duplicated code).

Gusted added 3 commits June 27, 2022 15:14
- Don't show users to the doer hasn't access to(user's visibility set to
private or limited).
- This PR fixes this problem for User's followers and User's followings
and uses a unified option struct(given only one condition changes, it's not
worth the duplicated code).
@Gusted Gusted added this to the 1.18.0 milestone Jun 28, 2022
@Gusted Gusted added topic/security Something leaks user information or is otherwise vulnerable. Should be fixed! backport/v1.16 labels Jun 28, 2022
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 28, 2022
models/user/user.go Outdated Show resolved Hide resolved
models/user/user.go Outdated Show resolved Hide resolved
routers/api/v1/user/follower.go Outdated Show resolved Hide resolved
Join("LEFT", "follow", "`user`.id=follow.follow_id")
func GetUserFollowing(ctx context.Context, opts GetUserFollowOptions) ([]*User, int64, error) {
sess := db.GetEngine(ctx).
Join("LEFT", "follow", "`user`.id=follow.follow_id").
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these be INNER JOINs instead of LEFT JOINs? In this case it does not change the result because of the WHERE clause.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just copying the previous code. I really don't want to make any more changes that doesn't cover the scope of the PR. It just leads to regressions and problems and arguments that I don't feel like fighting. But yeah it seems you're right we should only target followers that correspond to a existent user in the database, do you want to make a separate pull request for it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will create a PR.

@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 Jul 1, 2022
@Gusted
Copy link
Contributor Author

Gusted commented Jul 3, 2022

Superseded by #20220

@Gusted Gusted closed this Jul 3, 2022
@Gusted Gusted deleted the add-perm-checks-profile branch July 3, 2022 23:59
@6543 6543 removed topic/security Something leaks user information or is otherwise vulnerable. Should be fixed! backport/v1.16 labels Jul 12, 2022
@lunny lunny removed this from the 1.18.0 milestone Dec 20, 2022
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 1 This PR needs approval from one additional maintainer to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants