tabby-rdp 0.5.5 → 0.5.6
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 +29 -0
- package/README.md +9 -4
- package/dist/desktop.service.js +152 -24
- package/dist/desktops.js +46 -11
- package/dist/rdpProfile.js +14 -6
- package/dist/signin.js +56 -31
- package/package.json +2 -3
- package/npm-shrinkwrap.json +0 -53
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.6
|
|
4
|
+
|
|
5
|
+
**Fixed**
|
|
6
|
+
- **Profiles for one address sign in as their own users** ([#104](https://github.com/meanaverage/tabby-rdp/issues/104)).
|
|
7
|
+
A saved password was kept for the address, so every remote desktop profile for it signed in with the first one
|
|
8
|
+
saved, whatever user name the profile gave. Each user's password is now saved on its own, profiles for different
|
|
9
|
+
users open side by side rather than bringing the first one's tab forward (for Windows, `Alice` and `alice` are one
|
|
10
|
+
user), and editing or removing one profile leaves the others' passwords and the address's certificate. A password
|
|
11
|
+
saved before goes to the profile of the user it is for the first time that profile connects; the others ask once,
|
|
12
|
+
and so do profiles for the same user name in different domains when it was saved without one. Signing in from a
|
|
13
|
+
profile's form as someone else keeps that login for that user, not as the profile's. A profile that names no user
|
|
14
|
+
signs in with the address's password, as before.
|
|
15
|
+
|
|
16
|
+
**Changed**
|
|
17
|
+
- **No shrinkwrap is published.** The plugin's runtime dependencies, `semver` and `ws`, are pinned to exact versions
|
|
18
|
+
in `package.json`, and packing refuses a runtime dependency that isn't exact or that brings dependencies of its own,
|
|
19
|
+
so `package.json` alone decides what npm installs. The development lock is `package-lock.json`, which npm never
|
|
20
|
+
publishes. Release checks still compare the packed package with the tagged commit.
|
|
21
|
+
|
|
22
|
+
**Documentation**
|
|
23
|
+
- Saved accounts are described as what they are, a login defined once to pick in any desktop, rather than mainly a
|
|
24
|
+
way to share one, and the README says that several profiles for one address each keep their own user's password.
|
|
25
|
+
|
|
26
|
+
**Compatibility notes**
|
|
27
|
+
- **Going back to 0.5.5 or earlier** after 0.5.6 has saved passwords for profiles that name a user: those versions
|
|
28
|
+
look for a profile's password under its address alone, so such profiles ask for it again there, and removing one of
|
|
29
|
+
them there leaves the password 0.5.6 saved for its user behind. It is listed in Tabby's Vault (as the address and
|
|
30
|
+
user), or under `tabby-rdp` in the system keychain, where it can be deleted.
|
|
31
|
+
|
|
3
32
|
## 0.5.5
|
|
4
33
|
|
|
5
34
|
**Fixed**
|
package/README.md
CHANGED
|
@@ -167,7 +167,7 @@ connecting again.
|
|
|
167
167
|
| **Screenshots** | **Save a screenshot** in the desktop's menus saves the remote screen at its full resolution as a PNG in Downloads, and copies it to the clipboard. |
|
|
168
168
|
| **Connection status** | Optionally, a small line in the corner of the desktop with the throughput each way, frames per second, the SSH round trip, and how it is connected (desktop, host, resolution, graphics mode, sharpness). |
|
|
169
169
|
| **Reconnecting** | After sleep or a network change, the desktop reconnects by itself once the connection is back. |
|
|
170
|
-
| **Sign-in** | GNOME desktops need none: the plugin manages their credentials. Windows and xrdp desktops ask for the account once and can remember it, in Tabby's Vault when that is on and in the system keychain otherwise; **Sign in again…** in the menu replaces it.
|
|
170
|
+
| **Sign-in** | GNOME desktops need none: the plugin manages their credentials. Windows and xrdp desktops ask for the account once and can remember it, in Tabby's Vault when that is on and in the system keychain otherwise; **Sign in again…** in the menu replaces it. A [saved account](#saved-accounts) defines a login once, to pick in any desktop. |
|
|
171
171
|
| **Shortcuts** | Switching between the desktop and the console, view only, a screenshot, Ctrl+Alt+Del, typing into or pasting to all desktops of a tab, the connection status and Disconnect each have a hotkey, set on the settings page or in Tabby's Hotkeys. They work while the desktop has the keyboard; a key another hotkey has is refused. |
|
|
172
172
|
| **Certificates** | GNOME desktops accept only the certificate the plugin made for them. A desktop you connect to directly, and an RD Gateway, connect without a question when their certificate is valid for their name by the certificate authorities this computer trusts; any other is shown, with why it can't be verified, its fingerprint and what it says of itself (whom it was issued to and by, and its dates), and connected only once you trust it. What it says of itself is its own word, unless its chain leads to an authority this computer trusts (another machine's certificate then shows that machine's name) and the TLS library didn't refuse it for a reason of its own (a limit set on the authority, say): an issuer you would expect there proves nothing, since anyone can make a certificate that names it; only the fingerprint, checked with whoever runs the server some other way, does. Desktops behind an SSH host remember theirs on first use. A different certificate later stops the connection and asks, but for one an authority vouches for in place of one it vouched for (a renewal); and one remembered on an authority's word is asked about again once it no longer validates. |
|
|
173
173
|
| **Passwords stay with servers that know them** | Windows signs in with Network Level Authentication: a proof both ways, where the password only reaches a server that knows it already. A Windows desktop whose server doesn't use it would get the password as it is, so the connection stops and asks first, before your password or user name is sent. xrdp signs in that way by design, so desktops you made xrdp ones aren't asked about; one that is xrdp only by a host's word (a VM it lists, a machine reached through it, the host's own desktop) is asked about once. The answer is kept with the certificate of the server you gave it for: another certificate, a new address or a forgotten certificate asks again. |
|
|
@@ -246,7 +246,10 @@ xrdp or GNOME Remote Desktop), and optionally the user name and domain. It then
|
|
|
246
246
|
SSH profiles do, and opens in a tab of its own that the desktop fills; there is no console under it. Sign-in, the
|
|
247
247
|
keychain, certificates, resize, sharpness, clipboard, files, sound, microphone, **Send keys**, view only, screenshots
|
|
248
248
|
and reconnecting work as in SSH tabs. After **Disconnect**, the tab offers **Connect**. In the profile selector you can
|
|
249
|
-
also type `user@host:port` and pick **Quick connect (REMOTE DESKTOP (RDP))**.
|
|
249
|
+
also type `user@host:port` and pick **Quick connect (REMOTE DESKTOP (RDP))**. Several profiles can lead to one address,
|
|
250
|
+
each signing in as another user: each user's password is saved on its own, their desktops open side by side, and
|
|
251
|
+
editing or removing one profile leaves the others' passwords and the address's certificate alone. A profile that names
|
|
252
|
+
no user asks who, and signs in with the password saved for the address by another such profile.
|
|
250
253
|
|
|
251
254
|
**Import an .rdp file…** (in the menu's **Settings**, or **Remote desktop: import an .rdp file…** in Tabby's command
|
|
252
255
|
palette) makes such a profile from a file saved by Remote Desktop Connection or handed out by an admin: its address,
|
|
@@ -355,8 +358,10 @@ and one-time codes at the gateway are not supported.
|
|
|
355
358
|
|
|
356
359
|
## Saved accounts
|
|
357
360
|
|
|
358
|
-
|
|
359
|
-
|
|
361
|
+
A saved account is a login defined on its own: a name, a user name (and domain), and its password, stored once. Any
|
|
362
|
+
desktop can pick it instead of typing a user name into its profile, and both ways work: a profile's own user name keeps
|
|
363
|
+
its own saved password, per user, for that address. An account is handy for keeping logins in one place, and for one
|
|
364
|
+
used on several desktops (a domain admin, a lab user), whose password is then changed once for all of them.
|
|
360
365
|
|
|
361
366
|
**Settings › Remote Desktop › Accounts** lists them, with the desktops that use each one (click a name to open its
|
|
362
367
|
settings), and adds, edits and removes them. A desktop picks its account in its profile's **Account** field, or in the
|
package/dist/desktop.service.js
CHANGED
|
@@ -189,19 +189,38 @@ class DesktopSession {
|
|
|
189
189
|
return this.spec.hyperv ? this.key.replace(/#hyperv:[^#]*$/, '#hyperv') : this.key;
|
|
190
190
|
}
|
|
191
191
|
/**
|
|
192
|
-
* Where a saved password is kept: under authKey,
|
|
193
|
-
* gateway too (see gatewayScope), whether the gateway
|
|
194
|
-
* password saved for one gateway (or for a connection
|
|
195
|
-
*
|
|
196
|
-
*
|
|
192
|
+
* Where a saved password is kept: under authKey, for a direct desktop the user it signs in as (see userScope), and
|
|
193
|
+
* whenever the desktop is reached through an RD Gateway, that gateway too (see gatewayScope), whether the gateway
|
|
194
|
+
* takes the desktop's sign-in or an account of its own: a password saved for one gateway (or for a connection
|
|
195
|
+
* without one) is never sent through a different gateway named for the same address without asking, and one saved
|
|
196
|
+
* for one user is never another profile's for the same address. The certificate and the "without NLA" decision
|
|
197
|
+
* stay keyed by authKey: those are the server's, whoever signs in, not the gateway's.
|
|
197
198
|
*/
|
|
198
199
|
get credentialKey() {
|
|
199
|
-
return this.
|
|
200
|
+
return this.credentialKeyFor(this.user);
|
|
200
201
|
}
|
|
201
|
-
/** `
|
|
202
|
-
|
|
202
|
+
/** Where a password for `user` (see signsInAs) is kept for this desktop: its credentialKey, for that user. */
|
|
203
|
+
credentialKeyFor(user) {
|
|
204
|
+
return this.authKey + (0, desktops_1.userScope)(user) + (0, signin_1.gatewayScope)(this.spec.gateway);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Where a direct desktop that names its user kept its saved password before 0.5.6: under the address alone,
|
|
208
|
+
* whoever it was for (see adoptCredentials). Null for one that doesn't name a user: its key is still that one.
|
|
209
|
+
*/
|
|
210
|
+
get formerCredentialKey() {
|
|
211
|
+
return this.user ? this.authKey + (0, signin_1.gatewayScope)(this.spec.gateway) : null;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* `key`: see sessionKey(). `user`: who a direct desktop's saved password is for (see signsInAs), '' for any other.
|
|
215
|
+
* `who`: who it signs in as (its saved account's name, else `user`, or whoever its form signed in as instead): one
|
|
216
|
+
* desktop per key and user, since each user of a server (a Windows server's, xrdp's) has a session of their own
|
|
217
|
+
* there.
|
|
218
|
+
*/
|
|
219
|
+
constructor(container, key, spec, user = '', who = user) {
|
|
203
220
|
this.key = key;
|
|
204
221
|
this.spec = spec;
|
|
222
|
+
this.user = user;
|
|
223
|
+
this.who = who;
|
|
205
224
|
this.state = 'connecting';
|
|
206
225
|
this.visible = false;
|
|
207
226
|
this.proxy = null;
|
|
@@ -1220,11 +1239,29 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
1220
1239
|
* desktop as it was unused, until it can be read while this window is open (see forgetLater). That is said, of that
|
|
1221
1240
|
* store. After a new address the certificate stays at the old one as well as going along (below), whichever
|
|
1222
1241
|
* passwords stayed there.
|
|
1223
|
-
|
|
1224
|
-
|
|
1242
|
+
*
|
|
1243
|
+
* A direct desktop (an RDP profile, `users` given) keeps a password for each user at an address (see
|
|
1244
|
+
* credentialKey), and other profiles can lead to the same address: its password goes as above only where it was
|
|
1245
|
+
* for the user it signed in as before (`users.from`, see signsInAs), and only where no other profile (the edited
|
|
1246
|
+
* one, `users.except`, aside) signs in with it; another user's, a profile's whose user is now another, stays for
|
|
1247
|
+
* the profiles that still sign in as them. Its saved account, if it has one, is the account's, whatever the edit. Nor
|
|
1248
|
+
* do the certificate, sharpness and "without NLA" decision leave an address another profile still leads to.
|
|
1249
|
+
*/
|
|
1250
|
+
async desktopEdited(fromId, toId, accountChanged, direct, gateways, users) {
|
|
1225
1251
|
const scope = (0, signin_1.gatewayScope)(gateways.from);
|
|
1252
|
+
const inUse = users ? this.directInUse(users.except) : null;
|
|
1226
1253
|
let waiting = [];
|
|
1227
|
-
if (
|
|
1254
|
+
if (users && inUse) {
|
|
1255
|
+
const which = { direct: true, user: (0, desktops_1.userScope)(users.from), owns: (c) => (0, desktops_1.isLoginOf)(c.username, users.from), scope, keep: inUse.keys };
|
|
1256
|
+
// A profile that names no user keeps the address's password: a new domain or account drops it, as before.
|
|
1257
|
+
if (users.from !== users.to || scope !== (0, signin_1.gatewayScope)(gateways.to) || accountChanged && !users.from) {
|
|
1258
|
+
waiting = await (0, signin_1.forgetCredentialsFor)(fromId, which);
|
|
1259
|
+
}
|
|
1260
|
+
else if (fromId !== toId) {
|
|
1261
|
+
waiting = await (0, signin_1.moveCredentialsFor)(fromId, toId, which, key => this.trustedCertificates().some(e => e.desktop === key));
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
else if (accountChanged || scope !== (0, signin_1.gatewayScope)(gateways.to)) {
|
|
1228
1265
|
waiting = await (0, signin_1.forgetCredentialsFor)(fromId, { direct, scope });
|
|
1229
1266
|
}
|
|
1230
1267
|
else if (fromId !== toId) {
|
|
@@ -1247,6 +1284,8 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
1247
1284
|
return id === fromId && (direct ? target === desktops_1.DIRECT_KEY : target !== desktops_1.DIRECT_KEY && target !== 'gateway');
|
|
1248
1285
|
};
|
|
1249
1286
|
const store = this.config.store.remoteDesktop;
|
|
1287
|
+
// Another profile still leads to the old address: what is kept there stays for it, as well as going along.
|
|
1288
|
+
const stays = !!inUse?.ids.has(fromId);
|
|
1250
1289
|
// The certificates go along and stay at the old address too. What is kept there still goes only to the machine
|
|
1251
1290
|
// it was saved for, and another machine answering there meets the certificate question rather than being
|
|
1252
1291
|
// trusted as a first use: the password of another desktop at that address, reached another way (a certificate
|
|
@@ -1258,7 +1297,7 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
1258
1297
|
// entry is dropped rather than put next to it, where either could be the one found.
|
|
1259
1298
|
const isMoved = (e) => typeof e?.desktop === 'string' && moved(e.desktop);
|
|
1260
1299
|
const taken = new Set(store[list].filter((e) => !isMoved(e)).map((e) => e?.desktop));
|
|
1261
|
-
const kept = list === 'trustedCertificates';
|
|
1300
|
+
const kept = list === 'trustedCertificates' || stays;
|
|
1262
1301
|
store[list] = store[list].flatMap((e) => {
|
|
1263
1302
|
if (!isMoved(e)) {
|
|
1264
1303
|
return [e];
|
|
@@ -1268,7 +1307,7 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
1268
1307
|
});
|
|
1269
1308
|
}
|
|
1270
1309
|
}
|
|
1271
|
-
if (Array.isArray(store.withoutNla)) {
|
|
1310
|
+
if (Array.isArray(store.withoutNla) && !stays) {
|
|
1272
1311
|
store.withoutNla = store.withoutNla.filter((e) => !(typeof e?.desktop === 'string' && moved(e.desktop)));
|
|
1273
1312
|
}
|
|
1274
1313
|
this.config.save();
|
|
@@ -1555,18 +1594,62 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
1555
1594
|
* password from going to a machine that isn't the one it was saved for, where a desktop behind a host trusts the
|
|
1556
1595
|
* first certificate it meets unasked. The user is told, and can forget them in Settings › Remote Desktop ›
|
|
1557
1596
|
* Certificates. `what` names the desktop for that.
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1597
|
+
*
|
|
1598
|
+
* A direct desktop (an RDP profile, `users` given) whose address another profile (`users.except`, the one going,
|
|
1599
|
+
* aside) still leads to takes only the passwords of its own user (`users.user`, see signsInAs) that no such
|
|
1600
|
+
* profile signs in with, and leaves the certificate to them.
|
|
1601
|
+
*/
|
|
1602
|
+
async forgetDesktop(id, direct, what, users) {
|
|
1603
|
+
const inUse = direct && users ? this.directInUse(users.except) : null;
|
|
1604
|
+
const shared = !!inUse?.ids.has(id);
|
|
1605
|
+
const own = shared && users ? { user: (0, desktops_1.userScope)(users.user), owns: (c) => (0, desktops_1.isLoginOf)(c.username, users.user), keep: inUse.keys } : {};
|
|
1606
|
+
const waiting = await (0, signin_1.forgetCredentialsFor)(id, direct ? { direct: true, ...own } : {});
|
|
1561
1607
|
if (waiting.length) {
|
|
1562
1608
|
this.notifications.info(`If a password was saved for ${what}, ${this.passwordWaits(waiting)} Its remembered certificate stays, ` +
|
|
1563
1609
|
'so that the password can only go to that machine: Settings › Remote Desktop › Certificates can forget it.');
|
|
1564
1610
|
return;
|
|
1565
1611
|
}
|
|
1612
|
+
if (shared) {
|
|
1613
|
+
return;
|
|
1614
|
+
}
|
|
1566
1615
|
this.forgetCertificatesFor(id, direct);
|
|
1567
1616
|
this.config.save();
|
|
1568
1617
|
this.changed$.next();
|
|
1569
1618
|
}
|
|
1619
|
+
/**
|
|
1620
|
+
* What the direct desktops (RDP profiles of their own, not through an SSH host) other than the profile `except`
|
|
1621
|
+
* use, as Tabby opens them (their group's defaults included): the keys of their saved passwords (see
|
|
1622
|
+
* credentialKey: each user's, for each gateway), their addresses, and each one's address, user (see signsInAs) and
|
|
1623
|
+
* gateway (see gatewayScope). A profile in a shape nothing reads is left out.
|
|
1624
|
+
*/
|
|
1625
|
+
directInUse(except) {
|
|
1626
|
+
const keys = new Set();
|
|
1627
|
+
const ids = new Set();
|
|
1628
|
+
const found = [];
|
|
1629
|
+
const profiles = this.config.store.profiles;
|
|
1630
|
+
for (const p of Array.isArray(profiles) ? profiles : []) {
|
|
1631
|
+
if (p?.type !== targets_1.RDP_PROFILE_TYPE || except !== undefined && p.id === except) {
|
|
1632
|
+
continue;
|
|
1633
|
+
}
|
|
1634
|
+
let options = p.options;
|
|
1635
|
+
try {
|
|
1636
|
+
options = this.profiles.getConfigProxyForProfile(p).options;
|
|
1637
|
+
}
|
|
1638
|
+
catch { }
|
|
1639
|
+
try {
|
|
1640
|
+
const spec = options?.host && !(0, desktops_1.configText)(options.via) ? (0, desktops_1.specOf)({ ...options, wake: undefined }) : null;
|
|
1641
|
+
if (spec) {
|
|
1642
|
+
const who = (0, desktops_1.signsInAs)(spec);
|
|
1643
|
+
const scope = (0, signin_1.gatewayScope)(spec.gateway);
|
|
1644
|
+
ids.add(spec.id);
|
|
1645
|
+
keys.add(`${desktops_1.DIRECT_KEY}#${spec.id}${(0, desktops_1.userScope)(who)}${scope}`);
|
|
1646
|
+
found.push({ id: spec.id, who, scope });
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
catch { }
|
|
1650
|
+
}
|
|
1651
|
+
return { keys, ids, profiles: found };
|
|
1652
|
+
}
|
|
1570
1653
|
/**
|
|
1571
1654
|
* What becomes of a desktop's saved password that couldn't be removed from `waiting`, the stores that can't be read
|
|
1572
1655
|
* just now (see forgetCredentialsFor), as the end of a sentence.
|
|
@@ -1617,9 +1700,10 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
1617
1700
|
}
|
|
1618
1701
|
this.lastUsed.set(target.key, spec.id);
|
|
1619
1702
|
const key = (0, desktops_1.sessionKey)(target, spec);
|
|
1620
|
-
|
|
1703
|
+
const { user, who } = this.signsInAs(target, spec);
|
|
1704
|
+
// One desktop per key and user: another client would only get an extra, empty monitor (GNOME), or take
|
|
1621
1705
|
// over the session (Windows).
|
|
1622
|
-
const existing = this.paneWithDesktopFor(key);
|
|
1706
|
+
const existing = this.paneWithDesktopFor(key, who);
|
|
1623
1707
|
if (existing) {
|
|
1624
1708
|
if (existing.parent instanceof tabby_core_1.SplitTabComponent && existing.parent === pane.parent) {
|
|
1625
1709
|
// Next to it, moving the focus there would go unnoticed.
|
|
@@ -1635,7 +1719,7 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
1635
1719
|
this.selectPane(existing);
|
|
1636
1720
|
return this.showDesktop(existing);
|
|
1637
1721
|
}
|
|
1638
|
-
const created = new DesktopSession(pane.element.nativeElement, key, spec);
|
|
1722
|
+
const created = new DesktopSession(pane.element.nativeElement, key, spec, user, who);
|
|
1639
1723
|
created.onHelp = message => this.help.explain(message);
|
|
1640
1724
|
// The remote it is opened on, from the start: reopening one whose connection ended before it got as far as
|
|
1641
1725
|
// a sign-in (cancelled, or a setup that failed) goes there again, not to the tab's own host.
|
|
@@ -1972,11 +2056,27 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
1972
2056
|
if (!target || this.has(pane)) {
|
|
1973
2057
|
return false;
|
|
1974
2058
|
}
|
|
1975
|
-
|
|
2059
|
+
const desktop = spec ?? this.defaultDesktop(target);
|
|
2060
|
+
return !!this.paneWithDesktopFor((0, desktops_1.sessionKey)(target, desktop), this.signsInAs(target, desktop).who);
|
|
1976
2061
|
}
|
|
1977
|
-
|
|
2062
|
+
/**
|
|
2063
|
+
* Who a desktop opened from `target` signs in as, where that tells desktops at one address apart (see
|
|
2064
|
+
* DesktopSession's `user` and `who`): a direct one's own user (see signsInAs), and its saved account's sign-in name,
|
|
2065
|
+
* if it has one, in any case for Windows, whose user names and domains are (`Alice` is alice, and signing in as
|
|
2066
|
+
* her takes her session over). Nobody for one behind an SSH host, which is the only desktop at its address there
|
|
2067
|
+
* (its form refuses a second, see addressTaken).
|
|
2068
|
+
*/
|
|
2069
|
+
signsInAs(target, spec) {
|
|
2070
|
+
if (target.key !== desktops_1.DIRECT_KEY) {
|
|
2071
|
+
return { user: '', who: '' };
|
|
2072
|
+
}
|
|
2073
|
+
const user = (0, desktops_1.signsInAs)(spec);
|
|
2074
|
+
const account = spec.account ? this.accounts().find(a => a.id === spec.account) : undefined;
|
|
2075
|
+
return { user, who: whoOf(spec, account ? (0, accounts_1.signInName)(account) : user) };
|
|
2076
|
+
}
|
|
2077
|
+
paneWithDesktopFor(key, who = '') {
|
|
1978
2078
|
for (const [pane, session] of this.sessions) {
|
|
1979
|
-
if (session.key === key && session.state !== 'ended') {
|
|
2079
|
+
if (session.key === key && session.who === who && session.state !== 'ended') {
|
|
1980
2080
|
return pane;
|
|
1981
2081
|
}
|
|
1982
2082
|
}
|
|
@@ -2877,6 +2977,23 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
2877
2977
|
const again = this.askAgain.delete(pane);
|
|
2878
2978
|
// A desktop whose account is gone asks, rather than falling back to a login of its own saved earlier.
|
|
2879
2979
|
let saved = retryError || again || spec.account && !account ? null : await (0, signin_1.loadCredentials)(account ? (0, accounts_1.accountKey)(account.id) : session.credentialKey);
|
|
2980
|
+
// Saved before 0.5.6, under the address alone, by whichever profile for it signed in first: this desktop's
|
|
2981
|
+
// once it is for this desktop's user (another profile's is left for that one), and from now on kept as such.
|
|
2982
|
+
if (saved && !account && session.user && !(0, desktops_1.isLoginOf)(saved.username, session.user)) {
|
|
2983
|
+
// Kept for this desktop's user by a version that saved another login there: not this desktop's.
|
|
2984
|
+
session.log.push(`sign-in: the saved password is for ${saved.username}, not ${session.user}; asking`);
|
|
2985
|
+
saved = null;
|
|
2986
|
+
}
|
|
2987
|
+
// A password saved before 0.5.6 named its user without a domain where the profile gave the domain on its own: one
|
|
2988
|
+
// another profile at the address could be for too (alice, of another domain) stays where it is, and this asks.
|
|
2989
|
+
const former = session.formerCredentialKey;
|
|
2990
|
+
if (!saved && !retryError && !again && !spec.account && former) {
|
|
2991
|
+
const others = this.directInUse().profiles.filter(p => p.id === spec.id && p.scope === (0, signin_1.gatewayScope)(spec.gateway) && p.who !== session.user);
|
|
2992
|
+
saved = await (0, signin_1.adoptCredentials)(former, session.credentialKey, found => (0, desktops_1.isLoginOf)(found.username, session.user) && !others.some(p => (0, desktops_1.isLoginOf)(found.username, p.who)));
|
|
2993
|
+
if (saved) {
|
|
2994
|
+
session.log.push(`sign-in: the password saved for this address as ${saved.username}, now kept for that user`);
|
|
2995
|
+
}
|
|
2996
|
+
}
|
|
2880
2997
|
if (saved && account && saved.username !== (0, accounts_1.signInName)(account)) {
|
|
2881
2998
|
// Kept for an earlier user name of the account (its change didn't reach the store): not this one's.
|
|
2882
2999
|
session.log.push(`sign-in: the account's saved password is for ${saved.username}, not ${(0, accounts_1.signInName)(account)}; asking`);
|
|
@@ -2908,9 +3025,16 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
2908
3025
|
setTimeout(() => session.visible && this.showsInFront(session) && session.focusDesktop());
|
|
2909
3026
|
}
|
|
2910
3027
|
const entered = await asked;
|
|
3028
|
+
// Signed in as another user than the desktop names: kept for that user, not as this desktop's own, and that
|
|
3029
|
+
// user's desktop from now on (see paneWithDesktopFor).
|
|
3030
|
+
const as = entered && !account && session.user ? (0, desktops_1.signsInAs)({ username: entered.username, domain: spec.domain }) : '';
|
|
3031
|
+
if (as && as !== session.user) {
|
|
3032
|
+
session.who = whoOf(spec, as);
|
|
3033
|
+
}
|
|
2911
3034
|
return entered && {
|
|
2912
3035
|
host: spec.host, port: spec.port, credentials: entered, remember: entered.remember, domain: account ? account.domain ?? '' : undefined,
|
|
2913
3036
|
saveKey: account && (0, accounts_1.accountKey)(account.id), saveLabel: account && `saved account ${account.name}`, saveFor: account && (0, accounts_1.signInName)(account),
|
|
3037
|
+
...as && as !== session.user ? { saveUser: as } : {},
|
|
2914
3038
|
hyperv, mark, accountRevision,
|
|
2915
3039
|
};
|
|
2916
3040
|
}
|
|
@@ -3777,13 +3901,13 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
|
|
|
3777
3901
|
const key = endpoint.saveKey;
|
|
3778
3902
|
(0, signin_1.saveCredentialsIf)(key, credentials, () => this.accountCurrent(key, endpoint.saveFor, endpoint.accountRevision), endpoint.saveLabel).then(saved => session.log.push(saved ? `sign-in: saved as the account's password in ${(0, signin_1.storeName)()}` : 'sign-in: not saved: the account changed meanwhile'), e => session.log.push(`sign-in: ${(0, signin_1.storeName)()}: ${e?.message ?? e}`));
|
|
3779
3903
|
}
|
|
3780
|
-
else if (endpoint.remember && endpoint.mark !== undefined && (0, signin_1.forgottenSince)(session.credentialKey, endpoint.mark)) {
|
|
3904
|
+
else if (endpoint.remember && endpoint.mark !== undefined && (0, signin_1.forgottenSince)(endpoint.saveUser !== undefined ? session.credentialKeyFor(endpoint.saveUser) : session.credentialKey, endpoint.mark)) {
|
|
3781
3905
|
// Edited (its user name, gateway or address) or removed while the server delayed the sign-in: what was
|
|
3782
3906
|
// forgotten then stays forgotten, and the desktop asks the next time.
|
|
3783
3907
|
session.log.push('sign-in: not saved: the desktop was changed or removed meanwhile');
|
|
3784
3908
|
}
|
|
3785
3909
|
else if (endpoint.remember) {
|
|
3786
|
-
const key = endpoint.saveKey ?? session.credentialKey;
|
|
3910
|
+
const key = endpoint.saveKey ?? (endpoint.saveUser !== undefined ? session.credentialKeyFor(endpoint.saveUser) : session.credentialKey);
|
|
3787
3911
|
const writing = (0, signin_1.forgetMark)();
|
|
3788
3912
|
(0, signin_1.saveCredentials)(key, credentials, endpoint.saveLabel).then(() => {
|
|
3789
3913
|
// A forget that came while it was being written (an edit, a removal) found nothing to forget
|
|
@@ -3849,6 +3973,10 @@ exports.RemoteDesktopService = RemoteDesktopService = RemoteDesktopService_1 = _
|
|
|
3849
3973
|
tabby_core_1.SelectorService,
|
|
3850
3974
|
tabby_core_1.PlatformService])
|
|
3851
3975
|
], RemoteDesktopService);
|
|
3976
|
+
/** A desktop's `who` (see DesktopSession) as compared: in any case for Windows, whose user names and domains are. */
|
|
3977
|
+
function whoOf(spec, who) {
|
|
3978
|
+
return spec.kind === 'windows' ? who.toLowerCase() : who;
|
|
3979
|
+
}
|
|
3852
3980
|
let styleInstalled = false;
|
|
3853
3981
|
function installStyle() {
|
|
3854
3982
|
if (styleInstalled) {
|
package/dist/desktops.js
CHANGED
|
@@ -19,8 +19,12 @@ exports.keyFields = keyFields;
|
|
|
19
19
|
exports.nestedKey = nestedKey;
|
|
20
20
|
exports.shownKey = shownKey;
|
|
21
21
|
exports.keyUser = keyUser;
|
|
22
|
+
exports.signsInAs = signsInAs;
|
|
23
|
+
exports.isLoginOf = isLoginOf;
|
|
24
|
+
exports.userScope = userScope;
|
|
22
25
|
exports.keyParts = keyParts;
|
|
23
26
|
exports.rekeyed = rekeyed;
|
|
27
|
+
const accounts_1 = require("./accounts");
|
|
24
28
|
const clipboard_1 = require("./clipboard");
|
|
25
29
|
const hyperv_1 = require("./hyperv");
|
|
26
30
|
const osd_1 = require("./osd");
|
|
@@ -274,36 +278,67 @@ function shownKey(key) {
|
|
|
274
278
|
function keyUser(key) {
|
|
275
279
|
return keyFields(key).user;
|
|
276
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* Who a direct desktop signs in as, as its saved password's key names it (see userScope): DOMAIN\user, or the user
|
|
283
|
+
* name as typed where it names its domain itself (as signInName has it); '' for one that names no user (its sign-in
|
|
284
|
+
* asks who, its domain or not), which keeps the address's password. From its own user name and domain: a saved
|
|
285
|
+
* account's password is the account's (see accountKey), not the desktop's.
|
|
286
|
+
*/
|
|
287
|
+
function signsInAs(extra) {
|
|
288
|
+
const username = configText(extra?.username);
|
|
289
|
+
return username ? (0, accounts_1.signInName)({ username, domain: configText(extra?.domain) }) : '';
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Whether a login saved with `username` (as typed at a sign-in, the desktop's domain going with one that names none)
|
|
293
|
+
* is for `who` (see signsInAs): how a password saved for an address alone, before each user had their own there, is
|
|
294
|
+
* told to be a profile's.
|
|
295
|
+
*/
|
|
296
|
+
function isLoginOf(username, who) {
|
|
297
|
+
const slash = who.indexOf('\\');
|
|
298
|
+
return !!who && (0, accounts_1.signInName)({ username, domain: slash > 0 ? who.slice(0, slash) : '' }) === who;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* What a direct desktop's saved password's key adds for who it signs in as (`@user#<who>`, see signsInAs), or '' for a
|
|
302
|
+
* desktop that doesn't say: several profiles can lead to one address, each signing in as someone else, and each finds
|
|
303
|
+
* the password of its own user there. The user is written as keyField writes a target's, so it has no `#`.
|
|
304
|
+
*/
|
|
305
|
+
function userScope(who) {
|
|
306
|
+
return who ? `@user#${keyField(who, ESCAPED_USER)}` : '';
|
|
307
|
+
}
|
|
277
308
|
/**
|
|
278
309
|
* A session, trust or credential key split into the target it belongs to and the desktop id after it, so matching is
|
|
279
310
|
* anchored on whole parts rather than an `endsWith('#'+id)` that a different key could also satisfy. A key is
|
|
280
311
|
* `<target>#<id>`: the target is `rdp` for a direct desktop, `gateway` for a gateway certificate, or `user@host:port`
|
|
281
312
|
* for a desktop behind an SSH host (`<tab's key>><user@host:port>` for a machine reached through one, see nestedKey;
|
|
282
313
|
* no target's key has a `#`, see keyField); the own desktop's key is the bare target, with no id. A credential key
|
|
283
|
-
* may carry a
|
|
284
|
-
*
|
|
314
|
+
* may carry a user suffix (`…@user#<who>`, see userScope), which names who a direct desktop's password is for, and then
|
|
315
|
+
* a gateway suffix (`…@gateway#<host:port>`), which names where it is sent; both are returned separately, so the id
|
|
316
|
+
* still compares equal. Neither the id nor the user has a `#`, so neither suffix can be taken for part of either.
|
|
285
317
|
*/
|
|
286
318
|
function keyParts(key) {
|
|
287
319
|
const hash = key.indexOf('#');
|
|
288
320
|
if (hash < 0) {
|
|
289
|
-
return { target: key, desktopId: '', gateway: '' };
|
|
321
|
+
return { target: key, desktopId: '', user: '', gateway: '' };
|
|
290
322
|
}
|
|
323
|
+
const target = key.slice(0, hash);
|
|
291
324
|
const rest = key.slice(hash + 1);
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
325
|
+
const scoped = /^([^#]*?)(@user#[^#]*?)?(@gateway#[^#]*)?$/.exec(rest);
|
|
326
|
+
if (scoped) {
|
|
327
|
+
return { target, desktopId: scoped[1], user: scoped[2] ?? '', gateway: scoped[3] ?? '' };
|
|
328
|
+
}
|
|
329
|
+
// More `#` than a key of the plugin's has: compared whole, so that it matches no desktop's.
|
|
330
|
+
return { target, desktopId: rest, user: '', gateway: '' };
|
|
296
331
|
}
|
|
297
332
|
/**
|
|
298
333
|
* A session, trust or credential key of the target `from`, as the same key of `to` (see RemoteTargets.keyChanged,
|
|
299
|
-
* which moves what was kept under a target's former key): `from` itself (its own desktop), or `from#<id>`, with a
|
|
300
|
-
* gateway suffix on a saved password's key. Null for any other key. Desktop ids have no `#` (see
|
|
301
|
-
* has more of them isn't one of `from`'s desktops, whatever it starts with.
|
|
334
|
+
* which moves what was kept under a target's former key): `from` itself (its own desktop), or `from#<id>`, with a user
|
|
335
|
+
* and a gateway suffix on a saved password's key (see keyParts). Null for any other key. Desktop ids have no `#` (see
|
|
336
|
+
* specOf), so a key that has more of them isn't one of `from`'s desktops, whatever it starts with.
|
|
302
337
|
*/
|
|
303
338
|
function rekeyed(key, from, to) {
|
|
304
339
|
if (key === from) {
|
|
305
340
|
return to;
|
|
306
341
|
}
|
|
307
342
|
const rest = key.startsWith(`${from}#`) ? key.slice(from.length + 1) : null;
|
|
308
|
-
return rest !== null && /^[^#]*(@gateway#[^#]*)?$/.test(rest) ? `${to}#${rest}` : null;
|
|
343
|
+
return rest !== null && /^[^#]*(@user#[^#]*)?(@gateway#[^#]*)?$/.test(rest) ? `${to}#${rest}` : null;
|
|
309
344
|
}
|
package/dist/rdpProfile.js
CHANGED
|
@@ -135,7 +135,7 @@ let RDPProfileSettingsComponent = class RDPProfileSettingsComponent {
|
|
|
135
135
|
const o = this.profile.options;
|
|
136
136
|
const account = () => `${o.username ?? ''}\n${o.domain ?? ''}\n${o.account ?? ''}`;
|
|
137
137
|
// No id for a new profile (no address yet): it has nothing saved to take along.
|
|
138
|
-
this.before = { id: o.host ? (0, desktops_1.desktopIdOf)(o) : '', account: account(), via: o.via ?? '', gateway: o.gateway ?? '' };
|
|
138
|
+
this.before = { id: o.host ? (0, desktops_1.desktopIdOf)(o) : '', account: account(), user: (0, desktops_1.signsInAs)(o), via: o.via ?? '', gateway: o.gateway ?? '' };
|
|
139
139
|
const root = this.element.nativeElement;
|
|
140
140
|
root.innerHTML = `
|
|
141
141
|
<div class="mb-3">
|
|
@@ -285,7 +285,9 @@ let RDPProfileSettingsComponent = class RDPProfileSettingsComponent {
|
|
|
285
285
|
}
|
|
286
286
|
o.gateway = gatewayText;
|
|
287
287
|
}
|
|
288
|
-
const { id, account, via, gateway } = this.before;
|
|
288
|
+
const { id, account, user, via, gateway } = this.before;
|
|
289
|
+
// Another profile for the same address keeps what it signs in with there (see RemoteDesktopService.directInUse).
|
|
290
|
+
const users = { user, except: this.profile.id };
|
|
289
291
|
if (!id) {
|
|
290
292
|
return;
|
|
291
293
|
}
|
|
@@ -294,7 +296,7 @@ let RDPProfileSettingsComponent = class RDPProfileSettingsComponent {
|
|
|
294
296
|
// (see RDPProfilesService.deleteProfile). Not for the type's or a group's defaults, which have no id of
|
|
295
297
|
// their own (an empty address is useful there): profiles that name that address keep what is saved for it.
|
|
296
298
|
if (!via && this.profile.id) {
|
|
297
|
-
this.injector.get(desktop_service_1.RemoteDesktopService).forgetDesktop(id, true, `"${this.profile.name}"
|
|
299
|
+
this.injector.get(desktop_service_1.RemoteDesktopService).forgetDesktop(id, true, `"${this.profile.name}"`, users).catch(() => null);
|
|
298
300
|
}
|
|
299
301
|
return;
|
|
300
302
|
}
|
|
@@ -303,13 +305,13 @@ let RDPProfileSettingsComponent = class RDPProfileSettingsComponent {
|
|
|
303
305
|
// it had before included) and certificate were its own; one behind a host shares them with that host's
|
|
304
306
|
// desktop at the same address, so they stay.
|
|
305
307
|
if (!via) {
|
|
306
|
-
this.injector.get(desktop_service_1.RemoteDesktopService).forgetDesktop(id, true, `"${this.profile.name}"
|
|
308
|
+
this.injector.get(desktop_service_1.RemoteDesktopService).forgetDesktop(id, true, `"${this.profile.name}"`, users).catch(() => null);
|
|
307
309
|
}
|
|
308
310
|
return;
|
|
309
311
|
}
|
|
310
312
|
// Its saved password goes with its way there (see desktopEdited): another gateway is asked for again.
|
|
311
313
|
const accountChanged = `${o.username ?? ''}\n${o.domain ?? ''}\n${o.account ?? ''}` !== account;
|
|
312
|
-
this.injector.get(desktop_service_1.RemoteDesktopService).desktopEdited(id, (0, desktops_1.desktopIdOf)(o), accountChanged, !via, { from: gateway, to: o.gateway }).catch(() => null);
|
|
314
|
+
this.injector.get(desktop_service_1.RemoteDesktopService).desktopEdited(id, (0, desktops_1.desktopIdOf)(o), accountChanged, !via, { from: gateway, to: o.gateway }, via ? undefined : { from: user, to: (0, desktops_1.signsInAs)(o), except: this.profile.id }).catch(() => null);
|
|
313
315
|
}
|
|
314
316
|
};
|
|
315
317
|
exports.RDPProfileSettingsComponent = RDPProfileSettingsComponent;
|
|
@@ -406,7 +408,13 @@ let RDPProfilesService = class RDPProfilesService extends tabby_core_1.QuickConn
|
|
|
406
408
|
// its own; one behind a host shares them with that host's desktop at the same address. A profile without an
|
|
407
409
|
// address of its own leads to no desktop of its own: desktopIdOf would name 127.0.0.1:3389 for it.
|
|
408
410
|
if (!profile.options.via && (0, desktops_1.configText)(profile.options.host)) {
|
|
409
|
-
|
|
411
|
+
// Its user as it signed in, its group's defaults included; other profiles for the address keep theirs.
|
|
412
|
+
let options = profile.options;
|
|
413
|
+
try {
|
|
414
|
+
options = this.injector.get(tabby_core_1.ProfilesService).getConfigProxyForProfile(profile).options;
|
|
415
|
+
}
|
|
416
|
+
catch { }
|
|
417
|
+
this.injector.get(desktop_service_1.RemoteDesktopService).forgetDesktop((0, desktops_1.desktopIdOf)(profile.options), true, `"${profile.name}"`, { user: (0, desktops_1.signsInAs)(options), except: profile.id }).catch(() => null);
|
|
410
418
|
}
|
|
411
419
|
}
|
|
412
420
|
};
|
package/dist/signin.js
CHANGED
|
@@ -18,6 +18,7 @@ exports.gatewayScope = gatewayScope;
|
|
|
18
18
|
exports.isFor = isFor;
|
|
19
19
|
exports.forgetCredentialsFor = forgetCredentialsFor;
|
|
20
20
|
exports.moveCredentialsFor = moveCredentialsFor;
|
|
21
|
+
exports.adoptCredentials = adoptCredentials;
|
|
21
22
|
exports.forgetFormerKey = forgetFormerKey;
|
|
22
23
|
exports.askCredentials = askCredentials;
|
|
23
24
|
/**
|
|
@@ -68,8 +69,9 @@ function vaultKey(key) {
|
|
|
68
69
|
return { key };
|
|
69
70
|
}
|
|
70
71
|
function vaultName(key) {
|
|
71
|
-
const { target, desktopId, gateway } = (0, desktops_1.keyParts)(key);
|
|
72
|
-
const
|
|
72
|
+
const { target, desktopId, user, gateway } = (0, desktops_1.keyParts)(key);
|
|
73
|
+
const as = user ? ` as ${user.slice('@user#'.length).replace(/%([0-9A-F]{2})/g, (_, hex) => String.fromCharCode(parseInt(hex, 16)))}` : '';
|
|
74
|
+
const where = `${desktopId}${as}${gateway ? gateway.replace('@gateway#', ' through gateway ') : ''}`;
|
|
73
75
|
return target === 'account' ? `saved account` : target === desktops_1.DIRECT_KEY ? `${where} (direct)` : desktopId ? `${where} behind ${target}` : target;
|
|
74
76
|
}
|
|
75
77
|
// The system keychain can keep a call waiting indefinitely: on Linux, a locked or missing keyring waits for an unlock
|
|
@@ -208,12 +210,6 @@ async function keychainOnce(mark, forgets) {
|
|
|
208
210
|
await keychain(store => store.setPassword(KEYCHAIN_SERVICE, mark, 'done'));
|
|
209
211
|
return true;
|
|
210
212
|
}
|
|
211
|
-
/**
|
|
212
|
-
* Forgets that couldn't be done when they were asked for (see forgetLater), each of one store's part: the Vault's
|
|
213
|
-
* (`inVault`), or the keychain's. Each is done the next time its store is used and can be read (see used, doLater),
|
|
214
|
-
* and what it would forget isn't looked up in that store meanwhile (see withheld). `saved`: keys a password was saved
|
|
215
|
-
* under in that store since, which is a new one, and stays. Kept in this window's memory, for as long as it is open.
|
|
216
|
-
*/
|
|
217
213
|
const later = [];
|
|
218
214
|
let laterRunning = null;
|
|
219
215
|
/**
|
|
@@ -318,20 +314,17 @@ async function loadCredentials(key) {
|
|
|
318
314
|
return null;
|
|
319
315
|
}
|
|
320
316
|
async function loadSaved(key) {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
return found;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
catch { }
|
|
330
|
-
}
|
|
331
|
-
if (withheld(key, false)) {
|
|
317
|
+
return await loadIn(true, key) ?? await loadIn(false, key);
|
|
318
|
+
}
|
|
319
|
+
/** What one store (the Vault while it is on, or with `inVault` false the keychain) has under `key`, or null. */
|
|
320
|
+
async function loadIn(inVault, key) {
|
|
321
|
+
if (withheld(key, inVault)) {
|
|
332
322
|
return null;
|
|
333
323
|
}
|
|
334
324
|
try {
|
|
325
|
+
if (inVault) {
|
|
326
|
+
return vaultOn() ? parseCredentials((await vault.getSecret(exports.VAULT_SECRET_TYPE, vaultKey(key)))?.value) : null;
|
|
327
|
+
}
|
|
335
328
|
return parseCredentials(await keychain(store => store.getPassword(KEYCHAIN_SERVICE, key)));
|
|
336
329
|
}
|
|
337
330
|
catch {
|
|
@@ -532,8 +525,13 @@ async function entriesOf(inVault) {
|
|
|
532
525
|
*/
|
|
533
526
|
async function forgetListed(inVault, entries, forgets, kept) {
|
|
534
527
|
let done = true;
|
|
535
|
-
|
|
536
|
-
|
|
528
|
+
const seen = new Set();
|
|
529
|
+
for (const { account: key, password } of entries) {
|
|
530
|
+
if (seen.has(key)) {
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
seen.add(key);
|
|
534
|
+
if (!kept?.has(key) && forgets(key, password)) {
|
|
537
535
|
try {
|
|
538
536
|
await forgetIn(inVault, key);
|
|
539
537
|
}
|
|
@@ -556,14 +554,17 @@ function gatewayScope(gateway) {
|
|
|
556
554
|
return parsed ? `@gateway#${parsed.host}:${parsed.port}` : '';
|
|
557
555
|
}
|
|
558
556
|
/**
|
|
559
|
-
* Whether a credential key is one of a desktop's saved passwords (see SavedFor)
|
|
560
|
-
*
|
|
561
|
-
* matched; a gateway suffix on the key
|
|
557
|
+
* Whether a credential key is one of a desktop's saved passwords (see SavedFor), with `stored`, the login saved there,
|
|
558
|
+
* where it is at hand (see Forgets). Anchored on the key's parts, so an unrelated key that merely ends in `#<id>` (a
|
|
559
|
+
* gateway pin, or a desktop whose own id is a suffix of another's) isn't matched; a user or gateway suffix on the key
|
|
560
|
+
* doesn't change the id.
|
|
562
561
|
*/
|
|
563
|
-
function isFor(account, desktopId, which) {
|
|
564
|
-
const { target, desktopId: id, gateway } = (0, desktops_1.keyParts)(account);
|
|
562
|
+
function isFor(account, desktopId, which, stored) {
|
|
563
|
+
const { target, desktopId: id, user, gateway } = (0, desktops_1.keyParts)(account);
|
|
564
|
+
const unscoped = user === '' && which.user !== undefined && which.user !== '';
|
|
565
|
+
const owned = !unscoped || !which.owns || stored === undefined || (c => !!c && which.owns(c))(parseCredentials(stored));
|
|
565
566
|
return id === desktopId && (which.direct ? target === desktops_1.DIRECT_KEY : target !== desktops_1.DIRECT_KEY && target !== 'gateway' && target !== 'account') &&
|
|
566
|
-
(which.scope === undefined || gateway === which.scope);
|
|
567
|
+
(which.user === undefined || user === which.user || unscoped) && owned && (which.scope === undefined || gateway === which.scope) && !which.keep?.has(account);
|
|
567
568
|
}
|
|
568
569
|
/**
|
|
569
570
|
* Forgets a desktop's saved passwords (see SavedFor; by default those behind any SSH host, for any gateway), from each
|
|
@@ -573,7 +574,7 @@ function isFor(account, desktopId, which) {
|
|
|
573
574
|
* Returns the stores whose part waits (none, as a rule).
|
|
574
575
|
*/
|
|
575
576
|
async function forgetCredentialsFor(desktopId, which = {}) {
|
|
576
|
-
const forgets = (key) => isFor(key, desktopId, which);
|
|
577
|
+
const forgets = (key, stored) => isFor(key, desktopId, which, stored);
|
|
577
578
|
noteForget(forgets);
|
|
578
579
|
await used();
|
|
579
580
|
const waiting = [];
|
|
@@ -609,7 +610,7 @@ async function forgetCredentialsFor(desktopId, which = {}) {
|
|
|
609
610
|
* certificate stays (see RemoteDesktopService.desktopEdited).
|
|
610
611
|
*/
|
|
611
612
|
async function moveCredentialsFor(fromId, toId, which = {}, known = () => false) {
|
|
612
|
-
const forgets = (key) => isFor(key, fromId, which);
|
|
613
|
+
const forgets = (key, stored) => isFor(key, fromId, which, stored);
|
|
613
614
|
noteForget(forgets);
|
|
614
615
|
await used();
|
|
615
616
|
const stores = [];
|
|
@@ -623,8 +624,8 @@ async function moveCredentialsFor(fromId, toId, which = {}, known = () => false)
|
|
|
623
624
|
for (const { account, password } of entries ?? []) {
|
|
624
625
|
const credentials = parseCredentials(password);
|
|
625
626
|
const { target, gateway } = (0, desktops_1.keyParts)(account);
|
|
626
|
-
if (forgets(account) && credentials) {
|
|
627
|
-
const to = `${target}#${toId}${gateway}`;
|
|
627
|
+
if (forgets(account, password) && credentials) {
|
|
628
|
+
const to = `${target}#${toId}${(0, desktops_1.keyParts)(account).user}${gateway}`;
|
|
628
629
|
const pinned = target === desktops_1.DIRECT_KEY || known(`${target}#${fromId}`);
|
|
629
630
|
try {
|
|
630
631
|
if (!taken.has(to) && !known(`${target}#${toId}`) && pinned && !withheld(account, inVault)) {
|
|
@@ -648,6 +649,30 @@ async function moveCredentialsFor(fromId, toId, which = {}, known = () => false)
|
|
|
648
649
|
}
|
|
649
650
|
return waiting;
|
|
650
651
|
}
|
|
652
|
+
/**
|
|
653
|
+
* A direct desktop's saved password from before passwords were kept for each user at an address (0.5.6): under the
|
|
654
|
+
* address alone (`from`), where any profile for that address found it, whoever it was for. Taken to `to`, the key of
|
|
655
|
+
* the desktop's own user (see userScope), where `ours` says it is for that user, and forgotten at `from` in the store
|
|
656
|
+
* it was found in only: the other store (the keychain beside a synced Vault, say) can hold another user's there. Left
|
|
657
|
+
* where it is otherwise, for the desktop it is for. Null where there is none to take.
|
|
658
|
+
*/
|
|
659
|
+
async function adoptCredentials(from, to, ours) {
|
|
660
|
+
await used();
|
|
661
|
+
for (const inVault of [true, false]) {
|
|
662
|
+
const found = await loadIn(inVault, from);
|
|
663
|
+
if (found && ours(found)) {
|
|
664
|
+
// Forgotten there only once saved here: should the store refuse, it is found there again next time.
|
|
665
|
+
try {
|
|
666
|
+
await saveCredentials(to, found);
|
|
667
|
+
noteForget(key => key === from);
|
|
668
|
+
await forgetIn(inVault, from);
|
|
669
|
+
}
|
|
670
|
+
catch { }
|
|
671
|
+
return found;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
return null;
|
|
675
|
+
}
|
|
651
676
|
/**
|
|
652
677
|
* A target's key changed from `from`, a key no target has any more, whose saved passwords nothing moves (see
|
|
653
678
|
* RemoteTargets.keyChanged): those under it (its own desktop's and those of the desktops behind it, see rekeyed) are
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tabby-rdp",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "Remote desktops in Tabby's SSH tabs: Linux (GNOME) and Windows, through the SSH connection, with clipboard, files and sound. Built on IronRDP.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tabby-plugin",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"!dist/**/*.map",
|
|
30
30
|
"vendor",
|
|
31
31
|
"remote",
|
|
32
|
-
"npm-shrinkwrap.json",
|
|
33
32
|
"LICENSE",
|
|
34
33
|
"CHANGELOG.md",
|
|
35
34
|
"TROUBLESHOOTING.md",
|
|
@@ -45,6 +44,6 @@
|
|
|
45
44
|
"tabbyRdp": {
|
|
46
45
|
"minimumTabbyVersion": "1.0.236",
|
|
47
46
|
"rollbackFloor": "0.5.3",
|
|
48
|
-
"packageFormat":
|
|
47
|
+
"packageFormat": 2
|
|
49
48
|
}
|
|
50
49
|
}
|
package/npm-shrinkwrap.json
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "tabby-rdp",
|
|
3
|
-
"version": "0.5.5",
|
|
4
|
-
"lockfileVersion": 3,
|
|
5
|
-
"requires": true,
|
|
6
|
-
"packages": {
|
|
7
|
-
"": {
|
|
8
|
-
"name": "tabby-rdp",
|
|
9
|
-
"version": "0.5.5",
|
|
10
|
-
"license": "MIT",
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"semver": "7.8.5",
|
|
13
|
-
"ws": "8.21.3"
|
|
14
|
-
},
|
|
15
|
-
"engines": {
|
|
16
|
-
"node": ">=18"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"node_modules/semver": {
|
|
20
|
-
"version": "7.8.5",
|
|
21
|
-
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
|
|
22
|
-
"integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
|
|
23
|
-
"license": "ISC",
|
|
24
|
-
"bin": {
|
|
25
|
-
"semver": "bin/semver.js"
|
|
26
|
-
},
|
|
27
|
-
"engines": {
|
|
28
|
-
"node": ">=10"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"node_modules/ws": {
|
|
32
|
-
"version": "8.21.3",
|
|
33
|
-
"resolved": "https://registry.npmjs.org/ws/-/ws-8.21.3.tgz",
|
|
34
|
-
"integrity": "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw==",
|
|
35
|
-
"license": "MIT",
|
|
36
|
-
"engines": {
|
|
37
|
-
"node": ">=10.0.0"
|
|
38
|
-
},
|
|
39
|
-
"peerDependencies": {
|
|
40
|
-
"bufferutil": "^4.0.1",
|
|
41
|
-
"utf-8-validate": ">=5.0.2"
|
|
42
|
-
},
|
|
43
|
-
"peerDependenciesMeta": {
|
|
44
|
-
"bufferutil": {
|
|
45
|
-
"optional": true
|
|
46
|
-
},
|
|
47
|
-
"utf-8-validate": {
|
|
48
|
-
"optional": true
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|