Skip to content

Commit 87630a6

Browse files
KN4CK3Rlafriks
andauthored
Do not allow Ghost access to limited visible user/org (#21849) (#21875)
Backport of #21849 Co-authored-by: Lauris BH <[email protected]>
1 parent 56716f5 commit 87630a6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

models/organization/org.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,9 @@ func CountOrgs(opts FindOrgOptions) (int64, error) {
448448

449449
// HasOrgOrUserVisible tells if the given user can see the given org or user
450450
func HasOrgOrUserVisible(ctx context.Context, orgOrUser, user *user_model.User) bool {
451-
// Not SignedUser
452-
if user == nil {
451+
// If user is nil, it's an anonymous user/request.
452+
// The Ghost user is handled like an anonymous user.
453+
if user == nil || user.IsGhost() {
453454
return orgOrUser.Visibility == structs.VisibleTypePublic
454455
}
455456

0 commit comments

Comments
 (0)