100 Commits
Author SHA1 Message Date
Grzegorz Zdunek 25a7be07df Connect: add e2e tests for kube access (#65929)
* Add kube fixture

* Make items in unified resources more semantically accurate so they are easier to find

* Add shell utility that executes a command and waits for its completion

* Add kube tests

* Use unique pod name

* Use `tsh kubectl`

* Ignore kubeconfigs in git

* Set up kube cluster only for Connect

* Remove stale kind cluster before calling create

* Handle Docker networking

* Use stable image

* Fix race condition on launch

* Do not download `busybox` image, exec into kind's internal pod

* Disable tests to avoid hitting rate limiter

* Disable kube fixture for now

* Lint
2026-08-13 10:11:50 +00:00
Grzegorz Zdunek 289411af80 Update e (#69596) 2026-08-12 10:48:35 +00:00
Grzegorz Zdunek 1dba5386c5 Connect: Switch from CommonJS to ES Modules (#68623)
* Switch configs and code to ESM

* Remove unused Babel config

* Vendor `ring-buffer-ts`

* Enable circular import warnings and remove one
2026-08-11 12:05:01 +00:00
Grzegorz Zdunek 37059115c1 Update js-yaml to 3.15.1 and 4.3.1 (#69511) 2026-08-10 14:50:06 +00:00
Grzegorz Zdunek a230ed085d Remove unused JSDOM dependency (#69509) 2026-08-10 14:42:17 +00:00
Grzegorz Zdunek 9658214e40 Switch tsgo to tsc (#69469) 2026-08-07 15:18:32 +00:00
Grzegorz Zdunek 8b552bb451 Bump node-tar, postcss brace-expansion, fast-uri, undici (#69410)
* Update `node-tar` to 7.5.22

* Update `postcss` to 8.5.16

* Update `brace-expansion` to 1.1.18, 2.1.4, and 5.0.9

* Update `fast-uri` to 3.1.5

* Bump `undici` to 6.28.0, 7.29.0, and 8.10.0
2026-08-06 15:03:56 +00:00
Grzegorz Zdunek c2d17dd917 Remove unused web GitHub configuration (#69358) 2026-08-06 08:03:38 +00:00
Grzegorz Zdunek 3a9d0e33ea Remove old IronRDP artifcats cleanup (#69349) 2026-08-05 14:22:42 +00:00
Grzegorz Zdunek e46813bb0e Fix unified resource items shadows (#69224) 2026-08-03 09:56:55 +00:00
Grzegorz Zdunek 3d82a6efe4 Enable useUnknownInCatchVariables in TypeScript (#68996)
* Enable `useUnknownInCatchVariables`

* Add `isErrnoException`

* Switch from unsafe `error.message` access to `getErrorMessage`/`ensureError`

* Make `serializeError` idempotent

* `TypeError` -> `unknown`

* Simplify `isErrnoException`, require `code`

* Create `isPermissionDeniedError` utility

* Make `isPermissionDeniedError` inline helper
2026-07-31 09:01:36 +00:00
Grzegorz Zdunek 3ddc9b53cc Update e (#69219) 2026-07-31 08:31:07 +00:00
Grzegorz Zdunek b419da54a7 Update pnpm to 11.17 (#69083) 2026-07-28 15:49:21 +00:00
Grzegorz Zdunek 6ba1ae50e7 Enable truecolor in terminal (#68881) 2026-07-24 11:08:38 +00:00
Grzegorz Zdunek 3b4d5bc4ee Bump JS deps (#68880)
* Bump `tar` to 7.5.20

* Bump `brace-expansion` to 1.1.16 and 2.1.2

* Bump `js-yaml` to 4.3.0

* Bump `fast-uri` to 3.14

* Bump `protobufjs` to 7.6.5
2026-07-23 13:19:33 +00:00
Grzegorz Zdunek 9353c43264 Update js-yaml to 3.15.0 (#68234) 2026-06-30 12:42:13 +00:00
Grzegorz Zdunek 26f257c850 Update form-data, tar, protobufjs, js-yaml, and esbuild (#67918)
* Bump `form-data` to 4.0.5

* Bump `tar` to 7.5.16

* Bump `protobufjs` to 7.6.4

* Bump `js-yaml` to 4.2.0

* Bump `@storybook` to 10.4.6 to get rid of `[email protected].7`

* Bump `esbuild` to 0.28.1

* `pnpm dedupe`
2026-06-22 15:06:53 +00:00
Grzegorz Zdunek 6f5524afcc Connect: Fix progress reporting for empty file uploads (#67885)
* Do not divide by zero

* Prevent `TerminalAddonsContainer` from taking more than 500px width
2026-06-18 09:35:06 +00:00
Grzegorz Zdunek 8bcaa8b30b Connect: Use os.Root for directory sharing (#67377)
* Use `os.Root` for directory sharing

* Remove unreachable code

Create creates or truncates the named file. If the file already exists, it is truncated.
2026-06-03 10:28:38 +00:00
Grzegorz Zdunek dd9407930c Prevent unbounded allocation on legacy TDP shared directory read (#66950) 2026-06-01 15:12:00 +00:00
Grzegorz Zdunek 664500608b Connect: Improve error message for pre-v17 clusters that may not advertise tools version (#67256)
* Connect: Improve error message for pre-v17 clusters that may not advertise tools version

* Drop `advertised an empty tools version`
2026-05-29 15:25:57 +00:00
Grzegorz Zdunek 8c15be1f1a Properly escape resource names in predicate expressions (#67227) 2026-05-29 13:38:48 +00:00
Grzegorz Zdunek 3f14f042ab Connect: do not crash tsh daemon if user preferences update is nil (#66899)
* Fix `userpreferences.Update` panic on nil request

* Recover from panic in gRPC middleware, add logging for stream handlers

* Use `trace.Errorf` to log stack trace, skip logging the actual panic

* Make panic recovery interceptor the last interceptor

* Replace incorrect `require.Errorf` usage with `require.ErrorContains`

* Use grpc getters instead of direct field access
2026-05-28 15:20:48 +00:00
Grzegorz Zdunek 8c6f09e439 Connect: harden osascripts (#67176)
* Harden osascripts for installing/removing tsh

* Harden osascript for VNet setup
2026-05-28 15:06:44 +00:00
Grzegorz Zdunek 44940fca6e Connect: Avoid falling back to system CA in tshd gRPC server when cert cannot be read (#67038)
* Avoid falling back to system CA when cert cannot be read

* Add test

* Fix flaky test

* Ensure cert is trusted by verifier

* Add explicit comment for non-nil `ClientCAs`
2026-05-28 08:52:15 +00:00
Grzegorz Zdunek 564779cdc0 Update pnpm to 11.3, Node.js to 24.16, electron to 42.2, electron-builder to 26.11.1 (#66516)
* Apply `pnpx codemod run pnpm-v10-to-v11`

* Remove `eslint` hoisting, it's in the root package.json anyway

* `pnpm install`

* Bump Node.js to 24.15

* Bump pnpm to 11.1.1

* Update pnpm to 11.3.0

* Update `electron` to 42.2.0, `electron-builder` to 26.11.1

* Update `node-abi` to 4.31.0

* Override `yauzl` to workaround Electron not being installed on Node.js 24.16

* Update Node.js to 24.16

* Bump Playwright to 1.60.0
2026-05-28 08:11:01 +00:00
Grzegorz Zdunek f06d535d8d Connect: Do not leak last terminal input in logs (#67049)
* Do not leak `lastInput` in logs

* Security hardening: use `execFile` instead of `exec`
2026-05-27 08:28:14 +00:00
Grzegorz Zdunek 047176ef68 Connect: remember clusters after logout (#66318)
* Separate logging out and forgetting profile

* Store `proxyHost` in the workspace and decouple workspace existence from profile existence

* Display workspaces instead of profiles in identity list

* Only activate workspace on launch when cluster exists

* Handle cluster disappearing when `ClusterLogin` is open

* Fix e2e tests

* Add comments

* Clean up rendering workspaces

* Make test name more obvious

* Make workspace state the source of truth for activation

* Adjust callsites to updated `addWorkspace` and `setActiveWorkspace` behavior

* Add `makeWorkspace` and `makePersistedWorkspace` test helpers

* Fix mistakenly passed `cluster.uri` instead of `cluster.proxyHost`

* Read `activeClusterUri` from `useStoreSelector`

* Update `proxyHost` in workspace whenever it changes in profile

* Use `proxyHost` in notification

* Introduce `rootClusterProxyHost`

* Get rid of `getActiveRootCluster()`

* Rename `identityItems`

* Improve comment for `setActiveWorkspace` init action

* Fix `Identity` story

* Previously used -> Saved in Connect

* Clear app updates managing cluster only when forgetting cluster

* Wrap `hasAnyWorkspaces` in boolean

* Expired session -> Session expired, Saved in Connect -> In history

* Fix e2e test
2026-05-15 08:23:44 +00:00
Grzegorz Zdunek 3c67e8c87d Connect: improve profile watcher and awaitable sender logging (#66529)
* Log full timestamp

Instead of '30-09-2017 03:57' log '2017-09-30T03:57:26.875Z'

* Add better logging to `AwaitableSender`, `ClusterStore`, and `ClusterLifecycleManager`

* Add logging to `profileWatcher`

* Handle `this.clustersService.findCluster(uri)` being potentially `undefined`

* Bump default `AwaitableSender` timeout to 20 seconds

Just in case it's related to https://github.com/electron/electron/issues/51065

* Do not log every FS event

* Remove unnecessary "Profile watcher already started" log

* Logging improvements

* Remove redundant "File system event limit exceeded" log
2026-05-08 14:15:54 +00:00
Grzegorz Zdunek 8a90aeeeb6 Discover: do not prompt when leaving Connect My Computer (#66418) 2026-05-07 16:35:08 +00:00
Grzegorz Zdunek 29a1c88f2c Connect: attempt to fix ETIMEDOUT error on launch (#66477)
* Add `waitForReady` to `updateTshdEventsServerAddress`

* Properly render error message
2026-05-07 09:30:58 +00:00
Grzegorz Zdunek fd520329de Update styled-components to 6.4.1 and postcss to 8.5.13 (#66390)
* Update `styled-components` to 6.4.1

* Update `postcss` to 8.5.13
2026-05-05 08:44:38 +00:00
Grzegorz Zdunek 77910c8eb0 Update @xmldom/xmldom to 0.8.13 (#66144) 2026-04-27 07:51:21 +00:00
Grzegorz Zdunek a22468283b Connect: clarify admin privileges are required for initial installation only (#66053)
* Clarify admin privileges are required for initial installation only

* Grammar improvements
2026-04-23 13:02:33 +00:00
Grzegorz Zdunek 1429487b4b Fix InfoGuideSidePanel story (#66005) 2026-04-22 14:21:23 +00:00
Grzegorz Zdunek 36dc67e68d Connect: Clear only stale clients in cache (#65832)
* Clear only stale clients in cache

* Match test on specific error

* Improve comment
2026-04-20 16:18:32 +00:00
Grzegorz Zdunek f1bd20090e Update protobufjs to 7.5.5 (#65918) 2026-04-20 10:02:08 +00:00
Grzegorz Zdunek b7f317af13 Connect: Improve search bar readability (#65781)
* Improve results layout

* Do not show matches in resource's secondary properties/labels if there's already a match on the main field

* Adjust stories and add tests

* Change `font-weight` to 400 for better redability

* Add tests for `getVisibleMatches`

* Remove unnecessary trailing spaces
2026-04-20 09:14:49 +00:00
Grzegorz Zdunek a5ff5dfe2b Bypass HTTP proxies for local JS gRPC clients (#65634) 2026-04-17 12:13:39 +00:00
Grzegorz Zdunek 4ada208adc Show roles in expandable list (#65577) 2026-04-10 09:34:49 +00:00
Grzegorz Zdunek a5f0048b5d Update lodash, brace-expansion, smol-toml, and yaml (#65588)
* Update `lodash` to 4.18.1

* Update `brace-expansion` to 1.1.13

* Update `smol-toml` to 1.6.1

* Update `yaml` to 1.10.3 and 2.8.3
2026-04-09 15:22:46 +00:00
Grzegorz Zdunek d73f4b431d Update e (#65452) 2026-04-07 14:30:24 +00:00
Grzegorz Zdunek fc19088fce Remove rolldown dependency (#65330) 2026-04-03 07:23:52 +00:00
Grzegorz Zdunek 9417a9b245 Update @xmldom/xmldom and picomatch (#65279)
* Update `@xmldom/xmldom` to 0.8.12

* Update `picomatch` to 2.3.2 and 4.0.4
2026-04-02 09:52:19 +00:00
Grzegorz Zdunek 328db2c7a5 Connect: Improve docs about dual-mode installations (#65267)
* Connect: Improve docs about dual-mode installations

* Fix path

* Clarify app uninstalling
2026-04-01 16:37:09 +00:00
Grzegorz Zdunek 3c7d18d339 Connect: fix failing fresh silent NSIS installs (#65170)
* Fix failing fresh silent NSIS installs

* Ensure DACL is non-empty
2026-03-30 12:34:23 +00:00
Grzegorz Zdunek 798e66c788 Connect: update managed updates docs for Windows dual-mode install and registry policy config (#64905)
* Update managed updates docs

* Link to docs in app

* Add defaults

* Instruct how to collect logs from `TeleportConnectUpdater`

* Update paths in uninstall instructions
2026-03-24 09:14:20 +00:00
Grzegorz Zdunek 08f9670402 Ensure canvas dimensions are integers (#64949) 2026-03-24 08:33:24 +00:00
Grzegorz Zdunek c0a66f3344 Connect: verify signature in privileged updater against hardcoded Windows signing cert (#64754)
* Make `verifySignature` compare subject against fixed cert

* Adjust tests

* Update README.md
2026-03-23 15:40:10 +00:00
Grzegorz Zdunek eef415cfeb Connect: add e2e tests for headless auth (#64837)
* Switch to `ESNext` to allow using `Promise.withResolvers`

* Add missing accessibility specifiers

* Enable running Web UI in Connect tests

* Add tests for headless auth

* `aria-label` -> `title`

* Improve resource management with `AsyncDisposableStack.move`

* Pass `AbortError`

* Add comment about timeout
2026-03-23 10:24:46 +00:00
Grzegorz Zdunek 030e483626 Connect: gracefully handle VNet service and app version mismatch (#64438)
* Add `VERSION_MISMATCH` status to `WindowsServiceStatus`

* Show error in UI

* Verify service compatibility with client

* Fix outdated comment

* Remove unnecessary stories

* Move `VerifyServiceInstalledAndMatchesClient` to separate file
2026-03-19 07:45:58 +00:00
Grzegorz Zdunek 770e0ec074 Connect: add e2e tests for app configuration (#64758)
* Rename `app` to `electronApp`

* Allow customizing app config

* Add config file tests

* Use default config in `e2e/scripts/open-connect.ts`
2026-03-18 13:43:21 +00:00
Grzegorz Zdunek ce254e8e3b Connect: run in E2E tests (#64614)
* Move `tests` to `tests/web`

* Enable building Connect

* Prepare Playwright test setup

* Add `browse` mode

* Replace `foo-` with `connect-e2e-test-`

* Merge if statements together

* `--browse-web` -> `--browse`

* Build Connect if requested path is `tests`

* Make imports more readable

* Attach logs to failed tests

* Link to docs about `use`

* Include "." in slashPath comparison

* Properly clean up app when `launchApp` throws before returning async disposer
2026-03-16 18:42:53 +00:00
Grzegorz Zdunek 56b38da8dc Connect: prepare for E2E testing (#64613)
* Allow storing `home`, `userData`, and `sessionData` under custom path

* Optimize `getRuntimeSettings` loading sequence

* Enable mocking webauthn in tests

* Rename `webauthnmock_off.go` to `webauthnmock_nop.go`
2026-03-16 15:55:02 +00:00
Grzegorz Zdunek 8ad0912b30 Fix flaky test in profileWatcher.test.ts (#64569)
* Fix flaky test in `profileWatcher.test.ts`

* Use virtual watcher in debounce test
2026-03-16 15:10:29 +00:00
Grzegorz Zdunek 90eabf6ee7 Connect: support MOTD (#64310)
* Add `message_of_the_day` to `AuthSettings`, remove unused `has_message_of_the_day`

* Support passing `whiteSpace` to `Text`

* Show MOTD before login

* Add tests and stories

* Remove `minHeight={0}`

* Move `MessageOfTheDay` to `ClusterLogin`

* Minor code style fix
2026-03-12 09:27:35 +00:00
Grzegorz Zdunek b3adaffad6 Connect: install updates via privileged service, add signature verification (#63573)
* Add service commands to tsh

* Install updater service and run updates through it

* Add signature verification

* Disable CTMU for `tsh.exe connect-updater-install-update`

* Force install mode when migrating from one-click to assisted multi-user

* Spawn `tsh.exe connect-updater-install-update` synchronously and catch errors

* Use single parent command, remove args from `service.Start`

* Do not ignore error from closing handle

* Grammar fixes

* Use single command in installer.nsh too

* Use `svc.IsWindowsService()` instead of `isWindowsService`

* Switch from `CertCompareCertificateName` to comparing subject properties

* Log certs if they don't match

* Improve comment
2026-03-06 13:52:51 +00:00
Grzegorz Zdunek ad36d4e068 Connect: add privileged updater service (#63572)
* Add privileged updater service

* Add integration tests for updater

* Review fixes

* Move privileged updater to its own module

* Fix comments

* Interpolate registry pathnames, switch errors to AccessDenied

* Improve error handling in `waitForSingleClient`

* Use stricter DACL for named pipe

* Close `conn` on context cancellation

* Move reading update meta to separate function

* `trace.LimitExceeded` -> `trace.Errorf`

* Fix test

* Ensure updater only allows HTTPS

* Use TLS server in tests

* Fix tests
2026-03-06 13:11:11 +00:00
Grzegorz Zdunek fbee1e39cb Disable CTMU for tsh.exe during Windows service install and runtime (#63760)
* Disable CTMU for tsh.exe during Windows service install and runtime

* Rename `runningAsService` to `isWindowsService`

* Improve comment
2026-03-02 15:41:13 +00:00
Grzegorz Zdunek 8c043bbce2 Run Connect autoupdate integration tests on Windows (#63732) 2026-02-20 07:36:44 +00:00
Grzegorz Zdunek 9ebf6c715f RFD 0242: Improve Windows installation experience (#62545)
* RFD 0242: Improve Windows installation experience

* Review comments

* Fix spelling

* Review fixes

* Update reviewers

* Replace clusters allowlist with upgrade-only update policy

* Resolve install location from system registry

* Improve update process

* Lint

* Clarify downgrade behavior for versions set via env var or system registry

* Clarify creating secure directory

* Fix typo

* Make improvements to update process based on implementation findings

* Typos

* Add exact security descriptors

* Lint
2026-02-18 12:12:29 +00:00
Grzegorz Zdunek 6b70cbfeba Connect: allow only version upgrades in automatic updates (#63187)
* Disallow downgrades

* Improve "update-not-available" state

* Fix title casing

* Add test for downgrades

* Ensure app version is greater than update version in test

* Bring back `UpdateInfo` interface to avoid unnecessary conflicts with other PRs
2026-02-05 11:11:21 +00:00
Grzegorz Zdunek 34c079541e Connect: read automatic updates configuration from Windows registry (#63281)
* Replace `GetDownloadBaseUrl` RPC with `GetConfig`

* Implement reading ToolsVersion and CdnBaseUrl from system registry

* Read values from `getConfig()` instead of `getDownloadBaseUrl` and `process.env`

* Use UAC updater when app is configured with env vars

* Fix typos

* Handle tools version being 'off'

* Safely read values from `GetConfigResponse`

* Fix ordering in proto

* Non-official -> Unofficial

* Add TODO about docs

* Use switch-case instead of if-else

* Bring back if-else
2026-02-05 10:06:22 +00:00
Grzegorz Zdunek 336379e17f Connect: switch Windows installer to dual mode (#62910)
* Switch installer to dual-mode

* Customize NSIS updater to disallow attempts to update per-machine installations if update is triggered from per-user instance

* Make `assertTshInProgramFiles` more strict

Reading Program Files path should be done using Windows API instead of env var that can be overridden.

* Add RPC to check if VNet service is installed

* Show warning and disable auto-start if there is no VNet service

* `GetWindowsSystemService` -> `CheckPreRunRequirements`

* `CheckPreRunRequirements` -> `CheckInstallTimeRequirements`

* Customize `forAll` option with VNet message

* Check for per-machine installation in system registry

* Fix vars with PreRun in the name

* Link to source file from the electron-builder repo, add commit hash

* Read per-machine location from Go instead of via PowerShell

* `IsPerMachineInstallResponse` -> `GetInstallationMetadataResponse`

* Define `GetInstallationMetadata` handler in separate file

* Fix tests failing on "updates not wrapped into act"
2026-02-05 09:22:49 +00:00
Grzegorz Zdunek b089576319 Update @isaacs/brace-expansion to 5.0.1 (#63487) 2026-02-04 16:15:48 +00:00
Grzegorz Zdunek b88d276dea Update pnpm to 10.28.2 (#63382) 2026-02-02 15:13:36 +00:00
Grzegorz Zdunek 845caf9a40 Make Windows Service setup reusable (#63132)
* Extract reusable function for service installation

* Move `install_service_windows.go` to `lib/windowsservice`

* Reintroduce `vnet/install_service_windows.go`

* Make service runner reusable

* Add missing service description and returns on error

* Log service name when installing/uninstalling

* Rename files

* Put `err` first
2026-01-28 09:38:58 +00:00
Grzegorz Zdunek 69d573ea5b Improve access requests checkout styling (#62962)
* Improve access requests styling

* Do not allow shrinking `TextArea` below its predefined height

* Move margin to separating element

* Remove unused border style
2026-01-20 11:15:33 +00:00
Grzegorz ZdunekandRafał Cieślak f0714decaf Fix launching AWS IC from Connect (#62796)
* Add `sub_kind` and `permission_sets` to `App` message

* Allow launching AWS IAM IC

* Add AWS domain to allowlist

* Fix makeApp helper

* Add story

* Validate path and host parts, add test

* Support US gov partition addresses

* Update proto message

* Use more realistic publicAddr in test

---------

Co-authored-by: Rafał Cieślak <[email protected]>
2026-01-14 14:57:48 +00:00
Grzegorz Zdunek cda9d8c932 Center search bar input in Connect (#62734)
* Center search bar in Connect

* Remove deprecated symbols
2026-01-09 16:22:38 +00:00
Grzegorz Zdunek 654ada4e6a Remove some circular JS imports (#62460)
* Remove some circular JS imports

* Replace custom implementations with the shared one
2025-12-23 16:12:49 +00:00
Grzegorz Zdunek fa16bfa008 Connect: expand tilde in file paths in app config (#62069)
* Add `homeDir` to `RuntimeSettings` to avoid importing from Electron in `appConfigSchema.ts`

* Expand tilde in paths
2025-12-09 16:42:29 +00:00
Grzegorz Zdunek cd3c8f84ee Fix unrecoverable ssh cert errors in tsh/Connect (#61322)
* Initialize default Username/HostLogin only in tsh

* Move `Username()` from `api.go` to `tsh.go`

* Remove wrong `Profile.SiteName` default

* Remove resetting `SiteName`

Not sure why it was needed. Perhaps to clear the default that we just removed? But even if add the default back and remove this fix, everything works.

* Gracefully handle missing SSH/TLS certs

* Remove unused `TeleportClient.LoadKeyForClusterWithReissue`

* Revert "Move `Username()` from `api.go` to `tsh.go`"

This reverts commit f7ff0ff6d1.

* Revert "Initialize default Username/HostLogin only in tsh"

This reverts commit ed38babf5e.

* When any of SSH/TLS cert is missing, return partial profile

* Only log non-nil errors

* Revert "Remove wrong `Profile.SiteName` default"

* Revert "Remove resetting `SiteName`"

This reverts commit f54ab3f22a.

* Set `SiteName` when adding cluster

* Improve comments

* Add test

* Fix test

* Add myself to TODO

* Add test for logging out with missing SSH cert

* Lint
2025-11-28 10:12:24 +00:00
Grzegorz ZdunekandRafał Cieślak 1b42c8f894 Add tooltip to Connect tray icon (#61831)
* Add tooltip to Connect tray icon

* Use `app.name`

* Use `app.name` for the open button too

---------

Co-authored-by: Rafał Cieślak <[email protected]>
2025-11-28 09:24:38 +00:00
Grzegorz Zdunek a1f2ae0bf9 Serialize IPC errors (#61665)
* Serialize all enumerable error fields

* Add wrappers around `ipcMain.handle` and `ipcRenderer.invoke`

* Fix `Method Error.prototype.toString called on incompatible receiver undefined`

* Improve docs

* Lint
2025-11-25 15:54:25 +00:00
Grzegorz Zdunek 0b5ab6b81f Set up deep links as soon as possible (#61668) 2025-11-25 11:49:55 +00:00
Grzegorz Zdunek 4b005206f1 Connect: refresh resources when access changes and add tests for ClusterLifecycleManager (#61479)
* Detect when user's access changes

* Refresh resources in UI when `did-change-access` is received

* Add tests for `ClusterLifecycleManager`

* Add better docs for ClusterLifecycleEvent

* Test assuming requests too

* Improve test names
2025-11-21 08:11:04 +00:00
Grzegorz Zdunek 19533bf51a Connect: update docs for sharing ~/.tsh directory (#61467)
* Update docs for sharing ~/.tsh directory

* Review comments

* Lint
2025-11-20 10:26:29 +00:00
Grzegorz Zdunek 54b5f6cade Connect: switch tsh home directory to ~/.tsh (#61352)
* Switch tsh home directory to ~/.tsh

* Migrate old tsh home to new location, disallow updating fields outside the `state` key in app_state.json from the renderer process

* Show banner about migrated tsh home

* `promoteMigratedTshHome` -> `showTshHomeMigrationBanner`

* `MigratedTshHomeBanner` -> `TshHomeMigrationBanner`

* 'Profiles are' -> 'Profiles are now', remove unnecessary space

* Fix assigning colors for new workspaces

* Improve logs
2025-11-18 07:48:03 +00:00
Grzegorz Zdunek 95bec3a0c1 Gracefully handle missing current-profile and respect TELEPORT_PROXY in tsh status (#61295)
* Respect `TELEPORT_PROXY` env var in `tsh status`

* Enable listing profiles if there is no active profile

* Add test

* Define `err` within the block where it's actually used

* Handle missing current profile in `tsh logout`

* Make check more explicit

* Revert mistakenly commited change
2025-11-18 07:36:29 +00:00
Grzegorz Zdunek 6615e42ecc Connect: close cluster clients when profile changes (#61090)
* Include expiration time in `LoggedInUser`

This will allow the profile watcher to detect when the user relogged.

* Display expiration time in UI

* Add `ClearStaleClusterClients` RPC

* Implement `ClearStaleClusterClients`

* Clear stale clients when profile changes

* Improve session expiration component

* Move refresh button back to top

* `ClearCachedStaleClientsForRoot` -> `ClearStaleCachedClientsForRoot`

* `unchanged` -> `stale`

* Make "closing stale clients" a subtest

* Add `clientcache` test

* Remove `getProfile` error wrapping

* Improve comment

* Convert story to controls
2025-11-17 11:02:40 +00:00
Grzegorz Zdunek 5fa824911a Connect: react to tsh actions by watching tsh dir (#60884)
* Add `ClusterLifecycleManager`

* Register handlers for adding, removing and logging out from cluster

* Provide `rootCluster` in `useWorkspaceContext`

The handlers in the profile watcher will proceed with updating the cluster store, even if the renderer handlers returned errors.
This check protects us from a runtime error if the renderer fails to remove the workspace.

* Improve docs

* Move processing queue to listener

* Make `will-` operations always interrupt main process actions

* Improve error messages

* Do not remove managing cluster when **only** logging out

The app updater displays all clusters, not just those the user is logged into.

* Revert "Provide `rootCluster` in `useWorkspaceContext`"

This reverts commit cf76d2ba27.

* Rename `logoutWithCleanup` to `cleanUpBeforeLogout`

* Do not pass `AbortSignal` to `this.mainProcessClient.syncRootClusters`

* Lint

* Fix types issues

* Do not stack watcher notifications
2025-11-13 15:00:58 +00:00
Grzegorz Zdunek c39f26b794 Clear client cache only after a successful login (#61036) 2025-11-06 15:48:35 +00:00
Grzegorz Zdunek d4e6f1974e Connect: add profile watcher (#60622)
* Add profile watcher

* Move `makeClusterWithOnlyProfileProperties` to `profileWatcher.ts`, improve test

* Handle watched directory removal

* Improve comments

* Make tests faster, pass abort signal everywhere

* Improve docs

* Make `removing tsh directory does not break watcher` easier to understand

* Make test dir per test

* Improve timing in tests

* Add a limit of how many events can be emitted by `fs.watch` (to break the endless stream of events on Windows when watched dir is removed), go into the polling mode only when it's expected that the watched dir was removed

* Use `expect().rejects.toThrow` correctly

* Deflake 'max file system events count is restricted'

* Replace `makeClusterWithOnlyProfileProperties` with `mergeClusterProfileWithDetails`, move it back to `cluster.ts`

* Attempt to fix tests

* Clarify comment
2025-11-03 18:08:35 +00:00
Grzegorz Zdunek 0d21eea7b8 Update Connect gateway docs to mention background mode (#60939)
* Update Connect gateway docs to mention background mode

* Extend the Background Mode section, add links

* "favorite client" -> "client"
2025-11-03 16:47:49 +00:00
Grzegorz Zdunek 833d9600f3 Bump Node.js to 22.21 (#60655) 2025-10-29 09:13:20 +00:00
Grzegorz Zdunek 2d1bc7b909 Connect: make logout function idempotent (#60553)
* Remove `ClusterRemove` RPC, make logging out idempotent

* Move calling `removeKubeConfig` and `maybeRemoveAppUpdatesManagingCluster` to main process

The main process should not depend on the renderer to clean up its own resources.

* Remove cleaning up kube dir

* Lint
2025-10-28 13:17:55 +00:00
Grzegorz Zdunek 3ed1816dda Connect: do not use cluster from profile as root cluster name (#60473)
* Do not read root cluster name from profile's `cluster` field

* Update docs for `name` field

* Use profile name in places that refer to workspace

* Improve comments

* `clusterName` -> `profileName`

* Get rid of `nameOrProfile`

* Add JSDoc for `captureUserLogin`

* `cluster` -> `certificate`
2025-10-27 11:59:22 +00:00
Grzegorz ZdunekandRafał Cieślak 8874cbc743 Connect: create Unix sockets in temp directory (#60466)
* Create sockets in temp directory

* Shoutdown tshd events server when the window closes

* Handle `initializeApp` errors

* Switch to `fs.mkdtemp`

* Shorten socket filenames slightly

---------

Co-authored-by: Rafał Cieślak <[email protected]>
2025-10-24 10:03:30 +00:00
Grzegorz Zdunek a41d021f8a Move cluster state to main process (#59643)
* Create `ClusterStore` that manages cluster state

* Fix tests that mocked tshd directly

* Remove IPC to notify the main process about cluster list changes

* Load immer plugins in `MainProcess`

* Improve comments

* Refactor `useSender`

* Get rid of unnecessary Map and try/catch around send

* Get rid of `MainProcess.create`

* Do not return early `c.proxyHost` is falsy

* Add more context to test

* Add missing logout handler in main process

* Fix applying patches

* Adjust `subscribeToClusterStore` to updated `startAwaitableSenderListener`

* Crash window when sending state update fails

* Extract WebContents navigation handlers and add tests for opening links

* Improve error message

* Initialize `ClusterStore` synchronously

* Convert `lazyTshdClient` field to `getTshdClient` function, add docs

* Remove unused eslint directive
2025-10-22 10:49:30 +00:00
Grzegorz Zdunek 5dc76fecac Enable sending messages from main to renderer with acknowledgments (#59642)
* Create awaitable sender

* Review comments

* Fix test and lint
2025-10-22 10:14:04 +00:00
Grzegorz Zdunek 46dd5a0f9f Enable noImplictThis rule (#60346)
* Enable `noImplicitThis`

* Get rid of `memoize`

* Refactor `runOnce`

* Verify return value of `runOnce`

* Fix name

* Return value from `runOnce` in test
2025-10-20 16:04:41 +00:00
Grzegorz Zdunek de6b4edb6b Combine ClustersService logout functions (#59539)
* Remove clusters immediately after a logout, move `useClusterLogout` to `AppContext`

* Review callsites to ensure cluster is properly checked before being accessed

* Revert "Review callsites to ensure cluster is properly checked before being accessed"

This reverts commit 8343c3c291.

* Switch to removing the cluster at the end of logout sequence

* Lint

* Move `logoutWithCleanup` to `ui/ClusterLogout`
2025-10-13 11:40:45 +00:00
Grzegorz Zdunek df8987eb80 Distinguish downgrades from updates in Connect managed updates (#59602)
* Fix wrong storybook option

* Add `isDowngrade` to `UpdateInfo`

* Add downgrade messages

* `isDowngrade` -> `updateKind`

* Remove mistakenly commited `autoUpdater.quitAndInstall()`
2025-09-28 14:13:40 +00:00
Grzegorz Zdunek 7d09a9f6aa Do not enter background mode on quitAndInstall (#59574) 2025-09-25 12:49:40 +00:00
Grzegorz Zdunek 05f0c89b9d Remove access requests from clusters service (#59434)
* Remove `ClustersService.getAssumedRequests`

* Add react-query and fetch requests with it

* Adjust callsites

* Remove `ClustersService.getAccessRequest`

* Improve comments

* Fix optional chaining

* Expand stories and tests
2025-09-24 08:08:53 +00:00
Grzegorz Zdunek 83afd67377 Stop Connect build when signing fails (#59256) 2025-09-18 07:36:59 +00:00
Grzegorz Zdunek abe0b3c6ca Remove unused resource_ids field (#59065)
* Remove unused `resource_ids` field

* Fix comment for `resource_ids` in `CreateAccessRequestRequest` which should not be removed
2025-09-16 15:17:56 +00:00
Grzegorz Zdunek f743d25c12 Show only allowed logins for SSH servers in Connect (#59026)
* Move `calculateSSHLogins` to `lib/client`

* Calculate allowed logins in tshd

* Take logins from resource, not `loggedInUser`

* Remove `pipe`

* Remove `sshLogins`

* Lint
2025-09-11 14:21:39 +00:00
Grzegorz Zdunek 575c42fbcf Add docs for running Connect in background (#58858)
* Add docs for running Connect in background

* Review fixes

* Review fixes
2025-09-09 09:48:12 +00:00