Skip to content

Browser extension shows chatflows from wrong workspaces and ignores visibility settings #1054

@diecoscai

Description

@diecoscai

Bug Description

Three related bugs in getBrowserExtensionChatflows caused the browser extension to display incorrect chatflows and ignore the "Browser Extension" visibility checkbox entirely.

User-Facing Symptoms

  • Users saw chatflows in the browser extension that did not appear on their main chatflows page (e.g. chatflows from old or unrelated workspaces like "dailylog generator")
  • Toggling the "Browser Extension" checkbox in Visibility Settings had no effect on which chatflows appeared in the extension
  • Extension displayed every chatflow the user could access, regardless of visibility configuration

Root Cause

Three bugs in packages/server/src/services/browser-extension/index.ts (getBrowserExtensionChatflows):

1. Workspace / Organization Leak

The query filtered only by userId, not workspaceId or organizationId. A user who ever belonged to multiple workspaces would see chatflows from all of them in the extension, not just their current workspace.

// Before: only userId filter — leaks across workspaces
.where('chatflow.userId = :userId', { userId })

2. Missing Visibility Filter

The endpoint's own Swagger documentation states it should return only chatflows that include "Browser Extension" in their visibility array. The query contained no such filter, so all chatflows were returned regardless of the visibility checkbox state.

// Before: no visibility filter — checkbox had no effect
// Expected: .andWhere("chatflow.visibility LIKE :ext", { ext: '%Browser Extension%' })

3. Missing Enum Value

ChatflowVisibility enum in packages/server/src/database/entities/ChatFlow.ts was missing the BROWSER_EXTENSION variant, forcing as any type casts throughout updateBrowserExtensionVisibility and making the enum incomplete.

// Before: enum had no BROWSER_EXTENSION member
export enum ChatflowVisibility {
  PRIVATE = 'Private',
  ORGANIZATION = 'Organization',
  // BROWSER_EXTENSION missing
}

Fix

All three issues were resolved in PR #1053:

  • Added BROWSER_EXTENSION = 'Browser Extension' to the ChatflowVisibility enum
  • Added .andWhere('chatflow.workspaceId = :workspaceId', { workspaceId }) to scope results to the active workspace
  • Added .andWhere('chatflow.visibility LIKE :ext', { ext: '%Browser Extension%' }) to enforce the visibility filter
  • Replaced all as any casts with ChatflowVisibility.BROWSER_EXTENSION

Affected Files

  • packages/server/src/services/browser-extension/index.ts — query missing workspace + visibility filters
  • packages/server/src/database/entities/ChatFlow.tsChatflowVisibility enum missing BROWSER_EXTENSION

Steps to Reproduce (Before Fix)

  1. Have a user account that has been a member of more than one workspace
  2. Open the browser extension — chatflows from all past workspaces appear
  3. Go to a chatflow's Visibility Settings, uncheck "Browser Extension", save
  4. Re-open the extension — the chatflow still appears (visibility filter ignored)

Expected Behavior

  • Extension only shows chatflows belonging to the user's current workspace
  • Only chatflows with "Browser Extension" checked in Visibility Settings appear in the extension

Related

Closes via PR #1053 (fix already merged to staging)
See also #326 (separate but related browser extension visibility issue — org-wide vs user-specific settings)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions