Skip to content

Commit 88d5275

Browse files
KN4CK3Rlafriks
andauthored
Do not allow Ghost access to limited visible user/org (#21849)
The Ghost user should not be allowed to have access to a limited visible user/org. Co-authored-by: Lauris BH <[email protected]>
1 parent 43ab932 commit 88d5275

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

models/organization/org.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,9 @@ func CountOrgs(opts FindOrgOptions) (int64, error) {
458458

459459
// HasOrgOrUserVisible tells if the given user can see the given org or user
460460
func HasOrgOrUserVisible(ctx context.Context, orgOrUser, user *user_model.User) bool {
461-
// Not SignedUser
462-
if user == nil {
461+
// If user is nil, it's an anonymous user/request.
462+
// The Ghost user is handled like an anonymous user.
463+
if user == nil || user.IsGhost() {
463464
return orgOrUser.Visibility == structs.VisibleTypePublic
464465
}
465466

0 commit comments

Comments
 (0)