@hellolynk-ai/codex-plugin 0.2.102-macos.1 → 0.2.103

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 (26) hide show
  1. package/README.md +17 -17
  2. package/bin/hellolynk-client-setup.mjs +7 -2
  3. package/hellolynk-client-pack-manifest.json +36 -56
  4. package/hellolynk-client-pack-pin.json +1 -1
  5. package/package.json +4 -8
  6. package/plugins/hellolynk-codex/.codex-plugin/plugin.json +1 -1
  7. package/plugins/hellolynk-codex/.mcp.json +19 -20
  8. package/plugins/hellolynk-codex/package.json +1 -1
  9. package/plugins/hellolynk-codex/runtime/bootstrap/core/hellolynk-darwin-host.mjs +45 -32
  10. package/plugins/hellolynk-codex/runtime/core/hellolynk-client-update-entry.mjs +3 -3
  11. package/plugins/hellolynk-codex/runtime/core/hellolynk-client-update-runtime.mjs +47 -34
  12. package/plugins/hellolynk-codex/runtime/core/hellolynk-client-update.mjs +46 -16
  13. package/plugins/hellolynk-codex/runtime/core/hellolynk-darwin-host.mjs +45 -32
  14. package/plugins/hellolynk-codex/runtime/core/hellolynk-neutral-host-process.mjs +1 -1
  15. package/plugins/hellolynk-codex/runtime/core/hellolynk-release-retention.mjs +34 -11
  16. package/plugins/hellolynk-codex/runtime/neutral-host-release-manifest.json +11 -27
  17. package/plugins/hellolynk-codex/runtime/neutral-host-release-pin.json +1 -1
  18. package/plugins/hellolynk-codex/runtime/platform/windows/credential-store.ps1 +46 -10
  19. package/plugins/hellolynk-codex/server/codex-neutral-production.mjs +2 -2
  20. package/plugins/hellolynk-codex/server/mcp-server.mjs +1193 -1193
  21. package/plugins/hellolynk-codex/server/native-conversation-directory.mjs +33 -33
  22. package/plugins/hellolynk-codex/server/workbench-runtime.mjs +42 -42
  23. package/plugins/hellolynk-codex/runtime/bootstrap/platform/darwin/hellolynk-keychain-helper.bin +0 -0
  24. package/plugins/hellolynk-codex/runtime/bootstrap/platform/darwin/hellolynk-keychain-helper.swift +0 -149
  25. package/plugins/hellolynk-codex/runtime/platform/darwin/hellolynk-keychain-helper.bin +0 -0
  26. package/plugins/hellolynk-codex/runtime/platform/darwin/hellolynk-keychain-helper.swift +0 -149
@@ -85,8 +85,27 @@ public static class HelloLynkWindowsFileNative {
85
85
  [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
86
86
  public static extern bool MoveFileExW(string existingName, string newName, uint flags);
87
87
 
88
+ [StructLayout(LayoutKind.Sequential)]
89
+ private struct SECURITY_ATTRIBUTES {
90
+ public int Length;
91
+ public IntPtr SecurityDescriptor;
92
+ public int InheritHandle;
93
+ }
94
+
88
95
  [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
89
- public static extern bool CreateDirectoryW(string path, IntPtr securityAttributes);
96
+ private static extern bool CreateDirectoryW(string path, ref SECURITY_ATTRIBUTES attributes);
97
+
98
+ public static bool CreateProtectedDirectory(string path, byte[] descriptor) {
99
+ var pinned = GCHandle.Alloc(descriptor, GCHandleType.Pinned);
100
+ try {
101
+ var attributes = new SECURITY_ATTRIBUTES {
102
+ Length = Marshal.SizeOf<SECURITY_ATTRIBUTES>(),
103
+ SecurityDescriptor = pinned.AddrOfPinnedObject(),
104
+ InheritHandle = 0
105
+ };
106
+ return CreateDirectoryW(path, ref attributes);
107
+ } finally { pinned.Free(); }
108
+ }
90
109
  }
91
110
  '@
92
111
 
@@ -162,7 +181,7 @@ function Get-HelloLynkExistingAncestorDirectories([string]$RootPath) {
162
181
  return $ordered
163
182
  }
164
183
 
165
- function Assert-HelloLynkTrustedAncestorAcl([string]$RootPath) {
184
+ function Assert-HelloLynkTrustedAncestorAcl([string]$RootPath, [bool]$Create = $false) {
166
185
  $rootParent = [IO.Path]::GetDirectoryName($RootPath.TrimEnd([char[]]@('\', '/')))
167
186
  $directories = @(Get-HelloLynkExistingAncestorDirectories $RootPath)
168
187
  $dangerousRights = (
@@ -175,6 +194,8 @@ function Assert-HelloLynkTrustedAncestorAcl([string]$RootPath) {
175
194
  [Security.AccessControl.FileSystemRights]::ChangePermissions -bor
176
195
  [Security.AccessControl.FileSystemRights]::TakeOwnership
177
196
  )
197
+ $createRights = [Security.AccessControl.FileSystemRights]::CreateFiles -bor
198
+ [Security.AccessControl.FileSystemRights]::CreateDirectories
178
199
  foreach ($directory in $directories) {
179
200
  Assert-HelloLynkNoReparseAncestors $directory
180
201
  $identity = Open-HelloLynkIdentity $directory $true
@@ -204,6 +225,7 @@ function Assert-HelloLynkTrustedAncestorAcl([string]$RootPath) {
204
225
  )
205
226
  $isRootParent = $directory.Equals($rootParent, [StringComparison]::OrdinalIgnoreCase)
206
227
  $directoryIndex = [Array]::IndexOf($directories, $directory)
228
+ $willCreateProtectedChild = $Create -and -not $isRootParent -and $directoryIndex -eq $directories.Count - 1
207
229
  $nextDirectoryProtected = $false
208
230
  if ($directoryIndex -ge 0 -and $directoryIndex + 1 -lt $directories.Count) {
209
231
  try {
@@ -220,15 +242,20 @@ function Assert-HelloLynkTrustedAncestorAcl([string]$RootPath) {
220
242
  ) { continue }
221
243
  $rights = $rule.FileSystemRights
222
244
  $hasDangerousRights = (($rights -band $dangerousRights) -ne 0)
245
+ # A competing child created by a different user fails our owner check.
246
+ # A grant to alter the ancestor itself still prevents first creation.
247
+ $canCreateProtectedChild = $willCreateProtectedChild -and
248
+ (($rights -band $dangerousRights -band (-bnot $createRights)) -eq 0)
223
249
  $hasDeleteChild = (
224
250
  ($rights -band [Security.AccessControl.FileSystemRights]::DeleteSubdirectoriesAndFiles) -ne 0
225
251
  )
226
252
  if (
227
253
  $hasDeleteChild -or
228
- ($hasDangerousRights -and ($isRootParent -or -not $nextDirectoryProtected))
254
+ ($hasDangerousRights -and ($isRootParent -or (-not $nextDirectoryProtected -and -not $canCreateProtectedChild)))
229
255
  ) { Fail "client_root_ancestor_dacl_untrusted" }
230
256
  }
231
257
  }
258
+ return $directories[-1]
232
259
  }
233
260
 
234
261
  function New-HelloLynkAcl([bool]$Directory) {
@@ -361,7 +388,7 @@ function Exit-HelloLynkRootMutex($Mutex) {
361
388
  try { $Mutex.ReleaseMutex() } finally { $Mutex.Dispose() }
362
389
  }
363
390
 
364
- function Ensure-HelloLynkSecureDirectory([string]$PathValue) {
391
+ function Ensure-HelloLynkSecureDirectory([string]$PathValue, [string]$ExistingAncestor = "") {
365
392
  if ([IO.Directory]::Exists($PathValue)) {
366
393
  Assert-HelloLynkNoReparseAncestors $PathValue
367
394
  Assert-HelloLynkSecureAcl $PathValue $true
@@ -370,12 +397,21 @@ function Ensure-HelloLynkSecureDirectory([string]$PathValue) {
370
397
  return
371
398
  }
372
399
  $parent = [IO.Path]::GetDirectoryName($PathValue)
373
- if (-not [IO.Directory]::Exists($parent)) { Ensure-HelloLynkSecureDirectory $parent }
374
- if (-not [HelloLynkWindowsFileNative]::CreateDirectoryW($PathValue, [IntPtr]::Zero)) {
400
+ if ($ExistingAncestor) {
401
+ if (-not $parent.Equals($ExistingAncestor, [StringComparison]::OrdinalIgnoreCase)) {
402
+ Ensure-HelloLynkSecureDirectory $parent $ExistingAncestor
403
+ }
404
+ } elseif (-not [IO.Directory]::Exists($parent)) {
405
+ Ensure-HelloLynkSecureDirectory $parent
406
+ }
407
+ Assert-HelloLynkNoReparseAncestors $PathValue
408
+ $descriptor = (New-HelloLynkAcl $true).GetSecurityDescriptorBinaryForm()
409
+ if (-not [HelloLynkWindowsFileNative]::CreateProtectedDirectory($PathValue, $descriptor)) {
375
410
  Fail "client_root_create_race"
376
411
  }
377
- Set-HelloLynkSecureAcl $PathValue $true
378
412
  Assert-HelloLynkNoReparseAncestors $PathValue
413
+ # Keep the Windows auto-inheritance marker used by child file ACL checks.
414
+ Set-HelloLynkSecureAcl $PathValue $true
379
415
  Assert-HelloLynkSecureAcl $PathValue $true
380
416
  $identity = Open-HelloLynkIdentity $PathValue $true
381
417
  $identity.Handle.Dispose()
@@ -386,14 +422,14 @@ function Resolve-HelloLynkClientRoot([string]$RootValue, [bool]$Create) {
386
422
  Assert-HelloLynkNoReparseAncestors $root
387
423
  $mutex = Enter-HelloLynkRootMutex $root
388
424
  try {
389
- Assert-HelloLynkTrustedAncestorAcl $root
390
- if ($Create) { Ensure-HelloLynkSecureDirectory $root }
425
+ $existingAncestor = Assert-HelloLynkTrustedAncestorAcl $root $Create
426
+ if ($Create) { Ensure-HelloLynkSecureDirectory $root $existingAncestor }
391
427
  if (-not [IO.Directory]::Exists($root)) { Fail "client_root_missing" }
392
428
  Assert-HelloLynkNoReparseAncestors $root
393
429
  Assert-HelloLynkSecureAcl $root $true
394
430
  $identity = Open-HelloLynkIdentity $root $true
395
431
  try {
396
- Assert-HelloLynkTrustedAncestorAcl $root
432
+ $null = Assert-HelloLynkTrustedAncestorAcl $root
397
433
  $canonical = $root
398
434
  } finally { $identity.Handle.Dispose() }
399
435
  return [pscustomobject]@{ Root = $canonical; Mutex = $mutex }
@@ -24,7 +24,7 @@ const TRUSTED_BOOTSTRAP_FILES = Object.freeze(new Map([
24
24
  ["runtime/neutral-host-release-loader.mjs", "283a20c6a9b90481bc03c143ab51d5289abf7b7a86fbe51fba7ea2ae1e6d2c60"],
25
25
  ["runtime/neutral-host-bootstrap.mjs", "53513deed7f0155a6603a1489d1609fae37776442358181ff7650d0cd9351f0a"],
26
26
  ["runtime/bootstrap/core/hellolynk-runtime-safety.cjs", "43d576d9f774409f4a735793c1503a6f397e787b10c59a4ac9cc9257299f5efe"],
27
- ["runtime/bootstrap/core/hellolynk-darwin-host.mjs", "0772d7a23280b18d5bc59383a6a14fd2ecfd9de1ec53b351be0250770e3e2e70"],
27
+ ["runtime/bootstrap/core/hellolynk-darwin-host.mjs", "ded97c3bc3dd65ca75305f5199a1340dffb987a5f283454d60586df8b6b55c09"],
28
28
  ["runtime/bootstrap/core/hellolynk-darwin-vault.mjs", "b6094d856af016e674e4a0183a4e474397bbe92e66638743fa62fe085b554d30"],
29
29
  ["runtime/bootstrap/core/hellolynk-host-protected-store.mjs", "10f81f4f6a5dd2fe9a742e847b2eb47dbf20f802f4414f46a05ccbc3505148e2"],
30
30
  ["runtime/bootstrap/core/hellolynk-neutral-host-installation-store.mjs", "42ae1e7deb876a8308b7bfed6a7b891d1834117b62504fc5befe3f91a0b4c740"],
@@ -34,7 +34,7 @@ const TRUSTED_BOOTSTRAP_FILES = Object.freeze(new Map([
34
34
  ["runtime/bootstrap/core/hellolynk-client-core.mjs", "94bbad1d0ccee969bbffed176449e427188f1b892512a64167ab31f63d258e2b"],
35
35
  ["runtime/bootstrap/platform/windows/hellolynk-host-protected-store.ps1", "24357e8ce54090b4ec68e457f02c9e834a80f3273ef3c03a8c0fa7258797fb49"],
36
36
  ...(process.platform === "darwin" ? [
37
- ["runtime/bootstrap/platform/darwin/hellolynk-keychain-helper.bin", "f1a782c08229ebc0e8d1704b6390e91c5695e084b4df0a1a6dc043f6b23700ab"],
37
+ ["runtime/bootstrap/platform/darwin/hellolynk-keychain-helper.bin", "0000000000000000000000000000000000000000000000000000000000000000"],
38
38
  ] : []),
39
39
  ]));
40
40