anyray-connect 0.11.39 → 0.11.40

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.
@@ -1,517 +0,0 @@
1
- /**
2
- * macOS trust store + system-proxy wiring for the device-capture agent.
3
- *
4
- * Two OS-level jobs make apps route through our proxy and trust our leaf certs:
5
- * 1. Add the device CA to the login keychain as a trusted root (one prompt).
6
- * 2. Point the macOS system HTTP(S) proxy at our loopback listener — and
7
- * capture the PRIOR proxy state first, so uninstall fully reverts it.
8
- *
9
- * macOS ONLY in Phase 1 (per RFC 0002a §7): non-darwin returns a clear
10
- * manual-steps result rather than writing something that won't work. Everything
11
- * here is best-effort + fail-open — OS operations never throw up the stack; they
12
- * return { ok, messages } so the caller can warn without aborting an apply and
13
- * the machine is never trapped behind a proxy we couldn't revert.
14
- *
15
- * These modules never touch prompt/response content — they only flip OS
16
- * settings, so the privacy invariant is preserved by construction.
17
- *
18
- * Node built-ins only; the OS tools invoked (`security`, `networksetup`) mirror
19
- * the `launchctl`/`networksetup` posture proxyService.ts already uses.
20
- */
21
- import { homedir, platform } from 'node:os';
22
- import { spawnSync } from 'node:child_process';
23
- import { existsSync } from 'node:fs';
24
- import { readFile, writeFile, mkdir, rm } from 'node:fs/promises';
25
- import { agentDir, DEFAULT_AGENT_PORT, proxyBackupPath, } from './agentPaths.js';
26
- const NON_DARWIN_MESSAGE = 'Automated CA trust + system proxy are macOS-only in this phase; see docs.';
27
- /** The login keychain the CA is trusted into (macOS `.keychain-db` naming). */
28
- const loginKeychain = () => `${homedir()}/Library/Keychains/login.keychain-db`;
29
- // --------------------------------------------------------------------------
30
- // Pure command builders (unit-tested unconditionally).
31
- // --------------------------------------------------------------------------
32
- /**
33
- * Add the device CA to the login keychain as a trusted SSL root.
34
- *
35
- * `-r trustRoot` marks it a trusted root; `-d` scopes to the admin (user) trust
36
- * domain. This is the ONE step that prompts the operator once for their keychain
37
- * password — trusting a root CA is a deliberate admin action, by design.
38
- */
39
- export const buildTrustInstallCmd = (certPath) => ({
40
- cmd: 'security',
41
- args: [
42
- 'add-trusted-cert',
43
- '-d',
44
- '-r',
45
- 'trustRoot',
46
- '-k',
47
- loginKeychain(),
48
- certPath,
49
- ],
50
- });
51
- /** Remove the device CA's trust settings (uninstall). */
52
- export const buildTrustRemoveCmd = (certPath) => ({
53
- cmd: 'security',
54
- args: ['remove-trusted-cert', '-d', certPath],
55
- });
56
- /**
57
- * Point the macOS web + secure-web proxy for `service` at `host:port` and turn
58
- * both on. `networksetup -setwebproxy` sets the endpoint but also enables it;
59
- * we set state explicitly to `on` too so the intent is unambiguous.
60
- */
61
- export const buildProxyEnableCmds = (service, host, port) => {
62
- const p = String(port);
63
- return [
64
- { cmd: 'networksetup', args: ['-setwebproxy', service, host, p] },
65
- { cmd: 'networksetup', args: ['-setsecurewebproxy', service, host, p] },
66
- { cmd: 'networksetup', args: ['-setwebproxystate', service, 'on'] },
67
- { cmd: 'networksetup', args: ['-setsecurewebproxystate', service, 'on'] },
68
- ];
69
- };
70
- /**
71
- * Restore the system proxy EXACTLY to a captured prior state: re-point + enable
72
- * a proxy that was on before, or turn one off that was off before. This is what
73
- * makes uninstall a clean revert instead of just "proxy off".
74
- */
75
- export const buildProxyRestoreCmds = (prev) => {
76
- const cmds = [];
77
- const s = prev.service;
78
- if (prev.webEnabled && prev.webHost) {
79
- cmds.push({
80
- cmd: 'networksetup',
81
- args: ['-setwebproxy', s, prev.webHost, prev.webPort ?? '0'],
82
- });
83
- cmds.push({ cmd: 'networksetup', args: ['-setwebproxystate', s, 'on'] });
84
- }
85
- else {
86
- cmds.push({ cmd: 'networksetup', args: ['-setwebproxystate', s, 'off'] });
87
- }
88
- if (prev.secureEnabled && prev.secureHost) {
89
- cmds.push({
90
- cmd: 'networksetup',
91
- args: ['-setsecurewebproxy', s, prev.secureHost, prev.securePort ?? '0'],
92
- });
93
- cmds.push({
94
- cmd: 'networksetup',
95
- args: ['-setsecurewebproxystate', s, 'on'],
96
- });
97
- }
98
- else {
99
- cmds.push({
100
- cmd: 'networksetup',
101
- args: ['-setsecurewebproxystate', s, 'off'],
102
- });
103
- }
104
- return cmds;
105
- };
106
- /**
107
- * Parse `networksetup -getwebproxy` / `-getsecurewebproxy` output into a
108
- * ProxyState. Each block looks like:
109
- * Enabled: Yes
110
- * Server: proxy.example.com
111
- * Port: 8080
112
- * Authenticated Proxy Enabled: 0
113
- * PURE — no I/O; the runtime wrapper supplies the two captured strings.
114
- */
115
- export const parseProxyState = (service, webShow, secureShow) => {
116
- const field = (block, key) => {
117
- for (const line of block.split('\n')) {
118
- const idx = line.indexOf(':');
119
- if (idx === -1)
120
- continue;
121
- if (line.slice(0, idx).trim().toLowerCase() === key.toLowerCase()) {
122
- return line.slice(idx + 1).trim();
123
- }
124
- }
125
- return undefined;
126
- };
127
- const enabled = (block) => (field(block, 'Enabled') ?? '').toLowerCase() === 'yes';
128
- const nonEmpty = (v) => v && v.length > 0 ? v : undefined;
129
- return {
130
- service,
131
- webEnabled: enabled(webShow),
132
- webHost: nonEmpty(field(webShow, 'Server')),
133
- webPort: nonEmpty(field(webShow, 'Port')),
134
- secureEnabled: enabled(secureShow),
135
- secureHost: nonEmpty(field(secureShow, 'Server')),
136
- securePort: nonEmpty(field(secureShow, 'Port')),
137
- };
138
- };
139
- const isProxyState = (value) => {
140
- if (!value || typeof value !== 'object')
141
- return false;
142
- const state = value;
143
- return (typeof state.service === 'string' &&
144
- typeof state.webEnabled === 'boolean' &&
145
- typeof state.secureEnabled === 'boolean');
146
- };
147
- /** Parse both the current multi-service format and the legacy single state. */
148
- export const parseProxyBackup = (value) => {
149
- if (isProxyState(value)) {
150
- return { version: 2, services: { [value.service]: value } };
151
- }
152
- if (!value || typeof value !== 'object') {
153
- return { version: 2, services: {} };
154
- }
155
- const candidate = value;
156
- const services = {};
157
- if (candidate.services && typeof candidate.services === 'object') {
158
- for (const [name, state] of Object.entries(candidate.services)) {
159
- if (isProxyState(state))
160
- services[name] = state;
161
- }
162
- }
163
- return { version: 2, services };
164
- };
165
- /** Preserve the first genuine pre-Anyray state captured for each service. */
166
- export const addProxyBackup = (backup, state, port) => {
167
- if (!state || proxyPointsAtLoopback(state, port)) {
168
- return backup;
169
- }
170
- const existing = backup.services[state.service];
171
- if (existing && !proxyPointsAtLoopback(existing, port))
172
- return backup;
173
- return {
174
- version: 2,
175
- services: { ...backup.services, [state.service]: state },
176
- };
177
- };
178
- /** Parse enabled network service names from `networksetup` output. */
179
- export const parseNetworkServices = (output) => output
180
- .split('\n')
181
- .slice(1)
182
- .map((line) => line.trim())
183
- .filter((line) => line.length > 0 && !line.startsWith('*'));
184
- /**
185
- * Whether a captured proxy state already points at our own loopback listener on
186
- * `port`. Such a state is NOT a meaningful "prior" to restore — saving it would
187
- * make a later restore re-point the system at our (by then dead) daemon and trap
188
- * the machine offline. Pure + exported for tests.
189
- */
190
- export const proxyPointsAtLoopback = (state, port) => {
191
- if (!state)
192
- return false;
193
- const p = String(port);
194
- return ((state.secureHost === '127.0.0.1' && state.securePort === p) ||
195
- (state.webHost === '127.0.0.1' && state.webPort === p));
196
- };
197
- /**
198
- * Parse the primary interface DEVICE (e.g. `en0`) from `route -n get default`
199
- * output, which contains a line ` interface: en0`. Returns undefined when there
200
- * is no default route (offline) or the line is absent. PURE.
201
- */
202
- export const parsePrimaryInterface = (routeShow) => {
203
- for (const line of routeShow.split('\n')) {
204
- const idx = line.indexOf(':');
205
- if (idx === -1)
206
- continue;
207
- if (line.slice(0, idx).trim().toLowerCase() === 'interface') {
208
- const dev = line.slice(idx + 1).trim();
209
- return dev.length > 0 ? dev : undefined;
210
- }
211
- }
212
- return undefined;
213
- };
214
- /**
215
- * Map a BSD device (e.g. `en0`) to its macOS network-SERVICE name (e.g. `Wi-Fi`)
216
- * from `networksetup -listnetworkserviceorder`, which pairs a `(N) <service
217
- * name>` line with a following `(Hardware Port: <port>, Device: <device>)` line.
218
- * The proxy `networksetup` verbs take the SERVICE NAME, which can differ from the
219
- * hardware-port label (two `USB 10/100/1000 LAN` ports are services `…LAN` and
220
- * `…LAN 2`), so we key on the unique Device and return its paired name. PURE.
221
- */
222
- export const serviceForDevice = (orderShow, device) => {
223
- let lastName;
224
- for (const raw of orderShow.split('\n')) {
225
- const line = raw.trim();
226
- const name = line.match(/^\((?:\d+|\*)\)\s+(.+?)\s*$/);
227
- if (name) {
228
- lastName = name[1].replace(/^\*/, '').trim();
229
- continue;
230
- }
231
- const dev = line.match(/Device:\s*([^),\s]+)/);
232
- if (dev && dev[1] === device)
233
- return lastName;
234
- }
235
- return undefined;
236
- };
237
- // --------------------------------------------------------------------------
238
- // Runtime wrappers (best-effort; macOS only).
239
- // --------------------------------------------------------------------------
240
- const run = (cmd) => {
241
- const r = spawnSync(cmd.cmd, cmd.args, { encoding: 'utf8' });
242
- return { ok: r.status === 0, stdout: r.stdout ?? '' };
243
- };
244
- /**
245
- * The macOS network service to route through our proxy: the service backing the
246
- * DEFAULT ROUTE (the genuinely active interface), NOT merely the first-listed
247
- * service. First-listed pointed the proxy at an inactive USB-Ethernet dongle on
248
- * machines that have one cabled-but-idle, so the app's real (e.g. Wi-Fi) traffic
249
- * bypassed the agent entirely and nothing was captured. Falls back to the first
250
- * ENABLED service, then 'Wi-Fi', when the default route can't be resolved.
251
- */
252
- export const primaryNetworkService = () => {
253
- try {
254
- // 1. Prefer the service whose device carries the default route.
255
- const route = run({ cmd: 'route', args: ['-n', 'get', 'default'] });
256
- const device = route.ok ? parsePrimaryInterface(route.stdout) : undefined;
257
- if (device) {
258
- const order = run({
259
- cmd: 'networksetup',
260
- args: ['-listnetworkserviceorder'],
261
- });
262
- if (order.ok) {
263
- const svc = serviceForDevice(order.stdout, device);
264
- if (svc)
265
- return svc;
266
- }
267
- }
268
- // 2. Fall back to the first ENABLED service (skip header + `*`-disabled).
269
- const { ok, stdout } = run({
270
- cmd: 'networksetup',
271
- args: ['-listallnetworkservices'],
272
- });
273
- if (ok) {
274
- const [service] = parseNetworkServices(stdout);
275
- if (service)
276
- return service;
277
- }
278
- }
279
- catch {
280
- /* fall through to default */
281
- }
282
- return 'Wi-Fi';
283
- };
284
- /** Read the current proxy state for `service` (defaults to the primary). */
285
- export const readProxyState = (service) => {
286
- if (platform() !== 'darwin')
287
- return null;
288
- try {
289
- const svc = service ?? primaryNetworkService();
290
- const web = run({ cmd: 'networksetup', args: ['-getwebproxy', svc] });
291
- const secure = run({
292
- cmd: 'networksetup',
293
- args: ['-getsecurewebproxy', svc],
294
- });
295
- if (!web.ok || !secure.ok)
296
- return null;
297
- return parseProxyState(svc, web.stdout, secure.stdout);
298
- }
299
- catch {
300
- return null;
301
- }
302
- };
303
- /** Trust the device CA (prompts once). Best-effort; macOS only. */
304
- export const installTrust = async (certPath) => {
305
- if (platform() !== 'darwin') {
306
- return { ok: false, messages: [NON_DARWIN_MESSAGE] };
307
- }
308
- try {
309
- const r = run(buildTrustInstallCmd(certPath));
310
- if (!r.ok) {
311
- return {
312
- ok: false,
313
- messages: [
314
- 'Could not add the device CA to the login keychain (the trust prompt may have been cancelled).',
315
- ],
316
- };
317
- }
318
- return {
319
- ok: true,
320
- messages: ['Trusted the device CA in your login keychain.'],
321
- };
322
- }
323
- catch (error) {
324
- return {
325
- ok: false,
326
- messages: [
327
- `Could not trust the device CA: ${error instanceof Error ? error.message : String(error)}`,
328
- ],
329
- };
330
- }
331
- };
332
- /** Untrust the device CA. Best-effort; safe to call when absent. */
333
- export const uninstallTrust = async (certPath) => {
334
- if (platform() !== 'darwin') {
335
- return { ok: false, messages: [NON_DARWIN_MESSAGE] };
336
- }
337
- try {
338
- run(buildTrustRemoveCmd(certPath));
339
- return { ok: true, messages: ['Removed the device CA trust setting.'] };
340
- }
341
- catch {
342
- return { ok: true, messages: [] };
343
- }
344
- };
345
- /**
346
- * Capture the current proxy state, persist it to proxyBackupPath, then point the
347
- * system web + secure-web proxy at 127.0.0.1:port. The backup is what lets
348
- * restoreSystemProxy revert EXACTLY — so we save it before mutating anything.
349
- */
350
- export const enableSystemProxy = async (port) => {
351
- if (platform() !== 'darwin') {
352
- return { ok: false, messages: [NON_DARWIN_MESSAGE], backup: null };
353
- }
354
- try {
355
- const service = primaryNetworkService();
356
- const backup = readProxyState(service);
357
- if (!backup) {
358
- return {
359
- ok: false,
360
- messages: [
361
- `Could not read the current proxy settings for "${service}"; left them unchanged.`,
362
- ],
363
- backup: null,
364
- };
365
- }
366
- // Persist the PRIOR state so uninstall reverts exactly — but only capture a
367
- // genuine prior. Preserve the first state for each service across re-runs,
368
- // but never save a state that's already OUR listener: that would make a
369
- // later restore re-point the system at a dead daemon and trap the machine
370
- // offline. A poisoned legacy entry is replaced by a genuine current state.
371
- let saved = parseProxyBackup(undefined);
372
- if (existsSync(proxyBackupPath())) {
373
- try {
374
- saved = parseProxyBackup(JSON.parse(await readFile(proxyBackupPath(), 'utf8')));
375
- }
376
- catch {
377
- saved = parseProxyBackup(undefined);
378
- }
379
- }
380
- const updated = addProxyBackup(saved, backup, port);
381
- if (updated !== saved) {
382
- await mkdir(agentDir(), { recursive: true });
383
- await writeFile(proxyBackupPath(), JSON.stringify(updated, null, 2), {
384
- mode: 0o600,
385
- });
386
- }
387
- let enabled = true;
388
- for (const cmd of buildProxyEnableCmds(service, '127.0.0.1', port)) {
389
- if (!run(cmd).ok)
390
- enabled = false;
391
- }
392
- return {
393
- ok: enabled,
394
- messages: [
395
- enabled
396
- ? `Pointed the "${service}" system proxy at 127.0.0.1:${port}.`
397
- : `Could not fully enable the "${service}" system proxy.`,
398
- ],
399
- backup,
400
- };
401
- }
402
- catch (error) {
403
- return {
404
- ok: false,
405
- messages: [
406
- `Could not set the system proxy: ${error instanceof Error ? error.message : String(error)}`,
407
- ],
408
- backup: null,
409
- };
410
- }
411
- };
412
- /** Build accurate, non-overwriting diagnostics for proxy restoration. */
413
- export const proxyRestoreMessages = (state) => {
414
- const messages = [];
415
- if (state.failed) {
416
- messages.push('Could not restore every prior proxy setting; kept the remaining backup for retry.');
417
- }
418
- else if (state.restored) {
419
- messages.push('Restored the prior system-proxy settings for every captured network service.');
420
- }
421
- else if (!state.cleanupFailed) {
422
- messages.push('No saved proxy backup found — disabled any stale Anyray system proxy.');
423
- }
424
- if (state.cleanupFailed) {
425
- messages.push('Could not inspect or disable every stale Anyray proxy; manual proxy cleanup may be required.');
426
- }
427
- return messages;
428
- };
429
- /**
430
- * Restore every service in the persisted backup. Also scan all enabled network
431
- * services for orphaned Anyray listeners, which handles interface switches and
432
- * missing legacy backups. Failed prior-state restores stay on disk for retry.
433
- */
434
- export const restoreSystemProxy = async (port = DEFAULT_AGENT_PORT) => {
435
- if (platform() !== 'darwin') {
436
- return { ok: false, messages: [NON_DARWIN_MESSAGE] };
437
- }
438
- try {
439
- let backup = parseProxyBackup(undefined);
440
- try {
441
- backup = parseProxyBackup(JSON.parse(await readFile(proxyBackupPath(), 'utf8')));
442
- }
443
- catch {
444
- backup = parseProxyBackup(undefined);
445
- }
446
- const restoredServices = new Set();
447
- const failedServices = {};
448
- for (const prev of Object.values(backup.services)) {
449
- // Older releases could poison the backup with our own listener. Never
450
- // restore that state; the scan below disables it instead.
451
- if (proxyPointsAtLoopback(prev, port))
452
- continue;
453
- let restored = true;
454
- for (const cmd of buildProxyRestoreCmds(prev)) {
455
- if (!run(cmd).ok)
456
- restored = false;
457
- }
458
- if (restored)
459
- restoredServices.add(prev.service);
460
- else
461
- failedServices[prev.service] = prev;
462
- }
463
- // An interface switch can leave a second service pointing at the agent.
464
- // Scan every enabled service and disable only orphaned Anyray listeners.
465
- const listed = run({
466
- cmd: 'networksetup',
467
- args: ['-listallnetworkservices'],
468
- });
469
- const listedServices = listed.ok
470
- ? parseNetworkServices(listed.stdout)
471
- : [];
472
- const services = listedServices.length > 0 ? listedServices : [primaryNetworkService()];
473
- let cleanupFailed = false;
474
- for (const service of services) {
475
- if (restoredServices.has(service))
476
- continue;
477
- const current = readProxyState(service);
478
- if (!current) {
479
- cleanupFailed = true;
480
- continue;
481
- }
482
- if (!proxyPointsAtLoopback(current, port))
483
- continue;
484
- const web = run({
485
- cmd: 'networksetup',
486
- args: ['-setwebproxystate', service, 'off'],
487
- });
488
- const secure = run({
489
- cmd: 'networksetup',
490
- args: ['-setsecurewebproxystate', service, 'off'],
491
- });
492
- if (!web.ok || !secure.ok)
493
- cleanupFailed = true;
494
- }
495
- if (Object.keys(failedServices).length > 0) {
496
- await writeFile(proxyBackupPath(), JSON.stringify({ version: 2, services: failedServices }, null, 2), { mode: 0o600 });
497
- }
498
- else {
499
- await rm(proxyBackupPath(), { force: true });
500
- }
501
- const restored = restoredServices.size > 0;
502
- const failed = Object.keys(failedServices).length > 0;
503
- return {
504
- ok: !failed && !cleanupFailed,
505
- messages: proxyRestoreMessages({ restored, failed, cleanupFailed }),
506
- };
507
- }
508
- catch (error) {
509
- return {
510
- ok: false,
511
- messages: [
512
- `Could not restore the system proxy: ${error instanceof Error ? error.message : String(error)}`,
513
- ],
514
- };
515
- }
516
- };
517
- //# sourceMappingURL=agentTrust.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agentTrust.js","sourceRoot":"","sources":["../../src/util/agentTrust.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AA6BzB,MAAM,kBAAkB,GACtB,2EAA2E,CAAC;AAE9E,+EAA+E;AAC/E,MAAM,aAAa,GAAG,GAAW,EAAE,CACjC,GAAG,OAAO,EAAE,sCAAsC,CAAC;AAErD,6EAA6E;AAC7E,uDAAuD;AACvD,6EAA6E;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