tabby-rdp 0.5.3 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,96 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.5
4
+
5
+ **Fixed**
6
+ - **The development Angular dependency is updated to 21.2.25**, replacing the vulnerable 15.2.10 pin. The complete
7
+ locked dependency tree passes the npm advisory audit, including the seven Angular advisories reported against
8
+ 0.5.4. This updates the plugin's build dependency; Tabby's bundled Angular remains controlled by Tabby.
9
+ - **Published dependency metadata includes only the plugin's runtime dependencies.** Build/test dependencies and
10
+ build scripts stay in the source checkout. The published shrinkwrap retains exact runtime versions, download URLs
11
+ and integrity hashes, and omits development-only entries. Playwright's browser installer helpers no longer belong
12
+ to the published plugin's dependency graph.
13
+ - **Publication checks verify the exact metadata transformation against the tagged source**, and still compare all
14
+ other packaged source files and vendor binaries. CI audits all development dependencies and tests the packed plugin
15
+ in native Tabby on macOS, Windows and Linux.
16
+
17
+ Version 0.5.4 was deprecated and unpublished from npm while these findings were addressed; its GitHub release was
18
+ returned to draft. The scanner's separate warning about the presence of a shrinkwrap remains an intentional packaging
19
+ tradeoff; this release retains the reviewed runtime lock.
20
+
21
+ ## 0.5.4
22
+
23
+ Expanded Linux desktop qualification, cross-platform visual QA and RDP security hardening.
24
+
25
+ **Added**
26
+ - **Cross-platform visual QA against real desktops:** native Tabby clients on macOS, Windows and Linux cover
27
+ Ubuntu 24.04 / GNOME 46, Fedora 44 / GNOME 50, Debian 13.7 / GNOME 48, Rocky Linux 9 / Xfce with xrdp, and
28
+ Windows 11. Checks capture desktop pixels, keyboard input, resize, tab return and reconnect with reviewed baselines
29
+ and recorded client, server and plugin identities. RDP qualification currently uses ARM64 clients.
30
+ - **A local visual QA dashboard** runs tests and opens screenshot evidence, HTML reports and traces. It includes
31
+ history, scheduling, retention, automatic failure investigation and optional AI review. Credentials, private target
32
+ configuration and run artifacts stay outside the published package and repository.
33
+ - **Tests of the visual tests:** controlled defect injection verifies that the deterministic checks detect all 13
34
+ tested defects on all three client platforms. Optional AI review remains advisory, with its misses recorded.
35
+ - **Hosted native smoke checks on macOS, Windows and Linux** validate plugin loading and settings in CI. Real RDP
36
+ tests use separately configured machines; hosted smoke results do not stand in for desktop qualification.
37
+ - **An experimental Fedora KDE / KRDP testbed** covers H.264 with FreeRDP 3.32.1 on the server, using two opt-in
38
+ server patches for color and authentication compatibility. The fixed-monitor profile passes on all three native
39
+ client platforms. Stock server variants and live remote monitor resizing remain unqualified. The plugin's RDP
40
+ client remains IronRDP; Rocky Linux's tested traditional desktop stack is Xfce with xrdp.
41
+
42
+ **Changed**
43
+ - **Standard dialogs use Tabby's own window drag region**, available in Tabby 1.0.238
44
+ ([upstream #11766](https://github.com/Eugeny/tabby/pull/11766)). The plugin no longer adds a fallback to host dialogs.
45
+ Older Tabby versions still work, but need updating to move the window while a standard dialog is open.
46
+ The plugin's custom settings overlays retain their own drag strips.
47
+
48
+ **Security** (the rest of the review of 0.5.3-rc.1; all of these were in 0.5.2 too)
49
+ - **The RD Gateway's NTLM sign-in is always bound to its TLS connection.** A challenge without the target information
50
+ or the time that the binding goes with is refused, rather than answered without the binding and the integrity code.
51
+ - **A server can no longer fill Tabby's memory with clipboard answers it doesn't read.** The local proxy stopped
52
+ reading the client when the server fell behind, so answers piled up uncounted in the window until it crashed. It
53
+ now goes on reading, counts what waits for the server against the room file transfers already keep within, and
54
+ ends the connection once 104 MB waits.
55
+ - **H.264 decoders are held to 16 per desktop**, including decoders still finishing frames after their surfaces end.
56
+ A surface gets one only with a key frame. IronRDP owns admission, accounting and cleanup through its public decoder
57
+ configuration; the earlier wrapper that evicted surfaces by editing private decoder state is removed.
58
+ Exceeding the cap fails H.264 and takes the existing reconnect-without-H.264 path.
59
+ - **A shared folder's listing gives the server at most 10,000 names**, read a few at a time, rather than the whole
60
+ folder for each listing the server asks for. A name past those is still there to open by its path, though not to
61
+ find by a query of the folder. How many listings the server may have open at once (one per folder handle) isn't
62
+ bounded yet, so this slows what a server can have the desktop keep rather than ends it.
63
+
64
+ **Additional security hardening** (#77–87)
65
+
66
+ - **CredSSP requires version 5 or later** before authentication continues. Servers offering only versions 2–4
67
+ must be updated; accepting their TLS certificate does not enable the legacy authentication binding.
68
+ - **Graphics decoding and caches have dimension, allocation and retained-state limits.** Static and dynamic
69
+ virtual-channel reassembly also has per-message limits and an aggregate incomplete-dynamic-message budget.
70
+ These limits are per session, not a total memory ceiling for Tabby's window.
71
+ - **Clipboard format lists are bounded and supported formats are selected in one pass.** Shared-drive work is
72
+ limited to 1,024 queued or in-flight requests and 64 MiB of encoded request data, with a resource error when full.
73
+ - **Generated GNOME credentials are stored per machine identifier.** Each host rotates to fresh credentials when
74
+ next set up; this does not isolate hosts from someone who can read or modify their shared home directory.
75
+ - **Runtime dependencies are pinned and shipped with an npm shrinkwrap.** Testbed images require verified hashes,
76
+ WinRM dependencies and the Electron CI tree are locked, and testbed credential media is privately staged and cleaned.
77
+ The internal-name CI check receives its secret only on protected branch pushes; it is inactive on an unprotected RC.
78
+
79
+ **EGFX/H.264 integration** (#88)
80
+
81
+ - **Graphics work waiting behind asynchronous decoding is bounded by count and bytes.** PDUs are processed
82
+ incrementally, AVC regions and frames per message are limited, and completions no longer scan the command queue.
83
+ - **Browser decoder input, creation rate, picture readbacks and decoded-pixel events have separate budgets.**
84
+ Surface deletion/reset closes ended streams even without a later H.264 frame. Failure and close release retained
85
+ pictures and suppress late readback callbacks. These budgets are per session and add together; they are not one
86
+ total renderer memory ceiling.
87
+ - **The combined patch series is rebuilt into the shipped JavaScript/WASM**, including the public decoder-cap
88
+ integration and bounded key-frame admission tests.
89
+
90
+ **Known limits:** the aggregate open-listing limit above and live Windows H.264/shared-folder checks remain pending.
91
+ The visual QA matrix does not qualify those paths; KDE qualification is limited to the patched, fixed-monitor profile.
92
+ See [visual QA coverage](docs/visual-qa.md) for the checks actually performed.
93
+
3
94
  ## 0.5.3
4
95
 
5
96
  **Added**
package/README.md CHANGED
@@ -25,7 +25,8 @@ remote desktop profiles can also connect directly or through an RD Gateway.
25
25
 
26
26
  - **Linux desktops without a monitor or a login.** The plugin starts a headless GNOME session for your SSH user with
27
27
  GNOME Remote Desktop, on the fly, without root. A server in a rack works as well as a workstation.
28
- - **Other Linux desktops** (KDE, XFCE, MATE, Cinnamon, …) through xrdp, where it runs: the plugin finds it by itself.
28
+ - **Other Linux desktops** through xrdp, including tested Rocky Linux 9 with Xfce. KDE, MATE, Cinnamon and
29
+ other desktops can also run in xrdp sessions; the plugin finds the server by itself.
29
30
  - **Windows desktops** behind any SSH host, such as a VM on your build server, and the desktop of a Windows machine
30
31
  you SSH into.
31
32
  - **Remote desktop profiles** for machines you reach without SSH (LAN, VPN): in Tabby's profile list, in a tab of their
@@ -62,6 +63,7 @@ Making it work with GNOME took fixes in IronRDP, which we contribute upstream ([
62
63
  - [desk: the console on the desktop](#desk-the-console-on-the-desktop)
63
64
  - [Settings](#settings)
64
65
  - [Requirements](#requirements)
66
+ - [Tested environments](#tested-environments)
65
67
  - [Built on IronRDP](#built-on-ironrdp)
66
68
  - [Development](#development)
67
69
  - [Limitations](#limitations)
@@ -112,6 +114,17 @@ The first connection to a machine takes a few seconds while it prepares GNOME Re
112
114
  ones take well under a second. The same shortcut switches between the desktop and the console, and the desktop keeps
113
115
  running in the background until you disconnect or close the tab.
114
116
 
117
+ GNOME's generated password and TLS key belong to each SSH user and machine. They are kept under
118
+ `~/.local/share/tabby-rdp/hosts/<machine-id>/`, with private directory/file permissions. Linux needs a valid,
119
+ initialized `/etc/machine-id`; cloned machines must have distinct IDs. On the first connection after this change,
120
+ each machine gets new credentials and GNOME Remote Desktop restarts, disconnecting any existing RDP clients.
121
+ Reconnect to **every** machine using a shared home to rotate all active credentials. Old home-wide credential files
122
+ are preserved for machines still using an earlier version, but this version never imports them.
123
+
124
+ Separate credentials prevent accidental reuse across machines; they do not isolate machines that let the same
125
+ account read or write the shared home. That account can still read every machine's stored secrets and GNOME's own
126
+ shared configuration. Use separate accounts or host-local homes when those machines need independent trust.
127
+
115
128
  A machine without GNOME but with [xrdp](https://github.com/neutrinolabs/xrdp) running (the usual RDP server for KDE,
116
129
  XFCE, MATE and the rest) gets xrdp's desktop instead: sign in with your Linux password, which the plugin can remember
117
130
  in the system keychain. xrdp takes the password without Network Level Authentication, and that the machine's desktop
@@ -556,15 +569,35 @@ are local to this computer:
556
569
  - **Windows desktops:** Windows 10 or 11 Pro, or Windows Server, with Remote Desktop turned on, reachable from an SSH
557
570
  host or running OpenSSH Server itself.
558
571
 
559
- Tested with Ubuntu 24.04 (GNOME Remote Desktop 46.3) and Windows 11 (Pro and Enterprise), from Tabby on macOS,
560
- Windows 11 and Ubuntu 24.04 (arm64). Recent host compatibility tests cover official Tabby **1.0.238** on macOS
561
- with xterm 5, and upstream xterm 6 builds on macOS and Linux. The new package installation dialog is tested on
562
- macOS with Tabby 1.0.238; Windows qualification of these changes remains pending. See the
563
- [host test matrix](test/README.md#host-qualification) for the exact builds and coverage.
564
-
565
572
  The plugin checks the host's available features through a shared compatibility layer. Connection logs include the
566
573
  host and runtime versions, declared xterm dependency and observed capabilities to help diagnose forks and nightlies.
567
574
 
575
+ ## Tested environments
576
+
577
+ The visual QA matrix runs real remote desktops in native Tabby clients on **macOS, Windows and Linux**. The current
578
+ RDP matrix uses ARM64 Tabby 1.0.236 / Electron 43.7.0 on all three client platforms:
579
+
580
+ | Remote desktop | Server stack | Visual QA coverage |
581
+ |---|---|---|
582
+ | Ubuntu 24.04 | GNOME 46 / GNOME Remote Desktop | Desktop pixels, keyboard input, resize, tab return and reconnect |
583
+ | Fedora 44 | GNOME 50 / GNOME Remote Desktop | Same RDP lifecycle checks |
584
+ | Debian 13.7 | GNOME 48 / GNOME Remote Desktop | Same RDP lifecycle checks |
585
+ | Rocky Linux 9 | Xfce 4.18 / xrdp 0.10.6.1 / xorgxrdp 0.10.5 | Same RDP lifecycle checks |
586
+ | Windows 11 | Windows Remote Desktop | Same RDP lifecycle checks, with H.264 disabled |
587
+ | Fedora 44 KDE Plasma | KRDP / KPipeWire 6.7.5, FreeRDP 3.32.1; two opt-in server patches | H.264 pixels, input, tab return, reconnect and fixed-monitor client fitting |
588
+
589
+ The KDE row is experimental: the tested profile needs server-side color and authentication compatibility patches.
590
+ Stock KDE builds and live remote monitor resizing are not qualified. FreeRDP is a dependency of that KRDP server;
591
+ tabby-rdp's client continues to use IronRDP. Rocky's Xfce desktop uses **xrdp**, a different RDP server.
592
+ The testbed includes the opt-in KDE patches and reproducible setup instructions; see the
593
+ [visual QA guide](docs/visual-qa.md) for exact identities, evidence and remaining gaps.
594
+
595
+ Hosted CI also runs native settings and plugin smoke checks on macOS, Windows and Linux; those checks do not qualify
596
+ x86_64 RDP sessions. Recent host compatibility tests cover official Tabby **1.0.238** on macOS with xterm 5, and
597
+ upstream xterm 6 builds on macOS and Linux. The package installation dialog is tested on macOS with Tabby 1.0.238;
598
+ Windows qualification of that dialog remains pending. See the [host test matrix](test/README.md#host-qualification).
599
+ These focused checks do not establish clipboard, shared-folder, audio or microphone coverage across every matrix cell.
600
+
568
601
  ## Built on IronRDP
569
602
 
570
603
  The desktop is [IronRDP](https://github.com/Devolutions/IronRDP)'s web client: an RDP implementation in Rust, compiled
@@ -604,11 +637,15 @@ npm ci --ignore-scripts
604
637
  npm run build # TypeScript to dist/
605
638
  npm run typecheck # plugin and test TypeScript
606
639
  npm run test:unit # standard unit suite; no remote machine needed
640
+ npm run pack:release # publishable package with runtime-only dependency metadata
607
641
  scripts/sandbox.sh # a separate Tabby with this plugin linked in (macOS), DevTools on port 9334
608
642
  npm test # end-to-end suites against a test machine: see test/README.md
609
643
  npm run build:ironrdp # rebuild vendor/ from IronRDP and ironrdp/patches: see ironrdp/README.md
610
644
  ```
611
645
 
646
+ - [docs/visual-qa.md](docs/visual-qa.md): the local visual QA dashboard, native client/server matrix, reviewed screenshot
647
+ baselines, defect injection, optional AI review, scheduling and evidence retention. Run `npm run test:qa` for its
648
+ service tests; follow the guide to configure real desktop targets. Private credentials and run artifacts stay local.
612
649
  - [docs/architecture.md](docs/architecture.md): how the pieces fit, the remote setup, and security notes.
613
650
  - [docs/desk.md](docs/desk.md): `desk` and trd-pty.
614
651
  - [test/README.md](test/README.md) and [testbed/README.md](testbed/README.md): the tests, and setting up test
@@ -24,6 +24,7 @@ const targets_1 = require("./targets");
24
24
  const deskScript_1 = require("./deskScript");
25
25
  const audio_1 = require("./audio");
26
26
  const ironrdp_1 = require("./ironrdp");
27
+ const h264_1 = require("./h264");
27
28
  const clipboard_1 = require("./clipboard");
28
29
  const connectionStatus_1 = require("./connectionStatus");
29
30
  const microphone_1 = require("./microphone");
@@ -83,6 +84,8 @@ const vendorFile = (f) => path.join(__dirname, '..', 'vendor', f);
83
84
  const vendor = (f) => (0, url_1.pathToFileURL)(vendorFile(f)).href;
84
85
  const STYLE = `
85
86
  .trd-overlay { position: absolute; inset: 0; z-index: 30; display: flex; background: #111; }
87
+ /* Only full-window settings overlays expose their drag strip (see settingsPage.ts). */
88
+ .trd-form-dragbar { display: none; }
86
89
  .trd-host { flex: auto; min-width: 0; min-height: 0; display: flex; }
87
90
  .trd-host iron-remote-desktop { flex: auto; }
88
91
  .trd-last-frame { max-width: 100%; max-height: 100%; object-fit: contain; align-self: center; margin: auto; }
@@ -3671,7 +3674,9 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
3671
3674
  return { connected: false };
3672
3675
  }
3673
3676
  if (h264) {
3674
- session.h264 = new rdp.WebCodecsH264Decoder({ onFailure: (reason) => session.log.push(`h264: failed: ${reason}`) });
3677
+ // The vendor owns surface retirement and all resource accounting; its public option bounds the
3678
+ // browser decoders without wrapping away lifecycle notifications (see h264.ts).
3679
+ session.h264 = (0, h264_1.createH264Decoder)(rdp.WebCodecsH264Decoder, { onFailure: (reason) => session.log.push(`h264: failed: ${reason}`) });
3675
3680
  config.withExtension(rdp.h264Decoder(session.h264));
3676
3681
  }
3677
3682
  // GNOME Remote Desktop requires the graphics pipeline. Windows (and xrdp) do better with bitmaps than with
@@ -3845,45 +3850,12 @@ exports.RemoteDesktopService = RemoteDesktopService = RemoteDesktopService_1 = _
3845
3850
  tabby_core_1.PlatformService])
3846
3851
  ], RemoteDesktopService);
3847
3852
  let styleInstalled = false;
3848
- function installStyle(compat) {
3853
+ function installStyle() {
3849
3854
  if (styleInstalled) {
3850
3855
  return;
3851
3856
  }
3852
3857
  styleInstalled = true;
3853
3858
  const style = document.createElement('style');
3854
- style.textContent = STYLE + signin_1.STYLE + fileTransfer_1.STYLE + connectionStatus_1.STYLE + osd_1.OSD_STYLE + DRAGBAR_STYLE + accountForm_1.STYLE;
3859
+ style.textContent = STYLE + signin_1.STYLE + fileTransfer_1.STYLE + connectionStatus_1.STYLE + osd_1.OSD_STYLE + accountForm_1.STYLE;
3855
3860
  document.head.appendChild(style);
3856
- keepWindowDraggable(compat);
3857
- }
3858
- /** A strip the height of the tab bar that stays a window drag region over a dialog (the plugin's, and Tabby's). */
3859
- const DRAGBAR_STYLE = `
3860
- .trd-form-dragbar { display: none; }
3861
- .modal > .trd-form-dragbar { display: block; position: fixed; left: 0; right: 0; top: 0; height: var(--tabs-height, 38px); -webkit-app-region: drag; }
3862
- `;
3863
- /**
3864
- * Older Tabby dialogs cover the tab bar without a drag region. Supply their fallback strip, deferring to the host's
3865
- * modal pseudo-element when it provides one. The plugin's own dialogs still need their strips (see settingsPage.ts).
3866
- */
3867
- function keepWindowDraggable(compat) {
3868
- const strip = (modal) => {
3869
- if (compat.hasNativeModalDragRegion(modal)) {
3870
- return;
3871
- }
3872
- if (!modal.querySelector(':scope > .trd-form-dragbar')) {
3873
- const bar = document.createElement('div');
3874
- bar.className = 'trd-form-dragbar';
3875
- modal.prepend(bar);
3876
- }
3877
- };
3878
- // ng-bootstrap appends each dialog (ngb-modal-window.modal) to the body itself: only the body's children are watched.
3879
- document.querySelectorAll('body > .modal').forEach(strip);
3880
- new MutationObserver(records => {
3881
- for (const record of records) {
3882
- record.addedNodes.forEach(node => {
3883
- if (node instanceof Element && node.classList.contains('modal')) {
3884
- strip(node);
3885
- }
3886
- });
3887
- }
3888
- }).observe(document.body, { childList: true });
3889
3861
  }
package/dist/drives.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SharedDrives = exports.WINDOW_OPEN_FILES = exports.MAX_OPEN_FILES = void 0;
3
+ exports.SharedDrives = exports.WINDOW_OPEN_FILES = exports.MAX_LISTED = exports.MAX_OPEN_FILES = void 0;
4
4
  exports.sharedFolders = sharedFolders;
5
5
  exports.driveName = driveName;
6
6
  exports.openFilesInWindow = openFilesInWindow;
@@ -51,6 +51,17 @@ const READ_LIMIT = 4 * 1024 * 1024;
51
51
  * far fewer open. More are refused (EMFILE) until the server closes some.
52
52
  */
53
53
  exports.MAX_OPEN_FILES = 1024;
54
+ /**
55
+ * Names one folder's listing gives the server at most (security review, finding 4). IronRDP keeps a listing whole with
56
+ * each folder handle the server opens, and the server decides how many it opens and which folder each lists: a shared
57
+ * folder with a great many names, listed again and again, would have the desktop's memory fill with copies of it. A
58
+ * folder anyone browses has far fewer; past this many, the rest aren't listed, and the log says so. What is left out is
59
+ * still there to open by its path (an open is a lookup of its own), though not to find by a query of the folder: IronRDP
60
+ * answers a query for one name, a pattern or all of them from this listing (patch 0015), so a name left out isn't
61
+ * found that way. This caps what one handle holds, not how many handles the server may hold, which stays IronRDP's to
62
+ * bound: the server can still have the desktop keep as many listings as it opens handles.
63
+ */
64
+ exports.MAX_LISTED = 10000;
54
65
  /**
55
66
  * Files all the desktops in a window may have open at once. The window's descriptors are one process's, so a limit per
56
67
  * desktop alone would let several desktops together hold that many times more. The window may have 8192 open on
@@ -136,6 +147,8 @@ class SharedDrives {
136
147
  this.full = false;
137
148
  /** The connection ended (see dispose): nothing more is opened, and what was still opening is closed again. */
138
149
  this.disposed = false;
150
+ /** A listing was cut short (see MAX_LISTED): said once. */
151
+ this.listCut = false;
139
152
  // RDPDR device ids are the session's: the audio device, when there is one, takes 0 in IronRDP.
140
153
  this.drives = folders.map((folder, i) => {
141
154
  this.byId.set(i + 1, folder);
@@ -312,7 +325,28 @@ class SharedDrives {
312
325
  }
313
326
  async list(deviceId, remote) {
314
327
  const { local } = await this.locate(deviceId, remote, true);
315
- return fsp.readdir(local);
328
+ // Read a few names at a time, up to MAX_LISTED: not the whole folder first (readdir), only to cut it short. Which
329
+ // names those are is the file system's order to read them in, not one the user could tell (the remote shows
330
+ // them sorted).
331
+ const names = [];
332
+ const dir = await fsp.opendir(local);
333
+ try {
334
+ for await (const entry of dir) {
335
+ if (names.length === exports.MAX_LISTED) {
336
+ if (!this.listCut) {
337
+ this.listCut = true;
338
+ this.log(`drives: a folder of more than ${exports.MAX_LISTED} names was listed: the remote gets ${exports.MAX_LISTED} of them, in no particular order (the rest are still there to open by path)`);
339
+ }
340
+ break;
341
+ }
342
+ names.push(entry.name);
343
+ }
344
+ }
345
+ finally {
346
+ // Closed by the loop as it ends, but for a read that throws.
347
+ await dir.close().catch(() => null);
348
+ }
349
+ return names;
316
350
  }
317
351
  async open(deviceId, remote, mode) {
318
352
  if (this.disposed) {
package/dist/h264.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAX_H264_DECODERS = void 0;
4
+ exports.createH264Decoder = createH264Decoder;
5
+ /** Active and retiring browser decoders together, within one desktop session. */
6
+ exports.MAX_H264_DECODERS = 16;
7
+ /**
8
+ * Keep the vendor instance intact: IronRDP calls its endSurfaces hook even without another video frame, and the
9
+ * decoder owns pending-byte accounting, retiring decoders, readbacks and statistics. Capacity exhaustion follows
10
+ * its normal failure path, which reconnects without H.264; the plugin must not evict its private surface state.
11
+ */
12
+ function createH264Decoder(Decoder, options = {}) {
13
+ return new Decoder({ ...options, maxDecoders: exports.MAX_H264_DECODERS });
14
+ }
@@ -27,7 +27,6 @@ function terminalInputs(container) {
27
27
  /** An Angular factory provides one instance per plugin window; this module itself needs no Angular runtime. */
28
28
  class HostCompatibility {
29
29
  constructor(sources) {
30
- this.nativeModalDragRegion = null;
31
30
  const xtermDeclaration = text(read(() => {
32
31
  const terminal = sources.terminalPackage?.();
33
32
  return text(terminal?.dependencies?.['@xterm/xterm']) ?? text(terminal?.devDependencies?.['@xterm/xterm']);
@@ -37,25 +36,11 @@ class HostCompatibility {
37
36
  electron: text(sources.electron), node: text(sources.node), xtermDeclaration,
38
37
  xtermMajor: declaredMajor(xtermDeclaration),
39
38
  });
40
- this.modalStyle = sources.modalStyle ?? ((element, pseudo) => getComputedStyle(element, pseudo));
41
- }
42
- /** Probe each modal; themes and UI scale can change while the application is running. */
43
- hasNativeModalDragRegion(modal) {
44
- let supported = false;
45
- try {
46
- const style = this.modalStyle(modal, '::before');
47
- supported = style.content !== 'none' && style.content !== 'normal' && style.display !== 'none' &&
48
- style.getPropertyValue('-webkit-app-region') === 'drag' && parseFloat(style.height) > 0;
49
- }
50
- catch { }
51
- this.nativeModalDragRegion = supported;
52
- return supported;
53
39
  }
54
40
  snapshot(pane) {
55
41
  return {
56
42
  ...this.info,
57
43
  capabilities: {
58
- nativeModalDragRegion: this.nativeModalDragRegion,
59
44
  terminalInput: pane ? terminalInputs(pane).length > 0 : null,
60
45
  },
61
46
  };
@@ -63,14 +48,13 @@ class HostCompatibility {
63
48
  /** Local build information and observed capabilities only; no config, accounts, paths or connection details. */
64
49
  diagnosticLines(pane) {
65
50
  const info = this.snapshot(pane);
66
- const { nativeModalDragRegion, terminalInput } = info.capabilities;
67
- const drag = nativeModalDragRegion === null ? 'unobserved' : nativeModalDragRegion ? 'host' : 'plugin fallback';
51
+ const { terminalInput } = info.capabilities;
68
52
  const input = terminalInput === null ? 'unobserved' : terminalInput ? 'available' : 'unavailable';
69
53
  return [
70
54
  `Host: ${info.name ?? 'unknown'} ${info.version ?? 'unknown'} on ${info.platform ?? 'unknown'}`,
71
55
  `Runtime: Electron ${info.electron ?? 'unknown'}, Node ${info.node ?? 'unknown'}`,
72
56
  `Terminal: xterm ${info.xtermDeclaration ?? 'unknown'} (host declaration)`,
73
- `Compatibility: modal drag region ${drag}; terminal input ${input}`,
57
+ `Compatibility: terminal input ${input}`,
74
58
  ];
75
59
  }
76
60
  }
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ const ui_1 = require("./ui");
30
30
  let RemoteDesktopModule = class RemoteDesktopModule {
31
31
  constructor(app, hotkeys, desktop, header, targets, keyboard, injector) {
32
32
  const compat = injector.get(hostCompat_1.HostCompatibility);
33
- (0, desktop_service_1.installStyle)(compat);
33
+ (0, desktop_service_1.installStyle)();
34
34
  header.install();
35
35
  // Passwords go to Tabby's Vault while it is enabled (as Tabby's SSH passwords do), else to the system keychain.
36
36
  try {
package/dist/ntlm.js CHANGED
@@ -190,18 +190,25 @@ function ntlmV2Response(hash, serverChallenge, targetInfo, time, clientChallenge
190
190
  */
191
191
  function authenticateMessage(negotiate, challenge, account) {
192
192
  const server = parseChallenge(challenge);
193
+ // The sign-in is bound to the TLS connection and the service it is for by the pairs the client adds to the server's
194
+ // target information (see clientTargetInfo), and covered whole by the integrity code, which goes with the server's
195
+ // time among those pairs. A challenge without target information, or without the time, would have the answer go
196
+ // out bound to neither, with an LMv2 response besides that binds nothing either: one a gateway could pass on to
197
+ // another service that only checks the binding when it is there. Every Windows since Vista sends both, and an RD
198
+ // Gateway is a Windows Server 2012 R2 or later: such a challenge is refused (security review, finding 5).
199
+ if (!server.targetInfo.length) {
200
+ throw new Error('the gateway\'s NTLM challenge has no target information, so the sign-in couldn\'t be bound to this connection: not answered');
201
+ }
202
+ if (!avPair(server.targetInfo, AV_TIMESTAMP)) {
203
+ throw new Error('the gateway\'s NTLM challenge doesn\'t say when it is, so the sign-in couldn\'t be bound to this connection: not answered');
204
+ }
193
205
  const split = /^([^\\]+)\\(.+)$/.exec(account.username);
194
206
  const [domain, username] = split ? [split[1], split[2]] : [account.domain ?? '', account.username];
195
- // The server says when it is (a timestamp among its pairs) on every Windows since Vista: the response then
196
- // carries an integrity code, and the LM response is left empty.
197
- const timed = !!avPair(server.targetInfo, AV_TIMESTAMP);
198
- const targetInfo = server.targetInfo.length
199
- ? clientTargetInfo(server.targetInfo, { mic: timed, channelBinding: account.channelBinding, targetName: account.targetName })
200
- : server.targetInfo;
207
+ const targetInfo = clientTargetInfo(server.targetInfo, { mic: true, channelBinding: account.channelBinding, targetName: account.targetName });
201
208
  const hash = ntlmV2Hash(username, domain, account.password);
202
- const clientChallenge = (0, crypto_1.randomBytes)(8);
203
- const { response, sessionKey } = ntlmV2Response(hash, server.challenge, targetInfo, undefined, clientChallenge);
204
- const lm = timed ? Buffer.alloc(24) : Buffer.concat([hmacMd5(hash, server.challenge, clientChallenge), clientChallenge]);
209
+ const { response, sessionKey } = ntlmV2Response(hash, server.challenge, targetInfo);
210
+ // No LM response next to the server's time: the NT response and the integrity code are the proof.
211
+ const lm = Buffer.alloc(24);
205
212
  const fields = [lm, response, utf16(domain), utf16(username), utf16(account.workstation ?? ''), Buffer.alloc(0)];
206
213
  // 64 bytes of fields and flags, 8 of version (none), 16 of integrity code, then what the fields point at.
207
214
  const header = Buffer.alloc(88);
@@ -218,8 +225,6 @@ function authenticateMessage(negotiate, challenge, account) {
218
225
  NEGOTIATE_128 | NEGOTIATE_56;
219
226
  header.writeUInt32LE((server.flags & ours & ~NEGOTIATE_VERSION) >>> 0, 60);
220
227
  const message = Buffer.concat([header, ...fields]);
221
- if (timed) {
222
- hmacMd5(sessionKey, negotiate, challenge, message).copy(message, 72);
223
- }
228
+ hmacMd5(sessionKey, negotiate, challenge, message).copy(message, 72);
224
229
  return message;
225
230
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FLOW_WINDOW = void 0;
3
+ exports.SERVER_BACKLOG = exports.FLOW_WINDOW = void 0;
4
4
  exports.normalizeFingerprint = normalizeFingerprint;
5
5
  exports.preconnectionPdu = preconnectionPdu;
6
6
  exports.offersNla = offersNla;
@@ -32,9 +32,8 @@ function fingerprintOf(der) {
32
32
  return normalizeFingerprint((0, crypto_1.createHash)('sha256').update(der).digest('hex'));
33
33
  }
34
34
  /**
35
- * What answers to the remote's requests may have taken of the window's memory, read for it or handed to the connection,
36
- * beyond what the proxy has read from the connection (see ServerFlow): four of the largest parts of files a request
37
- * gets. A link stays busy with far less, as the proxy lets no more than HIGH_WATER wait for the server.
35
+ * What answers to the remote's requests may have taken of the window's memory, read for it, handed to the connection
36
+ * or waiting in the proxy for the server (see ServerFlow): four of the largest parts of files a request gets.
38
37
  */
39
38
  exports.FLOW_WINDOW = 64 * 1024 * 1024;
40
39
  /** The answer to a server without Network Level Authentication where nobody decides otherwise: refused. */
@@ -509,8 +508,15 @@ const MAX_EARLY = 256 * 1024;
509
508
  const MAX_CLIENTS = 4;
510
509
  /** A WebSocket message from the client: RDP PDUs, at most a few megabytes for a shared drive's read. */
511
510
  const MAX_MESSAGE = 32 * 1024 * 1024;
512
- /** Data waiting for the other side past this pauses the side it comes from, until half of it is gone. */
511
+ /** Data waiting for the client past this pauses the server, until half of it is gone. */
513
512
  const HIGH_WATER = 8 * 1024 * 1024;
513
+ /**
514
+ * What may wait in the proxy for a server that doesn't take it, before the connection ends (see send). Answers keep
515
+ * within FLOW_WINDOW of it and one message more (see ServerFlow), so the rest of what the client sends (input, sound,
516
+ * and the clipboard's answers, which nothing else bounds) always has HIGH_WATER at least: far more than it needs while
517
+ * the server reads.
518
+ */
519
+ exports.SERVER_BACKLOG = exports.FLOW_WINDOW + MAX_MESSAGE + HIGH_WATER;
514
520
  /**
515
521
  * Sends the client's X.224 request upstream, reads the confirm, then does TLS there. With a pre-connection blob, that
516
522
  * goes first; without an X.224 request (a Hyper-V VM's console), TLS follows the blob at once and X.224 is the
@@ -625,13 +631,16 @@ async function startRDCleanPathProxy(openUpstream, checkCertificate, log = () =>
625
631
  let legacyTls = false;
626
632
  const stats = { bytesIn: 0, bytesOut: 0 };
627
633
  // The room (see ServerFlow): what was taken for answers and not read from the connection since, the client whose
628
- // connection that is (the latest to reach the relay: a reconnect can overlap the connection it replaces), and what
629
- // waits for room. Once the proxy is closed there is room for good: nothing more goes anywhere.
634
+ // connection that is (the latest to reach the relay: a reconnect can overlap the connection it replaces), the
635
+ // stream to its server, where what the proxy read waits for the server, and what waits for room. Once the proxy is
636
+ // closed there is room for good: nothing more goes anywhere.
630
637
  let owed = 0;
631
638
  let flowClient = null;
639
+ let flowUpstream = null;
632
640
  let roomWaiters = [];
633
641
  let shut = false;
634
- const hasRoom = () => shut || owed < exports.FLOW_WINDOW;
642
+ const backlog = () => flowUpstream?.writableLength ?? 0;
643
+ const hasRoom = () => shut || owed + backlog() < exports.FLOW_WINDOW;
635
644
  const roomMade = () => {
636
645
  if (roomWaiters.length && hasRoom()) {
637
646
  const go = roomWaiters;
@@ -685,19 +694,32 @@ async function startRDCleanPathProxy(openUpstream, checkCertificate, log = () =>
685
694
  // What was handed to this connection went with it: the next starts with all the room.
686
695
  if (flowClient === ws) {
687
696
  flowClient = null;
697
+ flowUpstream = null;
688
698
  owed = 0;
689
699
  roomMade();
690
700
  }
691
701
  };
692
702
  let deadline = setTimeout(() => stage === 'hello' && ws.terminate(), HELLO_TIMEOUT_MS);
693
703
  const toServer = options.autologon ? autologon() : (data) => data;
704
+ // The proxy reads the client whatever the server does: what the server doesn't take yet waits here, where it is
705
+ // counted, and not in the client's own queue to send, where nothing is (IronRDP's WebSocket sends without
706
+ // looking at it). The room keeps answers within bounds (see ServerFlow); the clipboard's answers, which the
707
+ // remote can ask for again and again, aren't counted there, so the connection ends once more waits than
708
+ // SERVER_BACKLOG. Each write taken by the server makes room again. A server that reads, slowly, can end up
709
+ // there too: what is pasted there from here goes as it is, however large (nothing bounds it), and more of it
710
+ // than SERVER_BACKLOG on a link that takes long to carry it waits here meanwhile. So the failure says how much
711
+ // waited, not only that the server stopped taking it.
694
712
  const send = (data) => {
695
713
  const out = toServer(data);
696
- // The server (or the SSH channel to it) not keeping up: stop reading from the client until it has (see
697
- // ServerFlow).
698
- if (out.length && !upstream.write(out) && upstream.writableLength > HIGH_WATER) {
699
- ws.pause();
700
- upstream.once('drain', () => ws.resume());
714
+ if (closed || !out.length) {
715
+ return;
716
+ }
717
+ upstream.write(out, roomMade);
718
+ if (upstream.writableLength > exports.SERVER_BACKLOG) {
719
+ failure = `more than ${Math.round(exports.SERVER_BACKLOG / 1024 / 1024)} MB sent to the server waited for it to take them (${Math.round(upstream.writableLength / 1024 / 1024)} MB): it stopped reading, or the link is too slow for what was sent`;
720
+ log(`RDCleanPath relay ended: ${failure}`);
721
+ ws.terminate();
722
+ end();
701
723
  }
702
724
  };
703
725
  failure = null;
@@ -719,12 +741,13 @@ async function startRDCleanPathProxy(openUpstream, checkCertificate, log = () =>
719
741
  ws.on('message', async (data) => {
720
742
  if (stage === 'relay') {
721
743
  stats.bytesOut += data.length;
722
- // Read from the connection: as much room again (see ServerFlow).
744
+ // Read from the connection: no longer waiting there, but in the proxy, for as long as the server doesn't
745
+ // take it (see ServerFlow).
723
746
  if (flowClient === ws) {
724
747
  owed = Math.max(0, owed - data.length);
725
- roomMade();
726
748
  }
727
749
  send(data);
750
+ roomMade();
728
751
  return;
729
752
  }
730
753
  if (stage === 'handshake') {
@@ -825,6 +848,7 @@ async function startRDCleanPathProxy(openUpstream, checkCertificate, log = () =>
825
848
  stage = 'relay';
826
849
  // The room is this connection's from now on, all of it (see ServerFlow).
827
850
  flowClient = ws;
851
+ flowUpstream = upstream;
828
852
  owed = 0;
829
853
  roomMade();
830
854
  // PROTOCOL_HYBRID_EX in the server's negotiation response: an Early User Authorization Result follows CredSSP.
@@ -885,6 +909,7 @@ async function startRDCleanPathProxy(openUpstream, checkCertificate, log = () =>
885
909
  token,
886
910
  stats,
887
911
  get failure() { return failure; },
912
+ get backlog() { return backlog(); },
888
913
  close: () => {
889
914
  // Stops listening, and ends the clients there are: close() alone waits for them.
890
915
  wss.close();