@remoteshell/device 0.1.0-beta.1 → 0.1.0-beta.10

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.
Files changed (90) hide show
  1. package/LICENSE +26 -0
  2. package/NOTICE +20 -0
  3. package/bin/dev-agent-client.mjs +228 -0
  4. package/bin/dev-agent-runner.mjs +60 -0
  5. package/bin/dev-api-client.mjs +31 -0
  6. package/bin/dev-auto-worker.mjs +25 -0
  7. package/bin/dev-browser-open.mjs +12 -0
  8. package/bin/dev-dogfood-read.mjs +3 -0
  9. package/bin/dev-heartbeat-service.mjs +77 -0
  10. package/bin/dev-pairing-client.mjs +63 -0
  11. package/bin/dev-secrets.mjs +33 -0
  12. package/bin/dev-setup-recovery.mjs +34 -0
  13. package/bin/dev-signer-pin.mjs +22 -0
  14. package/bin/device.mjs +254 -9
  15. package/bin/direct-npx-runtime.mjs +150 -0
  16. package/bin/install-acquire.mjs +89 -0
  17. package/bin/install-integrity.mjs +74 -0
  18. package/bin/install-plan.mjs +43 -0
  19. package/bin/native-path-contract.mjs +23 -0
  20. package/bin/remoteshell-device-install.cmd +17 -0
  21. package/bin/remoteshell-device-install.ps1 +17 -0
  22. package/bin/remoteshell-device-install.sh +15 -0
  23. package/bin/remoteshell-device-preflight.cmd +10 -0
  24. package/bin/remoteshell-device-preflight.ps1 +10 -0
  25. package/bin/remoteshell-easy-diagnose.ps1 +32 -0
  26. package/bin/remoteshell-easy-install.ps1 +292 -0
  27. package/bin/remoteshell-easy-install.sh +71 -0
  28. package/bin/remoteshell-easy-uninstall.ps1 +128 -0
  29. package/bin/windows-acl-wmi-client.mjs +50 -0
  30. package/bin/windows-acl-wmi.js +43 -0
  31. package/bin/windows-credential-boundary.mjs +113 -0
  32. package/bin/windows-direct-autostart-runner.mjs +50 -0
  33. package/bin/windows-direct-autostart.mjs +110 -0
  34. package/bin/windows-install-layout.mjs +28 -0
  35. package/bin/windows-native-installer.mjs +91 -0
  36. package/bin/windows-private-store.mjs +176 -0
  37. package/bin/windows-user-lifecycle.mjs +34 -0
  38. package/npm-shrinkwrap.json +8591 -0
  39. package/package.json +14 -5
  40. package/shared/lib/bounded-search-contract.mjs +5 -0
  41. package/shared/lib/dc-generic-policy.mjs +102 -0
  42. package/shared/lib/dc-relay-contract.mjs +42 -0
  43. package/shared/lib/dc-tool-catalog.mjs +67 -0
  44. package/shared/lib/dev-dc-relay-contract.mjs +20 -0
  45. package/shared/lib/dev-paged-output.mjs +32 -0
  46. package/shared/lib/dev-root-exclusions.mjs +56 -0
  47. package/{src/common → shared/lib}/synthetic-write-policy.mjs +0 -1
  48. package/src/config/l2-dev-oci-credential.mjs +39 -0
  49. package/src/config/p2-private-credential.mjs +15 -0
  50. package/src/connection/dev-dogfood-processes.mjs +25 -0
  51. package/src/connection/dev-dogfood-read.mjs +64 -0
  52. package/src/connection/dev-dogfood-task.mjs +113 -0
  53. package/src/connection/dev-dogfood-write.mjs +62 -0
  54. package/src/connection/dev-file-task.mjs +119 -0
  55. package/src/connection/dev-r4-file-task.mjs +56 -0
  56. package/src/connection/dev-read-tools.mjs +134 -0
  57. package/src/connection/dev-root-scopes.mjs +82 -0
  58. package/src/{device-agent → core}/c1-supervisor.mjs +9 -7
  59. package/src/{device-agent → core}/c1-worker.mjs +7 -7
  60. package/src/dc/dc-access-readiness.mjs +31 -0
  61. package/src/dc/dev-dc-relay.mjs +47 -0
  62. package/src/device-agent/main.mjs +1 -230
  63. package/src/gateway-keepalive.mjs +73 -0
  64. package/src/main.mjs +436 -0
  65. package/src/{common → policy}/bounded-search-adapter.mjs +2 -3
  66. package/src/{common → policy}/isolated-read-adapter.mjs +1 -1
  67. package/src/{common → policy}/isolated-read-mount.mjs +1 -1
  68. package/src/{common → policy}/synthetic-auxiliary-adapter.mjs +1 -1
  69. package/src/{common → policy}/synthetic-file-adapter.mjs +1 -1
  70. package/src/{common → policy}/synthetic-file-transaction.mjs +1 -1
  71. package/src/{common → policy}/synthetic-write-adapter.mjs +2 -3
  72. /package/{src/common → shared/lib}/bounded-search-policy.mjs +0 -0
  73. /package/{src/common → shared/lib}/config.mjs +0 -0
  74. /package/{src/common → shared/lib}/contracts.mjs +0 -0
  75. /package/{src/common → shared/lib}/errors.mjs +0 -0
  76. /package/{src/common → shared/lib}/events.mjs +0 -0
  77. /package/{src/common → shared/lib}/execution-policy.mjs +0 -0
  78. /package/{src/common → shared/lib}/isolated-read-boundary.mjs +0 -0
  79. /package/{src/common → shared/lib}/isolated-read-policy.mjs +0 -0
  80. /package/{src/common → shared/lib}/lifecycle-events.mjs +0 -0
  81. /package/{src/common → shared/lib}/runtime-timing.mjs +0 -0
  82. /package/{src/common → shared/lib}/synthetic-auxiliary-policy.mjs +0 -0
  83. /package/{src/common → shared/lib}/tool-registry.mjs +0 -0
  84. /package/src/{device-agent → core}/c1-dc-transport.mjs +0 -0
  85. /package/src/{device-agent → core}/c1-startup.mjs +0 -0
  86. /package/src/{device-agent → core}/fixture.txt +0 -0
  87. /package/src/{common → policy}/synthetic-write-mount.mjs +0 -0
  88. /package/src/{common → policy}/verified-bounded-search.mjs +0 -0
  89. /package/src/{common → policy}/verified-isolated-read.mjs +0 -0
  90. /package/src/{common → policy}/verified-synthetic-write.mjs +0 -0
@@ -0,0 +1,128 @@
1
+ # RemoteShell Windows x64 user-local EasyInstall uninstall.
2
+ # Independent of network, Google identity, RS server/device revoke and other OS accounts.
3
+ param([switch]$CheckOnly)
4
+ $ErrorActionPreference='Stop'
5
+ $phase='PRECHECK'
6
+ function Demand([bool]$ok,[string]$reason){if(-not $ok){throw $reason}}
7
+ function SafeDir([string]$path){
8
+ if(Test-Path -LiteralPath $path){
9
+ $f=Get-Item -LiteralPath $path -Force
10
+ Demand ($f.PSIsContainer -and -not ($f.Attributes -band [IO.FileAttributes]::ReparsePoint)) 'UNSAFE_DIRECTORY_DENIED'
11
+ }
12
+ }
13
+ $homePath=[Environment]::GetFolderPath('UserProfile')
14
+ $localPath=[Environment]::GetFolderPath('LocalApplicationData')
15
+ $root=Join-Path $localPath 'RemoteShell'
16
+ $agent=Join-Path $root 'DeviceAgent'
17
+ $install=Join-Path $agent 'install'
18
+ $credentials=Join-Path $agent 'dev-credentials'
19
+ $easy=Join-Path $root 'EasyInstall'
20
+ $privateRuntime=Join-Path $easy 'runtime-v22'
21
+ $stage=Join-Path $easy 'stage'
22
+ $node=Join-Path $privateRuntime 'node.exe'
23
+ $cli=Join-Path $install 'node_modules\@remoteshell\device\bin\device.mjs'
24
+ $stageCli=Join-Path $stage 'node_modules\@remoteshell\device\bin\device.mjs'
25
+ $launcher=Join-Path $easy 'agent-autostart.vbs'
26
+ $wscript=Join-Path $env:WINDIR 'System32\wscript.exe'
27
+ $runKey='HKCU:\Software\Microsoft\Windows\CurrentVersion\Run'
28
+ $runName='RemoteShell-DEV-User-Agent'
29
+ $taskName='RemoteShell Device Agent (User)'
30
+ $reportDir=Join-Path $root 'UninstallLogs'
31
+ $report=Join-Path $reportDir 'easy-uninstall-result.txt'
32
+ function Report([string]$value){
33
+ Write-Host $value
34
+ Add-Content -LiteralPath $report -Value $value -Encoding UTF8
35
+ }
36
+ try {
37
+ $identity=[Security.Principal.WindowsIdentity]::GetCurrent()
38
+ $principal=New-Object Security.Principal.WindowsPrincipal($identity)
39
+ Demand ([Environment]::Is64BitOperatingSystem) 'WINDOWS_X64_REQUIRED'
40
+ Demand (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) 'DO_NOT_RUN_AS_ADMIN'
41
+ Demand ($homePath -and $localPath -and $localPath -ieq (Join-Path $homePath 'AppData\Local')) 'FOREIGN_PROFILE_DENIED'
42
+ foreach($d in @($homePath,(Join-Path $homePath 'AppData'),$localPath,$root,$agent,$install,$credentials,$easy,$privateRuntime,$stage)){SafeDir $d}
43
+ # Do not delete any other product directory, even under the same owner.
44
+ $run=Get-ItemProperty -LiteralPath $runKey -Name $runName -ErrorAction SilentlyContinue
45
+ $expected=('"'+$node+'" "'+$cli+'" dev-heartbeat')
46
+ $legacyStage=('"'+$node+'" "'+$stageCli+'" dev-heartbeat')
47
+ $hiddenStartup=('"'+$wscript+'" "'+$launcher+'"')
48
+ if($run){Demand ($run.$runName -ceq $expected -or $run.$runName -ceq $legacyStage -or $run.$runName -ceq $hiddenStartup) 'FOREIGN_AUTOSTART_DENIED'}
49
+ $task=Get-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue
50
+ if($task){
51
+ $action=@($task.Actions)
52
+ Demand ($action.Count -eq 1) 'FOREIGN_TASK_DENIED'
53
+ Demand ($action[0].Execute -ieq $node -and $action[0].Arguments -like ('*'+$cli+'*dev-heartbeat*')) 'FOREIGN_TASK_DENIED'
54
+ Demand ($task.Principal.UserId -ieq $identity.Name -or $task.Principal.UserId -eq $identity.User.Value) 'FOREIGN_TASK_PRINCIPAL_DENIED'
55
+ }
56
+ $workers=@(Get-CimInstance Win32_Process -Filter "Name='node.exe'"|Where-Object {
57
+ $_.ExecutablePath -ieq $node -and ($_.CommandLine -like ('*'+$install+'*') -or $_.CommandLine -like ('*'+$stageCli+'*'))
58
+ })
59
+ foreach($w in $workers){
60
+ $owner=Invoke-CimMethod -InputObject $w -MethodName GetOwner
61
+ Demand ($owner.User -ieq $identity.Name.Split('\')[-1]) 'FOREIGN_PROCESS_DENIED'
62
+ }
63
+ if(Test-Path $install){
64
+ $receipt=Join-Path $install 'receipt.json'
65
+ Demand (Test-Path -LiteralPath $receipt -PathType Leaf) 'RECEIPT_MISSING'
66
+ $r=Get-Content -LiteralPath $receipt -Raw|ConvertFrom-Json
67
+ Demand ($r.schema -eq 1 -and $r.distribution -eq 'synthetic-private' -and $r.version -match '^0\.1\.0(-beta\.[1-9][0-9]*)?$') 'FOREIGN_INSTALL_DENIED'
68
+ $pkg=Join-Path $install 'node_modules\@remoteshell\device\package.json'
69
+ Demand (Test-Path -LiteralPath $pkg -PathType Leaf) 'FOREIGN_INSTALL_DENIED'
70
+ $metadata=Get-Content -LiteralPath $pkg -Raw | ConvertFrom-Json
71
+ Demand ($metadata.name -eq '@remoteshell/device' -and $metadata.version -eq $r.version) 'FOREIGN_INSTALL_DENIED'
72
+ }
73
+ if(Test-Path $credentials){
74
+ $files=@(Get-ChildItem -LiteralPath $credentials -Force)
75
+ foreach($f in $files){
76
+ Demand (-not $f.PSIsContainer -and -not ($f.Attributes -band [IO.FileAttributes]::ReparsePoint)) 'FOREIGN_CREDENTIAL_ENTRY'
77
+ Demand ($f.Name -eq 'device.json' -or $f.Name -eq 'device-key.pem' -or $f.Name -match '^device\.json\.tmp-[a-z0-9]{8,64}$') 'FOREIGN_CREDENTIAL_FILE'
78
+ }
79
+ }
80
+ if($CheckOnly){
81
+ Write-Host ('EASY_UNINSTALL_CHECK_PASS user='+$identity.Name+
82
+ ' workers='+$workers.Count+' installed='+(Test-Path $install)+
83
+ ' credentials='+(Test-Path $credentials))
84
+ exit 0
85
+ }
86
+ if(-not (Test-Path -LiteralPath $reportDir)){New-Item -Path $reportDir -ItemType Directory -Force|Out-Null}
87
+ Set-Content -LiteralPath $report -Value ('RemoteShell easy uninstall '+(Get-Date -Format o)+' user='+$identity.Name) -Encoding UTF8
88
+ $phase='STOP'
89
+ $order=@($workers|Sort-Object @{Expression={if($_.CommandLine -like '*desktop-commander*'){0}elseif($_.CommandLine -like '*main.mjs*'){1}else{2}}})
90
+ foreach($w in $order){Stop-Process -Id $w.ProcessId -Force -ErrorAction Stop}
91
+ Report ('AGENT_PROCESSES_STOPPED='+$order.Count)
92
+ $phase='AUTOSTART'
93
+ if($task){Unregister-ScheduledTask -TaskName $taskName -Confirm:$false -ErrorAction Stop}
94
+ if($run){Remove-ItemProperty -LiteralPath $runKey -Name $runName -ErrorAction Stop}
95
+ # Foreground-only installation intentionally has no autostart registration.
96
+ # Treat absence as a valid clean uninstall, not a failed removal.
97
+ if($task -or $run){Report 'USER_AUTOSTART_REMOVED=PASS'}
98
+ else{Report 'USER_AUTOSTART_NOT_INSTALLED=PASS'}
99
+ $phase='PACKAGE'
100
+ if(Test-Path $install){
101
+ # Delete only a receipt-verified private Agent installation; CLI is not
102
+ # trusted as sole cleanup path because uninstall must work with no runtime.
103
+ Remove-Item -LiteralPath $install -Recurse -Force -ErrorAction Stop
104
+ }
105
+ Report 'AGENT_PACKAGE_REMOVED=PASS'
106
+ $phase='CREDENTIALS'
107
+ if(Test-Path $credentials){Remove-Item -LiteralPath $credentials -Recurse -Force -ErrorAction Stop}
108
+ Report 'LOCAL_DEVICE_CREDENTIALS_REMOVED=PASS'
109
+ $phase='STAGE'
110
+ if(Test-Path $stage){Remove-Item -LiteralPath $stage -Recurse -Force -ErrorAction Stop}
111
+ Report 'PRIVATE_STAGE_REMOVED=PASS'
112
+ $phase='LAUNCHER'
113
+ if(Test-Path -LiteralPath $launcher){Remove-Item -LiteralPath $launcher -Force -ErrorAction Stop}
114
+ $phase='RUNTIME'
115
+ if(Test-Path $privateRuntime){Remove-Item -LiteralPath $privateRuntime -Recurse -Force -ErrorAction Stop}
116
+ Report 'PRIVATE_RUNTIME_REMOVED=PASS'
117
+ $phase='VERIFY'
118
+ Demand (-not(Test-Path $install) -and -not(Test-Path $credentials) -and -not(Test-Path $stage) -and -not(Test-Path $privateRuntime)) 'RESIDUAL_FILES_FOUND'
119
+ $remaining=@(Get-CimInstance Win32_Process -Filter "Name='node.exe'"|Where-Object {($_.CommandLine -like ('*'+$install+'*') -or $_.CommandLine -like ('*'+$stageCli+'*'))})
120
+ Demand ($remaining.Count -eq 0) 'RESIDUAL_WORKER_FOUND'
121
+ Report 'RESULT=LOCAL_UNINSTALL_PASS; SERVER_DEVICE_REGISTRATION_NOT_CHANGED'
122
+ Write-Host 'Server device registration may remain offline. Remove it separately under RemoteShell > My Devices if desired.'
123
+ }catch {
124
+ $message='RESULT=FAIL; PHASE='+$phase+'; ERROR='+$_.Exception.Message
125
+ Write-Host $message
126
+ if(Test-Path -LiteralPath $reportDir){Add-Content -LiteralPath $report -Value $message -Encoding UTF8}
127
+ exit 1
128
+ }
@@ -0,0 +1,50 @@
1
+ // #327 Windows owner/DACL query without starting nested PowerShell.
2
+ // Uses built-in cscript/WMI under the caller's OS token; read-only, fail closed.
3
+ import {spawnSync} from 'node:child_process';
4
+ import {win32} from 'node:path';
5
+ import {fileURLToPath} from 'node:url';
6
+ const DENY=()=>{throw Error('DEVICE_WINDOWS_ACL_DENIED');};
7
+ const SID=/^S-1-\d+(?:-\d+){1,15}$/;
8
+ export function parseWmiAclRows(output,user,{directory=false}={}){
9
+ if(typeof output!=='string'||output.length>8192||!SID.test(user||''))DENY();
10
+ const expected=directory?['file']:['parent','file'];
11
+ const lines=output.trim().split(/\r?\n/),result={};
12
+ let index=0;
13
+ for(const name of expected){
14
+ if(lines[index++]!==`begin=${name}`)DENY();
15
+ const ownerLine=lines[index++];
16
+ if(!ownerLine?.startsWith('owner='))DENY();
17
+ const owner=ownerLine.slice(6);
18
+ if(!SID.test(owner))DENY();
19
+ const protectedLine=lines[index++];
20
+ if(protectedLine!=='protected=true'&&protectedLine!=='protected=false')DENY();
21
+ const rules=[];
22
+ while(index<lines.length&&lines[index].startsWith('ace=')){
23
+ const match=/^ace=(S-1-\d+(?:-\d+){1,15}),(true|false),([01]),(\d{1,12})$/.exec(lines[index++]);
24
+ if(!match)DENY();
25
+ const rights=Number(match[4]);
26
+ if(!Number.isSafeInteger(rights))DENY();
27
+ rules.push({sid:match[1],inherited:match[2]==='true',
28
+ access:match[3]==='0'?'Allow':'Deny',rights});
29
+ if(rules.length>32)DENY();
30
+ }
31
+ if(lines[index++]!==`end=${name}`||rules.length===0)DENY();
32
+ result[name]={user,owner,protected:protectedLine==='protected=true',rules};
33
+ }
34
+ if(index!==lines.length)DENY();
35
+ return result;
36
+ }
37
+ export function inspectWmiAcl(target,{directory=false,run=spawnSync}={}){
38
+ const root=process.env.SystemRoot||'C:\\Windows';
39
+ const call=(name,args,timeout)=>run(win32.join(root,'System32',name),args,{
40
+ shell:false,windowsHide:true,encoding:'utf8',timeout,maxBuffer:8192,
41
+ stdio:['ignore','pipe','pipe']});
42
+ const who=call('whoami.exe',['/user','/fo','csv','/nh'],10000);
43
+ if(who.error||who.signal||who.status!==0)DENY();
44
+ const user=String(who.stdout||'').match(/S-1-\d+(?:-\d+){1,15}/)?.[0];
45
+ if(!SID.test(user||''))DENY();
46
+ const script=fileURLToPath(new URL('./windows-acl-wmi.js',import.meta.url));
47
+ const probe=call('cscript.exe',['//nologo',script,target,directory?'1':'0'],25000);
48
+ if(probe.error||probe.signal||probe.status!==0)DENY();
49
+ return parseWmiAclRows(probe.stdout,user,{directory});
50
+ }
@@ -0,0 +1,43 @@
1
+ // Windows JScript Host WMI ACL snapshot. Read-only; no ACL repair.
2
+ // Executes under the current Windows user token via cscript.exe.
3
+ try {
4
+ var target = String(WScript.Arguments.Item(0));
5
+ var directory = String(WScript.Arguments.Item(1)) === '1';
6
+ if (target.length > 1024 || !/^[A-Za-z]:\\/.test(target) ||
7
+ /['"\r\n]/.test(target) || (WScript.Arguments.Length !== 2))
8
+ throw new Error('PATH_DENIED');
9
+ var svc = new ActiveXObject('WbemScripting.SWbemLocator').ConnectServer('.', 'root\\cimv2');
10
+ var fso = new ActiveXObject('Scripting.FileSystemObject');
11
+ function inspect(path, label) {
12
+ var q = "SELECT * FROM Win32_LogicalFileSecuritySetting WHERE Path='" +
13
+ path.replace(/\\/g, '\\\\') + "'";
14
+ var found = new Enumerator(svc.ExecQuery(q)), count = 0, record = null;
15
+ for (; !found.atEnd(); found.moveNext()) { record = found.item(); count++; }
16
+ if (count !== 1) throw new Error('MATCH_DENIED');
17
+ var result = record.ExecMethod_('GetSecurityDescriptor');
18
+ if (result.Properties_.Item('ReturnValue').Value !== 0)
19
+ throw new Error('ACCESS_DENIED');
20
+ var descriptor = result.Properties_.Item('Descriptor').Value;
21
+ var owner = descriptor.Properties_.Item('Owner').Value.Properties_.Item('SIDString').Value;
22
+ var flags = descriptor.Properties_.Item('ControlFlags').Value;
23
+ var list = descriptor.Properties_.Item('DACL').Value.toArray();
24
+ if (list.length < 1 || list.length > 32) throw new Error('ACE_COUNT_DENIED');
25
+ WScript.Echo('begin=' + label);
26
+ WScript.Echo('owner=' + owner);
27
+ WScript.Echo('protected=' + ((flags & 4096) !== 0));
28
+ for (var i = 0; i < list.length; i++) {
29
+ var ace = list[i];
30
+ var sid = ace.Properties_.Item('Trustee').Value.Properties_.Item('SIDString').Value;
31
+ WScript.Echo('ace=' + sid + ',' +
32
+ ((ace.Properties_.Item('AceFlags').Value & 16) !== 0) + ',' +
33
+ ace.Properties_.Item('AceType').Value + ',' +
34
+ ace.Properties_.Item('AccessMask').Value);
35
+ }
36
+ WScript.Echo('end=' + label);
37
+ }
38
+ if (!directory) inspect(fso.GetParentFolderName(target), 'parent');
39
+ inspect(target, 'file');
40
+ } catch (error) {
41
+ WScript.Echo('DEVICE_WINDOWS_ACL_DENIED');
42
+ WScript.Quit(1);
43
+ }
@@ -0,0 +1,113 @@
1
+ // #310 Native Windows credential ACL assessment. Read only; no ACL repair or
2
+ // privilege escalation. PowerShell receives the path in an environment value,
3
+ // not in a shell argument. Windows worker still remains gated separately.
4
+ import {spawnSync} from 'node:child_process';
5
+ import {lstatSync,realpathSync} from 'node:fs';
6
+ import {win32} from 'node:path';
7
+ import {canonicalWindowsLocalFile,isWindowsChildPath} from './native-path-contract.mjs';
8
+ import {inspectWmiAcl} from './windows-acl-wmi-client.mjs';
9
+ const DENY=()=>{throw Error('DEVICE_WINDOWS_ACL_DENIED');};
10
+ const SID=/^S-1-\d+(?:-\d+){1,15}$/;
11
+ const SYSTEM='S-1-5-18';
12
+ const ADMINISTRATORS='S-1-5-32-544';
13
+ // PowerShell Get-Acl must run under the actual Windows user profile. A
14
+ // SystemRoot-only environment makes initialization intermittently time out
15
+ // on Windows Task Scheduler. Pass only OS/user environment essentials, not
16
+ // PATH, PSModulePath, executable names or arbitrary parent environment.
17
+ function aclChildEnv(systemRoot,target,directory){
18
+ const e={SystemRoot:systemRoot,WINDIR:systemRoot,
19
+ RS310_ACL_TARGET:target,RS310_ACL_DIR:directory?'1':'0'};
20
+ for(const key of ['USERPROFILE','APPDATA','LOCALAPPDATA','TEMP','TMP','HOMEDRIVE','HOMEPATH','ProgramData']){
21
+ const v=process.env[key];
22
+ if(typeof v==='string'&&v.length>0&&v.length<4096)e[key]=v;
23
+ }
24
+ return e;
25
+ }
26
+ const SCRIPT=[
27
+ '$ErrorActionPreference = "Stop"',
28
+ '$identity = [System.Security.Principal.WindowsIdentity]::GetCurrent()',
29
+ 'function Read-PrivateAcl([string]$target) {',
30
+ ' $acl = Get-Acl -LiteralPath $target',
31
+ ' $owner = $acl.GetOwner([System.Security.Principal.SecurityIdentifier]).Value',
32
+ ' $rules = @($acl.GetAccessRules($true,$true,[System.Security.Principal.SecurityIdentifier]) | ForEach-Object {',
33
+ ' @{ sid = $_.IdentityReference.Value; inherited = $_.IsInherited; access = $_.AccessControlType.ToString(); rights = [int64]$_.FileSystemRights }',
34
+ ' })',
35
+ ' return @{ user = $identity.User.Value; owner = $owner; protected = $acl.AreAccessRulesProtected; rules = $rules }',
36
+ '}',
37
+ '$file = $env:RS310_ACL_TARGET',
38
+ '$parent = if ($env:RS310_ACL_DIR -eq "1") { $file } else { Split-Path -Parent $file }',
39
+ '@{ file = (Read-PrivateAcl $file); parent = (Read-PrivateAcl $parent) } | ConvertTo-Json -Compress -Depth 6'
40
+ ].join('; ');
41
+ export function validateWindowsAclSnapshot(snapshot){
42
+ const {user,owner,protected:aclProtected,rules}=snapshot||{};
43
+ if(!SID.test(user||'')||owner!==user||aclProtected!==true||!Array.isArray(rules)||rules.length<1)DENY();
44
+ let ownerAllowed=false;
45
+ for(const rule of rules){
46
+ if(!SID.test(rule?.sid||'')||rule.inherited!==false||rule.access!=='Allow'||
47
+ !Number.isSafeInteger(rule.rights)||rule.rights<0)DENY();
48
+ if(![user,SYSTEM,ADMINISTRATORS].includes(rule.sid))DENY();
49
+ if(rule.sid===user)ownerAllowed=true;
50
+ }
51
+ if(!ownerAllowed)DENY();
52
+ return Object.freeze({ownerVerified:true,restrictedAcl:true,credentialReadiness:'acl-only'});
53
+ }
54
+ export function inspectWindowsCredentialAcl({
55
+ file,home,os=process.platform,lstat=lstatSync,realpath=realpathSync,
56
+ run=spawnSync
57
+ }={}){
58
+ if(os!=='win32')DENY();
59
+ try{
60
+ canonicalWindowsLocalFile(home);
61
+ isWindowsChildPath(file,home);
62
+ const parent=win32.dirname(file);
63
+ canonicalWindowsLocalFile(parent);
64
+ const root=lstat(home),dir=lstat(parent),stat=lstat(file);
65
+ if(!root.isDirectory()||root.isSymbolicLink()||
66
+ !dir.isDirectory()||dir.isSymbolicLink()||
67
+ !stat.isFile()||stat.isSymbolicLink()||
68
+ stat.nlink!==1||stat.size<1||stat.size>8192)DENY();
69
+ if(win32.normalize(realpath(file)).toLowerCase()!==file.toLowerCase()||
70
+ win32.normalize(realpath(parent)).toLowerCase()!==parent.toLowerCase())DENY();
71
+ if(run===spawnSync){
72
+ const snapshot=inspectWmiAcl(file);
73
+ validateWindowsAclSnapshot(snapshot.parent);
74
+ return validateWindowsAclSnapshot(snapshot.file);
75
+ }
76
+ const systemRoot=process.env.SystemRoot||'C:\\Windows';
77
+ canonicalWindowsLocalFile(systemRoot+'\\System32');
78
+ const powerShell=win32.join(systemRoot,'System32','WindowsPowerShell','v1.0','powershell.exe');
79
+ const child=run(powerShell,['-NoProfile','-NonInteractive','-EncodedCommand',
80
+ Buffer.from(SCRIPT,'utf16le').toString('base64')],{
81
+ shell:false,windowsHide:true,encoding:'utf8',timeout:20000,maxBuffer:16384,
82
+ env:aclChildEnv(systemRoot,file,false),
83
+ stdio:'pipe'
84
+ });
85
+ if(child.error||child.signal||child.status!==0||typeof child.stdout!=='string'||child.stdout.length>8192)DENY();
86
+ const snapshot=JSON.parse(child.stdout);
87
+ validateWindowsAclSnapshot(snapshot?.parent);
88
+ return validateWindowsAclSnapshot(snapshot?.file);
89
+ }catch{DENY();}
90
+ }
91
+
92
+ // Verify one directory's own protected ACL without creating any files.
93
+ export function inspectWindowsPrivateDirectoryAcl({directory,home,os=process.platform,
94
+ lstat=lstatSync,realpath=realpathSync,run=spawnSync}={}){
95
+ if(os!=='win32')DENY();
96
+ try{
97
+ canonicalWindowsLocalFile(home);
98
+ isWindowsChildPath(directory,home);
99
+ const st=lstat(directory);
100
+ if(!st.isDirectory()||st.isSymbolicLink()||
101
+ win32.normalize(realpath(directory)).toLowerCase()!==directory.toLowerCase())DENY();
102
+ if(run===spawnSync)return validateWindowsAclSnapshot(inspectWmiAcl(directory,{directory:true}).file);
103
+ const systemRoot=process.env.SystemRoot||'C:\\Windows';
104
+ const ps=win32.join(systemRoot,'System32','WindowsPowerShell','v1.0','powershell.exe');
105
+ const child=run(ps,['-NoProfile','-NonInteractive','-EncodedCommand',
106
+ Buffer.from(SCRIPT,'utf16le').toString('base64')],{
107
+ shell:false,windowsHide:true,encoding:'utf8',timeout:20000,maxBuffer:16384,
108
+ env:aclChildEnv(systemRoot,directory,true),stdio:'pipe'
109
+ });
110
+ if(child.error||child.signal||child.status!==0||typeof child.stdout!=='string'||child.stdout.length>8192)DENY();
111
+ return validateWindowsAclSnapshot(JSON.parse(child.stdout)?.file);
112
+ }catch{DENY();}
113
+ }
@@ -0,0 +1,50 @@
1
+ // #327 S2: single-user fixed-version Windows logon runner.
2
+ // Small persistent launcher; npm package remains in the normal npx cache.
3
+ import {readFileSync,writeFileSync} from 'node:fs';
4
+ import {dirname,join} from 'node:path';
5
+ import {fileURLToPath} from 'node:url';
6
+ import {spawn} from 'node:child_process';
7
+ const root=dirname(fileURLToPath(import.meta.url));
8
+ const FAIL=()=>{process.exitCode=1;};
9
+ function validPath(x){return typeof x==='string'&&/^[A-Za-z]:\\/.test(x)&&
10
+ !/[\r\n"'&|<>%]/.test(x)&&!x.split('\\').includes('..');}
11
+ let config=null;
12
+ try{
13
+ const data=JSON.parse(readFileSync(join(root,'direct-autostart.json'),'utf8'));
14
+ if(data.schema!==1||!/^0\.1\.0-beta\.\d+$/.test(data.version)||
15
+ !validPath(data.node)||!validPath(data.npmCli))throw Error('INVALID_CONFIG');
16
+ config=data;
17
+ }catch{console.error('DEVICE_DIRECT_AUTOSTART_CONFIG_DENIED');FAIL();}
18
+ if(config){
19
+ // Windows login tasks do not inherit an interactive shell's PATH.
20
+ // npm may start node by name, so expose only the selected runtime in
21
+ // this child process. Never change machine or user environment settings.
22
+ const env={...process.env,PUPPETEER_SKIP_DOWNLOAD:'true',
23
+ npm_config_ignore_scripts:'true',npm_config_omit:'optional',
24
+ npm_config_audit:'false',npm_config_fund:'false'};
25
+ const originalPath=Object.entries(env).find(([key])=>key.toLowerCase()==='path')?.[1]||'';
26
+ for(const key of Object.keys(env))if(key.toLowerCase()==='path')delete env[key];
27
+ env.Path=[dirname(config.node),originalPath].filter(Boolean).join(';');
28
+ const execute=offline=>new Promise(resolve=>{
29
+ const args=[config.npmCli,'exec','--yes',...(offline?['--offline']:[]),
30
+ '--package=@remoteshell/device@'+config.version,'--','remoteshell-device','run'];
31
+ const child=spawn(config.node,args,{shell:false,windowsHide:true,
32
+ stdio:['ignore','ignore','pipe'],env});
33
+ let errors='',settled=false;
34
+ child.stderr?.on('data',chunk=>{if(errors.length<2048)errors+=String(chunk).slice(0,2048-errors.length);});
35
+ const finish=code=>{if(!settled){settled=true;resolve({code,cacheMiss:/ENOTCACHED/i.test(errors)})}};
36
+ child.once('error',()=>finish(1));
37
+ child.once('exit',code=>finish(code??1));
38
+ });
39
+ try{
40
+ // No network for normal logons. Only an explicit cache miss may fetch
41
+ // the exact same immutable version; never substitute @beta or @latest.
42
+ const first=await execute(true);
43
+ if(first.code!==0){
44
+ if(first.cacheMiss){
45
+ const retry=await execute(false);
46
+ if(retry.code!==0)FAIL();
47
+ }else FAIL();
48
+ }
49
+ }catch{FAIL();}
50
+ }
@@ -0,0 +1,110 @@
1
+ // #327 S2. Opt-in per-user Windows login autostart for exact public npx.
2
+ // No install/clone, no credential mutation and no other user's startup keys.
3
+ import {spawnSync} from 'node:child_process';
4
+ import {existsSync,readFileSync,rmSync} from 'node:fs';
5
+ import {homedir} from 'node:os';
6
+ import {win32} from 'node:path';
7
+ import {fileURLToPath} from 'node:url';
8
+ import {devOfficialRegistration} from './dev-agent-client.mjs';
9
+ import {directPaths,requireNoLegacyInstall} from './direct-npx-runtime.mjs';
10
+ import {atomicWindowsPrivate,readWindowsPrivate,ensureWindowsPrivateStore} from './windows-private-store.mjs';
11
+ import {canonicalWindowsLocalFile,isWindowsChildPath} from './native-path-contract.mjs';
12
+ import {inspectWindowsCredentialAcl} from './windows-credential-boundary.mjs';
13
+ const VALUE='RemoteShell-Direct-npx';
14
+ const KEY='HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run';
15
+ const DENY=()=>{throw Error('DEVICE_DIRECT_AUTOSTART_DENIED');};
16
+ function execReg(args,{run=spawnSync}={}){
17
+ const root=process.env.SystemRoot||'C:\\Windows';
18
+ const result=run(win32.join(root,'System32','reg.exe'),args,{
19
+ shell:false,windowsHide:true,encoding:'utf8',timeout:10000,maxBuffer:8192,stdio:'pipe'});
20
+ if(result?.error||result?.signal||![0,1].includes(result?.status))DENY();
21
+ return result;
22
+ }
23
+ function paths({home=homedir(),localAppData=process.env.LOCALAPPDATA,os=process.platform}={}){
24
+ if(os!=='win32')DENY();
25
+ const p=directPaths({home,localAppData,os});
26
+ const runner=win32.join(p.storageDir,'direct-autostart-runner.mjs');
27
+ const config=win32.join(p.storageDir,'direct-autostart.json');
28
+ for(const x of [runner,config]){canonicalWindowsLocalFile(x);isWindowsChildPath(x,p.storageDir);}
29
+ return {p,runner,config};
30
+ }
31
+ export function exactAutostartVersion(value){
32
+ if(typeof value!=='string'||!/^0\.1\.0-beta\.\d+$/.test(value))DENY();
33
+ return value;
34
+ }
35
+ function stableExec({node=process.execPath,npmCli=process.env.npm_execpath,home=homedir()}={}){
36
+ for(const x of [node,npmCli]){canonicalWindowsLocalFile(x);if(!existsSync(x))DENY();}
37
+ // npm's executable must be from a persistent install, not an ephemeral _npx.
38
+ for(const x of [node,npmCli]){
39
+ if(/[/\\]_npx[/\\]/i.test(x)||/[/\\]Temp[/\\]/i.test(x))DENY();
40
+ }
41
+ if(!/node\.exe$/i.test(node)||!/npm-cli\.js$/i.test(npmCli))DENY();
42
+ return {node,npmCli};
43
+ }
44
+ function runValue(node,runner){return '"'+node+'" "'+runner+'"';}
45
+ function current({run}={}){
46
+ const result=execReg(['query',KEY,'/v',VALUE],{run});
47
+ if(result.status===1)return null;
48
+ const match=String(result.stdout||'').split(/\r?\n/)
49
+ .find(x=>new RegExp('^\\s*'+VALUE+'\\s+REG_SZ\\s+','i').test(x));
50
+ if(!match)DENY();
51
+ const v=match.replace(new RegExp('^\\s*'+VALUE+'\\s+REG_SZ\\s+','i'),'').trim();
52
+ if(!v)DENY();
53
+ return v;
54
+ }
55
+ export function directAutostartStatus({run}={}){
56
+ const value=current({run});
57
+ return {enabled:value!==null,registered:undefined,scope:'current-Windows-user'};
58
+ }
59
+ export function enableDirectAutostart({version,home=homedir(),localAppData=process.env.LOCALAPPDATA,
60
+ node=process.execPath,npmCli=process.env.npm_execpath,run=spawnSync}={}){
61
+ exactAutostartVersion(version);
62
+ const {p,runner,config}=paths({home,localAppData});
63
+ requireNoLegacyInstall(p);
64
+ const registration=devOfficialRegistration({storageDir:p.storageDir});
65
+ if(!registration)DENY();
66
+ ensureWindowsPrivateStore(p.storageDir,{home});
67
+ const exe=stableExec({node,npmCli,home});
68
+ const command=runValue(exe.node,runner);
69
+ const active=current({run});
70
+ if(active!==null){
71
+ if(active!==command)DENY();
72
+ const stored=JSON.parse(readWindowsPrivate(config,{home}));
73
+ if(stored.version!==version||stored.node!==exe.node||stored.npmCli!==exe.npmCli)DENY();
74
+ return {enabled:true,version,reused:true,credentialsPreserved:true};
75
+ }
76
+ if(existsSync(runner)||existsSync(config))DENY(); // incomplete install: investigate, never overwrite.
77
+ const source=readFileSync(fileURLToPath(new URL('./windows-direct-autostart-runner.mjs',import.meta.url)),'utf8');
78
+ let wroteRunner=false,wroteConfig=false;
79
+ try{
80
+ atomicWindowsPrivate(runner,source,{home});wroteRunner=true;
81
+ atomicWindowsPrivate(config,JSON.stringify({schema:1,version,...exe})+'\n',{home});
82
+ wroteConfig=true;
83
+ const result=execReg(['add',KEY,'/v',VALUE,'/t','REG_SZ','/d',command,'/f'],{run});
84
+ if(result.status!==0)DENY();
85
+ }catch(error){
86
+ // Only files created by this invocation are ever removed on failure.
87
+ if(wroteConfig)rmSync(config,{force:true});
88
+ if(wroteRunner)rmSync(runner,{force:true});
89
+ throw error;
90
+ }
91
+ return {enabled:true,version,reused:false,credentialsPreserved:true,deviceId:registration.deviceId};
92
+ }
93
+ export function disableDirectAutostart({home=homedir(),localAppData=process.env.LOCALAPPDATA,
94
+ node=process.execPath,run=spawnSync}={}){
95
+ const {runner,config}=paths({home,localAppData});
96
+ const value=current({run});
97
+ if(value===null)return {enabled:false,changed:false,credentialsPreserved:true};
98
+ if(!value.endsWith(' "'+runner+'"'))DENY();
99
+ const result=execReg(['delete',KEY,'/v',VALUE,'/f'],{run});
100
+ if(result.status!==0)DENY();
101
+ // Explicit disable revokes only this user's launcher, never credentials.
102
+ // Existing running Agent is not killed here; stop is an independent action.
103
+ for(const file of [config,runner]){
104
+ if(existsSync(file)){
105
+ inspectWindowsCredentialAcl({file,home});
106
+ rmSync(file);
107
+ }
108
+ }
109
+ return {enabled:false,changed:true,credentialsPreserved:true};
110
+ }
@@ -0,0 +1,28 @@
1
+ // #310 Non-executing Windows per-user installation layout. No directories are
2
+ // created and no existing DC/RDC/RS credentials are copied or replaced.
3
+ import {win32} from 'node:path';
4
+ import {canonicalWindowsLocalFile,isWindowsChildPath} from './native-path-contract.mjs';
5
+ const deny=()=>{throw Error('DEVICE_WINDOWS_LAYOUT_DENIED');};
6
+ export function windowsInstallLayout({home,localAppData,os='win32'}={}){
7
+ if(os!=='win32')deny();
8
+ try{
9
+ canonicalWindowsLocalFile(home);
10
+ // Remote launchers may omit LOCALAPPDATA even when the authenticated Windows
11
+ // profile has its standard Local AppData directory. Derive only that path;
12
+ // never accept a missing profile root or repair an explicitly foreign value.
13
+ const resolvedLocalAppData=localAppData===undefined||localAppData===null||localAppData===''?
14
+ win32.join(home,'AppData','Local'):localAppData;
15
+ canonicalWindowsLocalFile(resolvedLocalAppData);
16
+ isWindowsChildPath(resolvedLocalAppData,home);
17
+ const base=win32.join(resolvedLocalAppData,'RemoteShell','DeviceAgent');
18
+ const install=win32.join(base,'install');
19
+ const credentials=win32.join(base,'dev-credentials');
20
+ for(const path of [base,install,credentials]){
21
+ canonicalWindowsLocalFile(path);
22
+ isWindowsChildPath(path,home);
23
+ }
24
+ return Object.freeze({platform:'win32',base,install,credentials,
25
+ executableReady:false,permissionsVerified:false,created:false,
26
+ userScopeOnly:true,existingCredentialsPreserved:true});
27
+ }catch{deny();}
28
+ }
@@ -0,0 +1,91 @@
1
+ // #310 Windows native user package installation. No service or enrollment.
2
+ // A package-only stage is never reported as Agent connected/DC ready.
3
+ import {existsSync,lstatSync,mkdirSync,readFileSync,writeFileSync,renameSync,rmSync,realpathSync} from 'node:fs';
4
+ import {win32} from 'node:path';
5
+ import {randomUUID} from 'node:crypto';
6
+ import {spawnSync} from 'node:child_process';
7
+ import {windowsInstallLayout} from './windows-install-layout.mjs';
8
+ import {canonicalWindowsLocalFile,isWindowsChildPath} from './native-path-contract.mjs';
9
+ const fail=(code='DEVICE_WINDOWS_INSTALL_DENIED')=>{throw Error(code);};
10
+ function secureDirectory(path,{allowCreate=false}={}){
11
+ canonicalWindowsLocalFile(path);
12
+ if(!existsSync(path)){
13
+ if(!allowCreate)fail();
14
+ mkdirSync(path,{recursive:true});
15
+ }
16
+ const st=lstatSync(path);
17
+ if(!st.isDirectory()||st.isSymbolicLink()||win32.normalize(realpathSync(path)).toLowerCase()!==path.toLowerCase())fail();
18
+ }
19
+ function receipt(install,expected){
20
+ const file=win32.join(install,'receipt.json');
21
+ const st=lstatSync(file);
22
+ if(!st.isFile()||st.isSymbolicLink()||st.size>2048)fail();
23
+ const data=JSON.parse(readFileSync(file,'utf8'));
24
+ if(data?.schema!==1||data.version!==expected||data.distribution!=='synthetic-private'||
25
+ data.registered!==false||data.serviceEnabled!==false)fail();
26
+ for(const [name,version] of [['@remoteshell/device',expected],['@wonderwhy-er/desktop-commander','0.3.1']]){
27
+ const p=win32.join(install,'node_modules',...name.split('/'),'package.json');
28
+ const s=lstatSync(p);
29
+ if(!s.isFile()||s.isSymbolicLink()||JSON.parse(readFileSync(p,'utf8')).version!==version)fail();
30
+ }
31
+ return data;
32
+ }
33
+ export function installWindowsNative({
34
+ home,localAppData,packageRoot,version,nodeBin=process.execPath,run=spawnSync
35
+ }={}){
36
+ const layout=windowsInstallLayout({home,localAppData});
37
+ const {base,install}=layout;
38
+ // LOCALAPPDATA can be absent in remote sessions; use the validated layout.
39
+ const effectiveLocalAppData=win32.dirname(win32.dirname(base));
40
+ for(const p of [home,effectiveLocalAppData,win32.dirname(base),base])secureDirectory(p,{allowCreate:p!==home});
41
+ if(existsSync(install))fail('DEVICE_ALREADY_INSTALLED');
42
+ canonicalWindowsLocalFile(packageRoot);isWindowsChildPath(packageRoot,home);
43
+ // Only resolve npm's trusted installed JavaScript entrypoint. Avoid .cmd,
44
+ // powershell, shell:true and untrusted command interpolation.
45
+ const npmCli=win32.join(win32.dirname(nodeBin),'node_modules','npm','bin','npm-cli.js');
46
+ const st=lstatSync(npmCli);
47
+ if(!st.isFile()||st.isSymbolicLink())fail();
48
+ const staging=win32.join(base,'.install-'+randomUUID());
49
+ mkdirSync(staging);
50
+ try{
51
+ const options={shell:false,windowsHide:true,encoding:'utf8',stdio:'pipe',timeout:120000,maxBuffer:1048576};
52
+ const pack=run(nodeBin,[npmCli,'pack',packageRoot,'--ignore-scripts','--json','--pack-destination',staging],options);
53
+ if(pack.error||pack.signal||pack.status!==0)fail('DEVICE_INSTALL_PACKAGE_FAILED');
54
+ let data;try{data=JSON.parse(pack.stdout);}catch{fail('DEVICE_INSTALL_PACKAGE_FAILED');}
55
+ const entry=Array.isArray(data)?data[0]:null;
56
+ if(entry?.filename!==`remoteshell-device-${version}.tgz`)fail('DEVICE_INSTALL_PACKAGE_FAILED');
57
+ const archive=win32.join(staging,entry.filename);
58
+ // A cold public npm install may need several minutes for the pinned DC dependency tree.
59
+ // Keep the quick local pack limit above, but do not abort a healthy dependency fetch at 120s.
60
+ const installed=run(nodeBin,[npmCli,'install','--prefix',staging,'--ignore-scripts','--no-audit','--no-fund','--no-package-lock','--no-save',archive],{...options,timeout:900000});
61
+ if(installed.error?.code==='ETIMEDOUT')fail('DEVICE_INSTALL_DEPENDENCY_TIMEOUT');
62
+ if(installed.error||installed.signal||installed.status!==0)fail('DEVICE_INSTALL_DEPENDENCY_FAILED');
63
+ rmSync(archive,{force:true});
64
+ writeFileSync(win32.join(staging,'receipt.json'),JSON.stringify({
65
+ schema:1,version,distribution:'synthetic-private',registered:false,serviceEnabled:false
66
+ })+'\n',{flag:'wx'});
67
+ receipt(staging,version);
68
+ if(existsSync(install))fail('DEVICE_ALREADY_INSTALLED');
69
+ renameSync(staging,install);
70
+ return Object.freeze({installed:true,version,registered:false,connected:false,
71
+ dcReady:false,serviceEnabled:false,credentialsPreserved:true,runMode:'not-started',
72
+ next:'owner-consent-and-worker-not-ready'});
73
+ }finally{if(existsSync(staging))rmSync(staging,{recursive:true,force:true});}
74
+ }
75
+ export function statusWindowsNative({home,localAppData,version}={}){
76
+ const p=windowsInstallLayout({home,localAppData});
77
+ if(!existsSync(p.install))return {installed:false,registered:false,connected:false,dcReady:false};
78
+ secureDirectory(p.install);
79
+ receipt(p.install,version);
80
+ return {installed:true,version,registered:false,connected:false,dcReady:false,
81
+ serviceEnabled:false,credentialsPreserved:true};
82
+ }
83
+ export function uninstallWindowsNative({home,localAppData,version}={}){
84
+ const p=windowsInstallLayout({home,localAppData});
85
+ if(!existsSync(p.install))return {removed:false};
86
+ secureDirectory(p.install);receipt(p.install,version);
87
+ // Service operations are still explicitly disabled; delete only the package
88
+ // created by this installer. Never touch separate credentials or RDC.
89
+ rmSync(p.install,{recursive:true,force:false});
90
+ return {removed:true,credentialsPreserved:true,serviceUntouched:true};
91
+ }