Skip to content

[WPB-23995] app visibility accross teams#5171

Open
fisx wants to merge 4 commits intodevelopfrom
WPB-23995-app-visibility-accross-teams
Open

[WPB-23995] app visibility accross teams#5171
fisx wants to merge 4 commits intodevelopfrom
WPB-23995-app-visibility-accross-teams

Conversation

@fisx
Copy link
Copy Markdown
Contributor

@fisx fisx commented Apr 8, 2026

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Apr 8, 2026
@fisx fisx force-pushed the WPB-23995-app-visibility-accross-teams branch from 9e075d2 to 1e5d2a1 Compare April 8, 2026 11:29
@fisx fisx force-pushed the WPB-23995-app-visibility-accross-teams branch from 1e5d2a1 to f8f3705 Compare April 9, 2026 07:24
@fisx fisx marked this pull request as ready for review April 9, 2026 07:29
@fisx fisx requested review from a team as code owners April 9, 2026 07:29
@fisx fisx requested a review from Copilot April 9, 2026 19:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR prevents app users from creating/being part of user connections across teams by adding an explicit “no apps in connection creation” guard, and it adds an integration test covering cross-team (and optionally cross-domain) scenarios.

Changes:

  • Add ensureNoApps guard and apply it to local + remote connection creation paths.
  • Move ensureNotSameTeam into Brig.API.Connection.Util and reuse it from Brig.API.Connection.
  • Add an integration test covering cross-team conversations involving apps; add a changelog entry.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
services/brig/src/Brig/API/Connection/Util.hs Introduces ensureNoApps (and exports ensureNotSameTeam) to enforce connection preconditions.
services/brig/src/Brig/API/Connection/Remote.hs Applies ensureNoApps to remote connection creation and updates effect constraints/imports.
services/brig/src/Brig/API/Connection.hs Removes inline ensureNotSameTeam and applies ensureNoApps to local connection creation.
integration/test/Test/Apps.hs Adds a cross-team app conversation integration test.
changelog.d/3-bug-fixes/WPB-23995-app-visibility-accross-teams Documents the behavior change in the changelog entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 313 to 317
createConnectionToRemoteUser self zcon other = do
ensureNotSameAndActivated self (tUntagged other)
ensureFederatesWith other
ensureNoApps self [tUntagged self, tUntagged other]
mconnection <- lift . wrapClient $ Data.lookupConnection self (tUntagged other)
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

createConnectionToRemoteUser already performs a federated get-users-by-ids in ensureFederatesWith. Calling ensureNoApps here triggers an additional getUserProfiles federation round-trip for the same remote user, increasing latency and adding another failure point on the hot path.

Consider reusing the profile(s) fetched in ensureFederatesWith (it already returns UserProfile with profileType) or restructuring so remote user type + team are checked from a single remote lookup.

Copilot uses AI. Check for mistakes.
resp.json %. "user"

-- M1 tries to connect to app A2 from team B => should fail
-- Apps cannot create connections accross teams
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

Spelling: "accross" should be "across" in this comment.

Suggested change
-- Apps cannot create connections accross teams
-- Apps cannot create connections across teams

Copilot uses AI. Check for mistakes.
import qualified API.BrigInternal as BrigI
import API.Common
import API.Galley
import Control.Lens hiding ((.=))
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

Control.Lens appears to be unused in this module (no lens operators/functions referenced). With -Wall enabled for integration tests, this will produce an unused-import warning; please remove the import if it isn't needed.

Suggested change
import Control.Lens hiding ((.=))

Copilot uses AI. Check for mistakes.
@@ -0,0 +1 @@
Fix: apps cannot form connections accross teams. Integration test for cross-team conversations working with apps as expected. No newline at end of file
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

Spelling: "accross" should be "across". Also consider renaming the changelog file to avoid propagating the typo in tooling/output (depending on how changelog entries are aggregated).

Suggested change
Fix: apps cannot form connections accross teams. Integration test for cross-team conversations working with apps as expected.
Fix: apps cannot form connections across teams. Integration test for cross-team conversations working with apps as expected.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@blackheaven blackheaven left a comment

Choose a reason for hiding this comment

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

copilot lints seem legit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants