Repository navigation
Select organizations through shared browser, API and CLI access - #56
Merged
tnkuehne merged 8 commits intoOct 20, 2026
Merged
Conversation
This was referenced Oct 19, 2026
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | 45d9e12 | Oct 20 2026, 02:11 PM |
tnkuehne
marked this pull request as ready for review
October 19, 2026 22:44
tnkuehne
force-pushed
the
feat/organization-selection
branch
from
October 20, 2026 14:10
84ba495 to
45d9e12
Compare
tnkuehne
added a commit
that referenced
this pull request
Oct 20, 2026
Connector catalog and deployment-agent discovery previously read installation-wide records even when app access was scoped. Both shared services now filter by the authenticated application fleet, including agent creation and disable targets. UI remote functions and HTTP handlers pass the same principal to connector discovery. The central company directory uses installation credentials, so group searches from other organizations now fail before requesting a directory token or contacting the provider. Settings, connector management, runtime releases and reporting remain restricted to installation administrators. Stacked on #56. This closes discovery leaks without introducing organization-specific directory configuration or changing connector administration permissions. Validation: strict workspace type checks, formatting and type-aware lint; 434 regular Vitest tests, including two-fleet discovery and denied administrative API requests. The directory test verifies that cross-organization searches make zero upstream requests. Node and Cloudflare builds and the existing browser flows are also checked. Release-dependent documentation: #58 (publication blocked until the corresponding platform and CLI releases are published). <!-- greptile_comment --> <!-- greptile_summary --> <h2><a href="https://app.greptile.com/api/retrigger?id=83988862"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a><a href="https://app.greptile.com/mendra/github/widefleet/widefleet/-/pull/57"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img alt="View in Greptile" src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2" align="right"></picture></a>Confidence Score: 5/5</h2> <!-- greptile-impact-verdict --> The PR appears safe to merge; no actionable defects were found. <details open><summary><h3>Summary</h3></summary> Connector discovery and agent operations now use the authenticated user’s selected fleet. - Connector catalogs show options from the selected fleet. - Agent lists and targets stay inside the selected fleet. - Company group searches only run for the installation organization. No actionable issues were found. Tests and builds were not run during this review. </details> <details open><summary><h3>Diagram</h3></summary> ```mermaid %%{init: {'theme': 'neutral'}}%% flowchart TD A[Authenticated request] --> B[Selected organization and fleet] B --> C[Connector catalog] B --> D[Agent operations] C --> E[Connectors in selected fleet] D --> F[Agents in selected fleet] B --> G{Installation organization?} G -->|No| H[Reject directory search] G -->|Yes, with permission| I[Search company directory] ``` </details> <!-- greptile_confidence_score:5 --> <sub>Reviews (7) · Last reviewed commit: ["Apply test readability rules"](c8ae4fd) · [Reviewed by Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub> <!-- /greptile_comment -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Authenticated users can discover available organizations before choosing an application context. Without an explicit or saved selection, the only available organization is selected automatically. Browser sessions can choose at
/organizations; API clients sendX-Widefleet-Organization, and the CLI supportswidefleet organizations,--organization IDandPLATFORM_ORGANIZATION. Multiple available organizations require a choice. Invalid or removed explicit or saved selections fail closed and can be repaired in the browser without signing out.The shared identity service owns selection, membership checks and role resolution. An optional fleet admission policy can only narrow those memberships. Standard installations remain restricted to their default fleet.
/meincludes the selected application context, and organization administrators do not become installation administrators.Browser forms and commands carry the organization displayed in their workspace. If another tab changes the session selection, the server rejects the stale write before issuing its principal; the browser explains the conflict and offers a page reload. This covers app, agent, access, workflow, member and settings mutations, including native forms without JavaScript. CLI deployment by name uses the shared authenticated request helper, retaining organization selection from app resolution through upload and deployment status.
App links retain their path and query through the organization chooser, including recovery from a stale selection. Both enhanced and native forms use the validated destination returned by the server. Sign-in and selection share validation that rejects external destinations, including paths that become unsafe after URL normalization.
Stacked on #55. This layer adds selection and admission contracts; it does not enable a complete hosted multi-organization deployment. Organization-specific login, directory configuration and deployment composition remain outside this change.
Validation on the complete implementation stack: strict workspace checks, 464 regular Vitest tests, 17 authenticated CLI/API integration tests and 14 browser organization tests with and without JavaScript. The real CLI test deploys an app, creates a flat named preview and deploys it again with automatic and explicit organization selection. Browser tests create flat app and preview addresses while retaining stale-tab and app-link protection. Node and Cloudflare builds pass. All services and identities are local synthetic fixtures.
Release-dependent documentation: #58 (publication blocked until the corresponding platform and CLI releases are published).


Confidence Score: 5/5 
The PR appears safe to merge with the verified discovery and directory fixes in PR #57.Summary
Adds shared organization discovery and selection for browser sessions, API requests, and the CLI.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A["Browser session or API token"] --> B["Check identity and scope"] B --> C["Read memberships and apply fleet admission"] C --> D{"Organization chosen?"} D -->|No| E["Use the sole choice or show the chooser"] D -->|Yes| F["Check the selected membership"] E --> F F --> G{"Browser write matches the displayed organization?"} G -->|No| H["Reject with 409"] G -->|Yes or not a browser write| I["Issue the application context"]Reviews (7) · Last reviewed commit: "Verify flat organization URLs through th..." · Reviewed by Greptile