fullcourtdefense-cli 1.35.10 → 1.36.2

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 (74) hide show
  1. package/dist/actionPolicyEngine.d.ts +24 -0
  2. package/dist/actionPolicyEngine.js +79 -19
  3. package/dist/approvalPrompt.d.ts +15 -0
  4. package/dist/approvalPrompt.js +157 -20
  5. package/dist/askDialog.d.ts +2 -0
  6. package/dist/askDialog.js +15 -1
  7. package/dist/askHeader.d.ts +81 -0
  8. package/dist/askHeader.js +573 -0
  9. package/dist/blockExplanation.d.ts +9 -0
  10. package/dist/blockExplanation.js +14 -0
  11. package/dist/callerEnv.d.ts +1 -1
  12. package/dist/callerEnv.js +14 -0
  13. package/dist/cloudGrant.d.ts +46 -0
  14. package/dist/cloudGrant.js +420 -0
  15. package/dist/cloudGrantTools.d.ts +97 -0
  16. package/dist/cloudGrantTools.js +1112 -0
  17. package/dist/commandNarrative.d.ts +8 -0
  18. package/dist/commandNarrative.js +222 -49
  19. package/dist/commands/cmdGuard.js +3 -1
  20. package/dist/commands/daemon.js +56 -2
  21. package/dist/commands/deterministicGuard.d.ts +70 -4
  22. package/dist/commands/deterministicGuard.js +494 -63
  23. package/dist/commands/discover.js +50 -16
  24. package/dist/commands/discoverAgentFiles.d.ts +2 -0
  25. package/dist/commands/discoverAgentFiles.js +1 -0
  26. package/dist/commands/discoverPaths.d.ts +4 -0
  27. package/dist/commands/discoverPaths.js +19 -1
  28. package/dist/commands/discoverProjectRoots.d.ts +72 -0
  29. package/dist/commands/discoverProjectRoots.js +327 -0
  30. package/dist/commands/discoverProxy.d.ts +1 -1
  31. package/dist/commands/discoverProxy.js +1 -1
  32. package/dist/commands/discoverSecrets.d.ts +44 -0
  33. package/dist/commands/discoverSecrets.js +158 -14
  34. package/dist/commands/hook.js +25 -10
  35. package/dist/commands/knownMcpServers.d.ts +8 -2
  36. package/dist/commands/knownMcpServers.js +33 -2
  37. package/dist/commands/mcpGateway.js +9 -7
  38. package/dist/commands/posixShellGuard.js +1 -1
  39. package/dist/commands/shellGuard.js +86 -26
  40. package/dist/commands/uninstallAll.d.ts +1 -7
  41. package/dist/commands/uninstallAll.js +6 -45
  42. package/dist/commands/watchdog.js +17 -3
  43. package/dist/config.d.ts +1 -1
  44. package/dist/config.js +3 -3
  45. package/dist/credentialGrant.d.ts +48 -0
  46. package/dist/credentialGrant.js +29 -18
  47. package/dist/credentialStore.js +1 -1
  48. package/dist/devConfirm.d.ts +51 -3
  49. package/dist/devConfirm.js +226 -33
  50. package/dist/distress.d.ts +2 -0
  51. package/dist/distress.js +2 -0
  52. package/dist/grantTargets.d.ts +21 -0
  53. package/dist/grantTargets.js +235 -0
  54. package/dist/localSafetySnapshot.js +2 -0
  55. package/dist/msiProductCode.d.ts +10 -0
  56. package/dist/msiProductCode.js +124 -0
  57. package/dist/notify.js +1 -0
  58. package/dist/selfTest.d.ts +1 -1
  59. package/dist/selfTest.js +1 -1
  60. package/dist/selfUpdate.d.ts +108 -0
  61. package/dist/selfUpdate.js +353 -18
  62. package/dist/shellAst.d.ts +2 -0
  63. package/dist/shellAst.js +7 -1
  64. package/dist/shellAstLoader.js +14 -1
  65. package/dist/telemetry.d.ts +3 -0
  66. package/dist/telemetry.js +1 -0
  67. package/dist/version.json +1 -1
  68. package/installer/macos/guardian/ai.fullcourtdefense.guardian.plist +19 -0
  69. package/installer/macos/guardian/fcd-guardian.sh +590 -0
  70. package/installer/macos/guardian/install-guardian.sh +32 -0
  71. package/installer/macos/guardian/uninstall-guardian.sh +12 -0
  72. package/installer/windows/README.md +88 -0
  73. package/installer/windows/rescue/FullCourtDefense-Rescue.ps1 +229 -0
  74. package/package.json +11 -1
@@ -0,0 +1,88 @@
1
+ # FullCourtDefense Windows MSI
2
+
3
+ This package is the enterprise deployment path for the `fullcourtdefense-cli`
4
+ developer-workstation guardrail. It complements—not replaces—the developer
5
+ CLI. The MSI installs the CLI into a stable Program Files location; a
6
+ post-install bootstrap enrolls, protects, verifies, and records device state.
7
+
8
+ ## Security model
9
+
10
+ - Never bake an organization-wide fleet token into an MSI, transform, script,
11
+ registry key, or Intune command line.
12
+ - Use a short-lived, device-scoped enrollment grant for `FCD_ENROLLMENT_CODE`.
13
+ - The bootstrap passes the grant via an environment variable, redacts it from
14
+ its status output, exchanges it for machine credentials, then clears it.
15
+ - Sign the MSI and PowerShell bootstrap in the release pipeline. Do not
16
+ distribute unsigned endpoint installers.
17
+
18
+ ## Build prerequisites
19
+
20
+ 1. Build the CLI: `npm run build` from `sdks/cli`.
21
+ 2. Install WiX v4 on the release agent (`wix --version`).
22
+ 3. Supply a release version:
23
+
24
+ ```powershell
25
+ wix build .\FullCourtDefense.wxs -d ProductVersion=1.15.0 -out .\FullCourtDefense-1.15.0.msi
26
+ ```
27
+
28
+ The release job must sign `FullCourtDefense-*.msi` and
29
+ `Install-FullCourtDefense.ps1`, publish SHA-256 checksums, and fail if signing
30
+ is unavailable.
31
+
32
+ ## Interactive IT-assisted install
33
+
34
+ The MSI begins with an enrollment-key screen. It does not install hooks,
35
+ credentials, schedules, or other protection state until a user enters a
36
+ short-lived enrollment key and chooses **Install**. The installer then runs
37
+ onboarding, verifies the device, shows a completion screen, and closes when
38
+ the user selects **Finish**.
39
+
40
+ For a support-assisted retry after installation, the included enrollment
41
+ launcher remains available:
42
+
43
+ ```powershell
44
+ & "$env:ProgramFiles\FullCourtDefense\Start-FullCourtDefenseSetup.ps1"
45
+ ```
46
+
47
+ An IT operator may instead supply the code directly to the bootstrap:
48
+
49
+ ```powershell
50
+ & "$env:ProgramFiles\FullCourtDefense\Install-FullCourtDefense.ps1" `
51
+ -EnrollmentCode '<short-lived-device-grant>' `
52
+ -ApiUrl 'https://api.fullcourtdefense.ai'
53
+ ```
54
+
55
+ The machine enrolls in enforcing (block) mode; switch it to monitor from the
56
+ dashboard if you want a detect-only rollout first.
57
+
58
+ The installer status is written to:
59
+
60
+ ```text
61
+ %ProgramData%\FullCourtDefense\install-status.json
62
+ ```
63
+
64
+ It contains preflight/install result and safe error details, never the
65
+ enrollment code.
66
+
67
+ ## Intune deployment
68
+
69
+ Use an Intune remediation/provisioning script to obtain or inject a
70
+ short-lived device grant, then invoke the bootstrap with `-NoProfile
71
+ -NonInteractive`. Detection rules should check both the MSI product code and
72
+ `%ProgramData%\FullCourtDefense\install-status.json` with `state=protected`.
73
+
74
+ If the bootstrap reports `partial`, use the generated repair command after
75
+ addressing the underlying cause (for example, UAC denied for the daemon task).
76
+
77
+ ## Supported deployment modes
78
+
79
+ - Newly enrolled machines are **enforcing (block)** by default: dangerous
80
+ actions and matching action policies are blocked, and the machine fails
81
+ closed when the policy service is unreachable.
82
+ - To run a machine (or the whole fleet) detect-only, switch it to **monitor**
83
+ from the dashboard after enrollment. The enforcement mode is server-
84
+ authoritative — the machine applies whatever mode the console shows.
85
+ - `-NoDaemon` is supported only for constrained environments and is surfaced
86
+ as reduced tamper-healing/liveness coverage.
87
+ - `-NoDiscovery` is supported when privacy policy defers desktop discovery;
88
+ runtime protection can still be installed.
@@ -0,0 +1,229 @@
1
+ <#
2
+ .SYNOPSIS
3
+ FullCourtDefense rescue beacon + rescue orders for the Windows guardian.
4
+
5
+ .DESCRIPTION
6
+ Dot-sourced by the SYSTEM "FullCourtDefense Recovery" task (Repair-FullCourtDefense.ps1).
7
+ Defines functions only; nothing runs on load. Built-in Windows PowerShell 5.1 only,
8
+ never the product's node, so it keeps reporting when the install folder is gone.
9
+
10
+ - Identity: machineId = first 32 hex of SHA-256(MachineGuid), as machineIdentity.ts;
11
+ shieldId / apiUrl from the enrolled profiles' .fullcourtdefense.yml, cached in the
12
+ recovery folder so a wiped profile does not cut the machine off.
13
+ - Auth: the first beacon uses the machine's shield key (machine-key.json, which is
14
+ ACL'd to the user AND SYSTEM, or a plaintext shieldKey) and receives the rescue
15
+ secret; later beacons are HMAC-signed with it. No readable credential: an
16
+ unauthenticated status-only beacon. Credentials travel in request headers, never
17
+ on a command line.
18
+ - Orders: repair | reinstall only, HMAC-verified with the rescue secret, unexpired,
19
+ never seen before. Constrained Language Mode (no HMAC available): orders are refused.
20
+
21
+ Contract: backend/src/modules/discovery/rescue-beacon.ts; shared vectors in
22
+ backend/src/modules/discovery/__tests__/fixtures/rescue-vectors.json.
23
+ Test seams: FCD_RESCUE_* environment variables (scripts/test-rescue-beacon-win.js).
24
+ #>
25
+
26
+ $RescueGuardianVersion = '1.0.0'
27
+ $RescueDefaultApi = 'https://api.fullcourtdefense.ai'
28
+
29
+ function Get-RescueEpoch {
30
+ if ($env:FCD_RESCUE_NOW) { return [long]$env:FCD_RESCUE_NOW }
31
+ return [long][Math]::Floor(((Get-Date).ToUniversalTime() - (Get-Date -Date '1970-01-01T00:00:00Z').ToUniversalTime()).TotalSeconds)
32
+ }
33
+
34
+ # Printable, signable text: the backend verifies the signature over exactly these characters.
35
+ function ConvertTo-RescueText([string]$Text) {
36
+ if (-not $Text) { return '' }
37
+ $clean = ($Text -replace '[^A-Za-z0-9 ._:;/()=,+\\-]', '')
38
+ if ($clean.Length -gt 300) { $clean = $clean.Substring(0, 300) }
39
+ return $clean
40
+ }
41
+
42
+ # SHA-256: .NET in Full Language; in Constrained Language Mode the module-qualified
43
+ # Get-FileHash (qualified so it loads even when PSModulePath was inherited from pwsh 7).
44
+ function Get-RescueSha256Hex([string]$Text, [string]$TempDir) {
45
+ if (Test-RescueFullLanguage) {
46
+ $sha = [System.Security.Cryptography.SHA256]::Create()
47
+ try { return (($sha.ComputeHash([Text.Encoding]::UTF8.GetBytes($Text)) | ForEach-Object { $_.ToString('x2') }) -join '') } finally { $sha.Dispose() }
48
+ }
49
+ $file = Join-Path $TempDir "rescue-hash-$PID.tmp"
50
+ try {
51
+ Set-Content -LiteralPath $file -Value $Text -NoNewline -Encoding ASCII
52
+ return (Microsoft.PowerShell.Utility\Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash.ToLowerInvariant()
53
+ } finally { Remove-Item -LiteralPath $file -Force -ErrorAction SilentlyContinue }
54
+ }
55
+
56
+ function Get-RescueMachineId([string]$TempDir) {
57
+ $guid = $env:FCD_RESCUE_MACHINE_GUID
58
+ if (-not $guid) {
59
+ try { $guid = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Cryptography' -Name MachineGuid -ErrorAction Stop).MachineGuid } catch { $guid = $null }
60
+ }
61
+ if (-not $guid) { return $null }
62
+ return (Get-RescueSha256Hex $guid $TempDir).Substring(0, 32)
63
+ }
64
+
65
+ function Test-RescueFullLanguage { return "$($ExecutionContext.SessionState.LanguageMode)" -eq 'FullLanguage' }
66
+
67
+ # HMAC-SHA256, key = UTF-8 bytes of the secret string, lowercase hex. $null in Constrained Language Mode.
68
+ function Get-RescueHmac([string]$Secret, [string]$Message) {
69
+ if (-not (Test-RescueFullLanguage)) { return $null }
70
+ $hmac = New-Object System.Security.Cryptography.HMACSHA256 -ArgumentList (, [Text.Encoding]::UTF8.GetBytes($Secret))
71
+ try {
72
+ $bytes = $hmac.ComputeHash([Text.Encoding]::UTF8.GetBytes($Message))
73
+ return (($bytes | ForEach-Object { $_.ToString('x2') }) -join '')
74
+ } finally { $hmac.Dispose() }
75
+ }
76
+
77
+ function Read-RescueYamlValue([string]$Path, [string]$Key) {
78
+ foreach ($line in @(Get-Content -LiteralPath $Path -ErrorAction SilentlyContinue)) {
79
+ if ($line -match "^$([regex]::Escape($Key)):\s*(.*?)\s*$") { return $Matches[1].Trim().Trim('"').Trim("'") }
80
+ }
81
+ return $null
82
+ }
83
+
84
+ function Read-RescueJson([string]$Path) {
85
+ try { return (Get-Content -LiteralPath $Path -Raw -ErrorAction Stop | ConvertFrom-Json) } catch { return $null }
86
+ }
87
+
88
+ # { ShieldId; ApiUrl; ShieldKey } from the cache + enrolled profiles. The key is never cached.
89
+ function Get-RescueIdentity([string]$StateDir, [string]$UsersDir) {
90
+ $cacheFile = Join-Path $StateDir 'rescue-identity.json'
91
+ $cache = Read-RescueJson $cacheFile
92
+ $identity = @{ ShieldId = $(if ($cache) { "$($cache.shieldId)" } else { '' }); ApiUrl = $(if ($cache) { "$($cache.apiUrl)" } else { '' }); ShieldKey = $null }
93
+ foreach ($dir in @(Get-ChildItem -LiteralPath $UsersDir -Directory -ErrorAction SilentlyContinue)) {
94
+ $yml = Join-Path $dir.FullName '.fullcourtdefense.yml'
95
+ if (-not (Test-Path -LiteralPath $yml)) { continue }
96
+ $shieldId = Read-RescueYamlValue $yml 'shieldId'
97
+ if (-not $shieldId) { continue }
98
+ $identity.ShieldId = $shieldId
99
+ $api = Read-RescueYamlValue $yml 'apiUrl'
100
+ if ($api) { $identity.ApiUrl = $api }
101
+ $mirror = Read-RescueJson (Join-Path $dir.FullName '.fullcourtdefense\machine-key.json')
102
+ if ($mirror -and "$($mirror.shieldId)" -eq $shieldId -and $mirror.key) {
103
+ try { $identity.ShieldKey = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String("$($mirror.key)")) } catch { }
104
+ }
105
+ if (-not $identity.ShieldKey) { $identity.ShieldKey = Read-RescueYamlValue $yml 'shieldKey' }
106
+ break
107
+ }
108
+ if (-not $identity.ApiUrl -or -not ($identity.ApiUrl -match '^https://' -or $identity.ApiUrl -match '^http://(127\.0\.0\.1|localhost)(:\d+)?(/|$)')) {
109
+ $identity.ApiUrl = $RescueDefaultApi
110
+ }
111
+ if ($identity.ShieldId -and ((-not $cache) -or "$($cache.shieldId)" -ne $identity.ShieldId -or "$($cache.apiUrl)" -ne $identity.ApiUrl)) {
112
+ try { Set-Content -LiteralPath $cacheFile -Value (@{ shieldId = $identity.ShieldId; apiUrl = $identity.ApiUrl } | ConvertTo-Json) -Encoding ASCII } catch { }
113
+ }
114
+ return $identity
115
+ }
116
+
117
+ # The recovery folder grants Users read (it holds the package msiexec reads); the secret
118
+ # must not be readable by them: SYSTEM + Administrators only, inheritance off.
119
+ function Protect-RescueSecretFile([string]$Path) {
120
+ if ($env:FCD_RESCUE_SKIP_ACL -eq '1') { return }
121
+ $ErrorActionPreference = 'Continue'
122
+ & icacls.exe $Path /inheritance:r /grant:r '*S-1-5-18:F' '*S-1-5-32-544:F' /C /Q 2>$null | Out-Null
123
+ }
124
+
125
+ function Get-RescueSecret([string]$StateDir) {
126
+ $file = Join-Path $StateDir 'rescue-secret'
127
+ if (-not (Test-Path -LiteralPath $file)) { return $null }
128
+ $value = (Get-Content -LiteralPath $file -Raw -ErrorAction SilentlyContinue)
129
+ if ($value) { $value = $value.Trim() }
130
+ if ($value -match '^[0-9a-f]{64}$') { return $value }
131
+ return $null
132
+ }
133
+
134
+ <#
135
+ Send one beacon. $Status: @{ State; LadderStep; Reason; CliVersion; DisasterSince; AwakeMinutes; LastRepair = @{ At; Step; Ok; Detail } }.
136
+ Returns @{ Ok; Auth; Order } - Order is the raw order fields (verify with Test-RescueOrder) or $null.
137
+ #>
138
+ function Send-RescueBeacon([hashtable]$Status, [string]$StateDir, [string]$UsersDir, [switch]$NeedSecret) {
139
+ $identity = Get-RescueIdentity $StateDir $UsersDir
140
+ $machineId = Get-RescueMachineId $StateDir
141
+ if (-not $identity.ShieldId -or -not $machineId) { return @{ Ok = $false; Auth = 'none'; Order = $null; Error = 'not enrolled or no MachineGuid' } }
142
+ $state = "$($Status.State)"; $step = if ($Status.LadderStep) { "$($Status.LadderStep)" } else { 'none' }
143
+ $reason = ConvertTo-RescueText "$($Status.Reason)"; $cliVersion = ConvertTo-RescueText "$($Status.CliVersion)"
144
+ $body = [ordered]@{
145
+ shieldId = $identity.ShieldId; machineId = $machineId; platform = 'win32'; guardianVersion = $RescueGuardianVersion
146
+ cliVersion = $cliVersion; state = $state; ladderStep = $step; reason = $reason
147
+ }
148
+ if ($null -ne $Status.AwakeMinutes) { $body.awakeMinutes = [int]$Status.AwakeMinutes }
149
+ if ($Status.DisasterSince) { $body.disasterSince = "$($Status.DisasterSince)" }
150
+ if ($Status.LastRepair) {
151
+ $body.lastRepair = [ordered]@{ at = "$($Status.LastRepair.At)"; step = "$($Status.LastRepair.Step)"; ok = [bool]$Status.LastRepair.Ok; detail = (ConvertTo-RescueText "$($Status.LastRepair.Detail)") }
152
+ }
153
+ $ackFile = Join-Path $StateDir 'rescue-pending-ack.json'
154
+ $ack = Read-RescueJson $ackFile
155
+ if ($ack -and $ack.id) { $body.orderAck = [ordered]@{ id = "$($ack.id)"; outcome = "$($ack.outcome)"; detail = (ConvertTo-RescueText "$($ack.detail)") } }
156
+
157
+ $headers = @{}
158
+ $secret = if ($NeedSecret) { $null } else { Get-RescueSecret $StateDir }
159
+ $auth = 'unauthenticated'
160
+ $ts = "$(Get-RescueEpoch)"
161
+ $sig = if ($secret) { Get-RescueHmac $secret (@('fcd-rescue-beacon-v1', $identity.ShieldId, $machineId, $ts, $state, $step, $cliVersion, $reason) -join "`n") } else { $null }
162
+ if ($sig) {
163
+ $headers['x-fcd-rescue-ts'] = $ts; $headers['x-fcd-rescue-sig'] = $sig; $auth = 'secret'
164
+ } elseif ($identity.ShieldKey) {
165
+ $headers['x-shield-id'] = $identity.ShieldId; $headers['x-shield-key'] = $identity.ShieldKey; $auth = 'shield-key'
166
+ # Constrained Language Mode cannot use a secret: do not ask for one it cannot use.
167
+ if (Test-RescueFullLanguage) { $body.needSecret = $true }
168
+ }
169
+ $uri = "$($identity.ApiUrl.TrimEnd('/'))/api/cli/machines/rescue/beacon"
170
+ try {
171
+ [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
172
+ } catch { }
173
+ try {
174
+ $response = Invoke-RestMethod -Method Post -Uri $uri -Headers $headers -ContentType 'application/json' -Body ($body | ConvertTo-Json -Depth 5 -Compress) -UseBasicParsing -TimeoutSec 30
175
+ } catch {
176
+ $failure = $_
177
+ $code = $null
178
+ try { $code = [int]$failure.Exception.Response.StatusCode } catch { }
179
+ $detail = "$($failure.ErrorDetails.Message)"
180
+ if (-not $detail) {
181
+ try { $detail = (New-Object IO.StreamReader($failure.Exception.Response.GetResponseStream())).ReadToEnd() } catch { }
182
+ }
183
+ if ($code -eq 401 -and $auth -eq 'secret' -and $detail -match 'RESCUE_SECRET_') {
184
+ Remove-Item -LiteralPath (Join-Path $StateDir 'rescue-secret') -Force -ErrorAction SilentlyContinue
185
+ if ($identity.ShieldKey) { return Send-RescueBeacon $Status $StateDir $UsersDir -NeedSecret }
186
+ }
187
+ return @{ Ok = $false; Auth = $auth; Order = $null; Error = "HTTP $code $($failure.Exception.Message)" }
188
+ }
189
+ if ($body.orderAck) { Remove-Item -LiteralPath $ackFile -Force -ErrorAction SilentlyContinue }
190
+ $data = $response.data
191
+ if ($data -and $data.secret -and "$($data.secret)" -match '^[0-9a-f]{64}$') {
192
+ $secretFile = Join-Path $StateDir 'rescue-secret'
193
+ Set-Content -LiteralPath $secretFile -Value "$($data.secret)" -NoNewline -Encoding ASCII
194
+ Protect-RescueSecretFile $secretFile
195
+ }
196
+ $order = $null
197
+ if ($data -and $data.orderId) {
198
+ $order = @{ Id = "$($data.orderId)"; Action = "$($data.orderAction)"; Nonce = "$($data.orderNonce)"; ExpiresAt = "$($data.orderExpiresAt)"; Sig = "$($data.orderSig)"; MachineId = $machineId }
199
+ }
200
+ return @{ Ok = $true; Auth = $auth; Order = $order }
201
+ }
202
+
203
+ # $null when the order may run; otherwise the refusal reason. Does not record anything.
204
+ function Test-RescueOrder($Order, [string]$StateDir, [int]$MaxOrdersPerDay = 3) {
205
+ if (@('repair', 'reinstall') -notcontains $Order.Action) { return 'unknown action' }
206
+ $secret = Get-RescueSecret $StateDir
207
+ if (-not $secret) { return 'no rescue secret to verify it' }
208
+ $expected = Get-RescueHmac $secret (@('fcd-rescue-order-v1', $Order.MachineId, $Order.Id, $Order.Action, $Order.Nonce, $Order.ExpiresAt) -join "`n")
209
+ if (-not $expected) { return 'cannot verify orders in Constrained Language Mode' }
210
+ if ($expected -ne "$($Order.Sig)".ToLowerInvariant()) { return 'signature mismatch' }
211
+ try { $expires = ([DateTimeOffset]::Parse($Order.ExpiresAt, [Globalization.CultureInfo]::InvariantCulture)).ToUnixTimeSeconds() } catch { return 'expired' }
212
+ if ($expires -le (Get-RescueEpoch)) { return 'expired' }
213
+ $runs = @(Get-Content -LiteralPath (Join-Path $StateDir 'rescue-orders-run') -ErrorAction SilentlyContinue | Where-Object { $_ -match '^\d+ ' -and [long]($_ -split ' ')[0] -ge ((Get-RescueEpoch) - 86400) })
214
+ if ($runs.Count -ge $MaxOrdersPerDay) { return "$($runs.Count) orders in the last 24 h (limit $MaxOrdersPerDay)" }
215
+ return $null
216
+ }
217
+
218
+ function Test-RescueOrderSeen($Order, [string]$StateDir) {
219
+ return [bool](@(Get-Content -LiteralPath (Join-Path $StateDir 'rescue-orders-seen') -ErrorAction SilentlyContinue) -contains $Order.Id)
220
+ }
221
+
222
+ function Register-RescueOrderSeen($Order, [string]$StateDir, [switch]$Ran) {
223
+ Add-Content -LiteralPath (Join-Path $StateDir 'rescue-orders-seen') -Value $Order.Id -Encoding ASCII
224
+ if ($Ran) { Add-Content -LiteralPath (Join-Path $StateDir 'rescue-orders-run') -Value "$(Get-RescueEpoch) $($Order.Id)" -Encoding ASCII }
225
+ }
226
+
227
+ function Set-RescueOrderAck($Order, [string]$Outcome, [string]$Detail, [string]$StateDir) {
228
+ Set-Content -LiteralPath (Join-Path $StateDir 'rescue-pending-ack.json') -Value (@{ id = $Order.Id; outcome = $Outcome; detail = (ConvertTo-RescueText $Detail) } | ConvertTo-Json) -Encoding ASCII
229
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fullcourtdefense-cli",
3
- "version": "1.35.10",
3
+ "version": "1.36.2",
4
4
  "description": "Full Court Defense CLI — security scanning for AI agents from your terminal",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -10,6 +10,8 @@
10
10
  },
11
11
  "files": [
12
12
  "dist",
13
+ "installer/macos/guardian",
14
+ "installer/windows/rescue",
13
15
  "README.md"
14
16
  ],
15
17
  "scripts": {
@@ -21,6 +23,7 @@
21
23
  "test:endpoint-clients": "npm run build && node scripts/test-endpoint-client-matrix.js && node scripts/test-copilot-hook-install.js",
22
24
  "build": "tsc && node scripts/bundle-policy-engine.js && node scripts/vendor-tree-sitter.js && node scripts/copy-attack-corpus.js && node scripts/bundle-containment-runtime.js",
23
25
  "test:ask-dialog": "npm run build && node scripts/test-ask-dialog.js",
26
+ "test:no-real-dialog": "npm run build && node scripts/test-no-real-dialog.js",
24
27
  "test:deterministic-guard": "npm run build && node scripts/test-deterministic-guard.js",
25
28
  "test:drive-delete-guard": "npm run build && node scripts/test-drive-delete-guard.js",
26
29
  "test:msi-stop-filter": "node scripts/test-msi-stop-filter.js",
@@ -41,6 +44,7 @@
41
44
  "test:posix-guard": "npm run build && node scripts/test-posix-guard.js",
42
45
  "test:shell-parity": "npm run build && node scripts/test-shell-parity.js",
43
46
  "test:secret-posture": "npm run build && node scripts/test-secret-posture-fixtures.js",
47
+ "test:discover-project-roots": "npm run build && node scripts/test-discover-project-roots.js",
44
48
  "test:agent-file-posture": "npm run build && node scripts/test-agent-file-posture.js",
45
49
  "test:extension-inventory": "npm run build && node scripts/test-extension-inventory.js",
46
50
  "test:realworld-posture": "npm run build && node scripts/test-realworld-posture-fixtures.js",
@@ -76,6 +80,7 @@
76
80
  "test:updater-hold": "npm run build && node scripts/test-updater-hold-resilience.js",
77
81
  "test:deep-selftest": "npm run build && node scripts/test-deep-selftest.js",
78
82
  "test:update-loop": "npm run build && node scripts/test-update-loop-detection.js",
83
+ "test:npm-self-update": "npm run build && node scripts/test-npm-self-update.js",
79
84
  "test:bricked-rescue": "npm run build && node scripts/test-bricked-machine-rescue.js",
80
85
  "test:native-credstore": "npm run build && node scripts/test-native-credential-store.js",
81
86
  "test:machine-key-file": "npm run build && node scripts/test-machine-key-file.js",
@@ -84,6 +89,8 @@
84
89
  "test:daemon-reenroll": "npm run build && node scripts/test-daemon-reenroll-reload.js",
85
90
  "test:real-life": "npm run build && node scripts/test-real-life-scenarios.js",
86
91
  "test:node-updater": "npm run build && node scripts/test-node-updater.js",
92
+ "test:updater-race": "npm run build && node scripts/test-updater-race-guards.js",
93
+ "test:recovery-task": "node scripts/test-recovery-task.js",
87
94
  "test:desktop-chat-guard": "npm run build && node scripts/test-desktop-chat-guard.js",
88
95
  "test:policy-gate-health": "npm run build && node scripts/test-policy-gate-health.js",
89
96
  "test:parallel-hooks": "npm run build && node scripts/test-parallel-hooks.js",
@@ -105,6 +112,8 @@
105
112
  "test:qa-loop": "node scripts/test-qa-command-generator.js && node scripts/test-qa-loop-offline.js && node scripts/test-qa-loop-server.js",
106
113
  "qa-loop": "node scripts/run-machine-qa-loop.js --offline",
107
114
  "test:ide-fp-corpus": "npm run build && node scripts/test-ide-fp-corpus.js",
115
+ "fuzz:fp": "npm run build && node scripts/fuzz/fp-run.js",
116
+ "fuzz:fp:ci": "npm run build && node scripts/test-ide-fp-corpus.js && node scripts/fuzz/fp-run.js --time 60",
108
117
  "test:web-dev-policy-eval": "npm run build && node scripts/test-web-dev-policy-eval.js",
109
118
  "test:secret-shapes": "npm run build && node scripts/test-secret-locator-shapes.js",
110
119
  "test:ide-fp-corpus:hook": "npm run build && node scripts/test-ide-fp-corpus.js --hook",
@@ -131,6 +140,7 @@
131
140
  "@types/node": "^25.3.0",
132
141
  "acorn": "8.18.0",
133
142
  "esbuild": "0.28.2",
143
+ "fast-check": "^4.10.2",
134
144
  "tree-sitter-bash": "^0.25.1",
135
145
  "typescript": "^5.3.0",
136
146
  "web-tree-sitter": "^0.25.10"