Skip to content

Commit 5b9a2ea

Browse files
committed
refactor(carts): fail-closed visibility gate (anything not 'public' is owner-only)
1 parent e19acc2 commit 5b9a2ea

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

internal/carts/service.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ func (s *Service) GetPublicCart(ctx context.Context, slug string, viewerUserID i
112112
}
113113
// Private carts are visible only to their owner; everyone else gets a
114114
// not-found (same as a nonexistent cart — no "this is private" leak).
115-
if cart.Visibility == "private" && viewerUserID != cart.UserID {
115+
// Fail closed: anything not explicitly "public" is treated as owner-only.
116+
if cart.Visibility != "public" && viewerUserID != cart.UserID {
116117
return sqlcgen.Cart{}, nil, sqlcgen.User{}, ErrNotFound
117118
}
118119
items, err := s.q.ListCartItems(ctx, cart.ID)

0 commit comments

Comments
 (0)