@reason-machines/cli-darwin-arm64 0.2.242 → 0.2.244
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.txt +20 -297
- package/bin/Background/Reason.app/Contents/Helpers/ReasonPermissionTile +0 -0
- package/bin/Background/Reason.app/Contents/Info.plist +2 -2
- package/bin/Background/Reason.app/Contents/MacOS/ReasonBackgroundIdentity +0 -0
- package/bin/Background/Reason.app/Contents/_CodeSignature/CodeResources +9 -0
- package/bin/ara +2 -2
- package/bin/libara_device_keychain.dylib +0 -0
- package/bin/runtime/srt/sandbox-runtime.mjs +1 -1
- package/package.json +1 -1
package/THIRD_PARTY_NOTICES.txt
CHANGED
|
@@ -316,33 +316,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
316
316
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
317
317
|
SOFTWARE.
|
|
318
318
|
|
|
319
|
-
----------------------------------------
|
|
320
|
-
|
|
321
|
-
@modelcontextprotocol/sdk@1.31.0
|
|
322
|
-
LICENSE
|
|
323
|
-
MIT License
|
|
324
|
-
|
|
325
|
-
Copyright (c) 2024 Anthropic, PBC
|
|
326
|
-
|
|
327
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
328
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
329
|
-
in the Software without restriction, including without limitation the rights
|
|
330
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
331
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
332
|
-
furnished to do so, subject to the following conditions:
|
|
333
|
-
|
|
334
|
-
The above copyright notice and this permission notice shall be included in all
|
|
335
|
-
copies or substantial portions of the Software.
|
|
336
|
-
|
|
337
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
338
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
339
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
340
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
341
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
342
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
343
|
-
SOFTWARE.
|
|
344
|
-
|
|
345
|
-
|
|
346
319
|
----------------------------------------
|
|
347
320
|
|
|
348
321
|
@pondwader/socks5-server@1.0.10
|
|
@@ -369,88 +342,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
369
342
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
370
343
|
|
|
371
344
|
|
|
372
|
-
----------------------------------------
|
|
373
|
-
|
|
374
|
-
ajv-formats@3.0.1
|
|
375
|
-
LICENSE
|
|
376
|
-
MIT License
|
|
377
|
-
|
|
378
|
-
Copyright (c) 2020 Evgeny Poberezkin
|
|
379
|
-
|
|
380
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
381
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
382
|
-
in the Software without restriction, including without limitation the rights
|
|
383
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
384
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
385
|
-
furnished to do so, subject to the following conditions:
|
|
386
|
-
|
|
387
|
-
The above copyright notice and this permission notice shall be included in all
|
|
388
|
-
copies or substantial portions of the Software.
|
|
389
|
-
|
|
390
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
391
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
392
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
393
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
394
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
395
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
396
|
-
SOFTWARE.
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
----------------------------------------
|
|
400
|
-
|
|
401
|
-
ajv@8.20.0
|
|
402
|
-
LICENSE
|
|
403
|
-
The MIT License (MIT)
|
|
404
|
-
|
|
405
|
-
Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
406
|
-
|
|
407
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
408
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
409
|
-
in the Software without restriction, including without limitation the rights
|
|
410
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
411
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
412
|
-
furnished to do so, subject to the following conditions:
|
|
413
|
-
|
|
414
|
-
The above copyright notice and this permission notice shall be included in all
|
|
415
|
-
copies or substantial portions of the Software.
|
|
416
|
-
|
|
417
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
418
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
419
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
420
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
421
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
422
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
423
|
-
SOFTWARE.
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
----------------------------------------
|
|
428
|
-
|
|
429
|
-
cross-spawn@7.0.6
|
|
430
|
-
LICENSE
|
|
431
|
-
The MIT License (MIT)
|
|
432
|
-
|
|
433
|
-
Copyright (c) 2018 Made With MOXY Lda <hello@moxy.studio>
|
|
434
|
-
|
|
435
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
436
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
437
|
-
in the Software without restriction, including without limitation the rights
|
|
438
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
439
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
440
|
-
furnished to do so, subject to the following conditions:
|
|
441
|
-
|
|
442
|
-
The above copyright notice and this permission notice shall be included in
|
|
443
|
-
all copies or substantial portions of the Software.
|
|
444
|
-
|
|
445
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
446
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
447
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
448
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
449
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
450
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
451
|
-
THE SOFTWARE.
|
|
452
|
-
|
|
453
|
-
|
|
454
345
|
----------------------------------------
|
|
455
346
|
|
|
456
347
|
diff@8.0.4
|
|
@@ -513,68 +404,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
513
404
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
514
405
|
|
|
515
406
|
|
|
516
|
-
----------------------------------------
|
|
517
|
-
|
|
518
|
-
fast-deep-equal@3.1.3
|
|
519
|
-
LICENSE
|
|
520
|
-
MIT License
|
|
521
|
-
|
|
522
|
-
Copyright (c) 2017 Evgeny Poberezkin
|
|
523
|
-
|
|
524
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
525
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
526
|
-
in the Software without restriction, including without limitation the rights
|
|
527
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
528
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
529
|
-
furnished to do so, subject to the following conditions:
|
|
530
|
-
|
|
531
|
-
The above copyright notice and this permission notice shall be included in all
|
|
532
|
-
copies or substantial portions of the Software.
|
|
533
|
-
|
|
534
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
535
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
536
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
537
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
538
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
539
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
540
|
-
SOFTWARE.
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
----------------------------------------
|
|
544
|
-
|
|
545
|
-
fast-uri@3.1.8
|
|
546
|
-
LICENSE
|
|
547
|
-
Copyright (c) 2011-2021, Gary Court until https://github.com/garycourt/uri-js/commit/a1acf730b4bba3f1097c9f52e7d9d3aba8cdcaae
|
|
548
|
-
Copyright (c) 2021-present The Fastify team <https://github.com/fastify/fastify#team>
|
|
549
|
-
All rights reserved.
|
|
550
|
-
|
|
551
|
-
Redistribution and use in source and binary forms, with or without
|
|
552
|
-
modification, are permitted provided that the following conditions are met:
|
|
553
|
-
* Redistributions of source code must retain the above copyright
|
|
554
|
-
notice, this list of conditions and the following disclaimer.
|
|
555
|
-
* Redistributions in binary form must reproduce the above copyright
|
|
556
|
-
notice, this list of conditions and the following disclaimer in the
|
|
557
|
-
documentation and/or other materials provided with the distribution.
|
|
558
|
-
* The names of any contributors may not be used to endorse or promote
|
|
559
|
-
products derived from this software without specific prior written
|
|
560
|
-
permission.
|
|
561
|
-
|
|
562
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
563
|
-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
564
|
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
565
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY
|
|
566
|
-
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
567
|
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
568
|
-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
569
|
-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
570
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
571
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
572
|
-
|
|
573
|
-
* * *
|
|
574
|
-
|
|
575
|
-
The complete list of contributors can be found at:
|
|
576
|
-
- https://github.com/garycourt/uri-js/graphs/contributors
|
|
577
|
-
|
|
578
407
|
----------------------------------------
|
|
579
408
|
|
|
580
409
|
get-east-asian-width@1.6.0
|
|
@@ -590,54 +419,6 @@ The above copyright notice and this permission notice shall be included in all c
|
|
|
590
419
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
591
420
|
|
|
592
421
|
|
|
593
|
-
----------------------------------------
|
|
594
|
-
|
|
595
|
-
isexe@2.0.0
|
|
596
|
-
LICENSE
|
|
597
|
-
The ISC License
|
|
598
|
-
|
|
599
|
-
Copyright (c) Isaac Z. Schlueter and Contributors
|
|
600
|
-
|
|
601
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
602
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
603
|
-
copyright notice and this permission notice appear in all copies.
|
|
604
|
-
|
|
605
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
606
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
607
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
608
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
609
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
610
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
611
|
-
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
----------------------------------------
|
|
615
|
-
|
|
616
|
-
json-schema-traverse@1.0.0
|
|
617
|
-
LICENSE
|
|
618
|
-
MIT License
|
|
619
|
-
|
|
620
|
-
Copyright (c) 2017 Evgeny Poberezkin
|
|
621
|
-
|
|
622
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
623
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
624
|
-
in the Software without restriction, including without limitation the rights
|
|
625
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
626
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
627
|
-
furnished to do so, subject to the following conditions:
|
|
628
|
-
|
|
629
|
-
The above copyright notice and this permission notice shall be included in all
|
|
630
|
-
copies or substantial portions of the Software.
|
|
631
|
-
|
|
632
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
633
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
634
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
635
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
636
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
637
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
638
|
-
SOFTWARE.
|
|
639
|
-
|
|
640
|
-
|
|
641
422
|
----------------------------------------
|
|
642
423
|
|
|
643
424
|
marked@18.0.11
|
|
@@ -1051,21 +832,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
1051
832
|
SOFTWARE.
|
|
1052
833
|
|
|
1053
834
|
|
|
1054
|
-
----------------------------------------
|
|
1055
|
-
|
|
1056
|
-
path-key@3.1.1
|
|
1057
|
-
license
|
|
1058
|
-
MIT License
|
|
1059
|
-
|
|
1060
|
-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
1061
|
-
|
|
1062
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
1063
|
-
|
|
1064
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
1065
|
-
|
|
1066
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
835
|
----------------------------------------
|
|
1070
836
|
|
|
1071
837
|
playwright-core@1.60.0
|
|
@@ -1326,74 +1092,31 @@ SOFTWARE.
|
|
|
1326
1092
|
|
|
1327
1093
|
----------------------------------------
|
|
1328
1094
|
|
|
1329
|
-
|
|
1330
|
-
license
|
|
1331
|
-
MIT License
|
|
1332
|
-
|
|
1333
|
-
Copyright (c) Kevin Mårtensson <kevinmartensson@gmail.com> (github.com/kevva)
|
|
1334
|
-
|
|
1335
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
1336
|
-
|
|
1337
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
1338
|
-
|
|
1339
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
----------------------------------------
|
|
1343
|
-
|
|
1344
|
-
shebang-regex@3.0.0
|
|
1345
|
-
license
|
|
1346
|
-
MIT License
|
|
1347
|
-
|
|
1348
|
-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
1349
|
-
|
|
1350
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
1351
|
-
|
|
1352
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
1353
|
-
|
|
1354
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
----------------------------------------
|
|
1358
|
-
|
|
1359
|
-
which@2.0.2
|
|
1095
|
+
toml@4.2.0
|
|
1360
1096
|
LICENSE
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
Copyright (c) Isaac Z. Schlueter and Contributors
|
|
1364
|
-
|
|
1365
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
1366
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
1367
|
-
copyright notice and this permission notice appear in all copies.
|
|
1368
|
-
|
|
1369
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
1370
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
1371
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
1372
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
1373
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
1374
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
1375
|
-
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
1097
|
+
Copyright (c) 2012 Michelle Tilley
|
|
1376
1098
|
|
|
1099
|
+
Permission is hereby granted, free of charge, to any person
|
|
1100
|
+
obtaining a copy of this software and associated documentation
|
|
1101
|
+
files (the "Software"), to deal in the Software without
|
|
1102
|
+
restriction, including without limitation the rights to use,
|
|
1103
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1104
|
+
copies of the Software, and to permit persons to whom the
|
|
1105
|
+
Software is furnished to do so, subject to the following
|
|
1106
|
+
conditions:
|
|
1377
1107
|
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
zod-to-json-schema@3.25.2
|
|
1381
|
-
LICENSE
|
|
1382
|
-
ISC License
|
|
1383
|
-
|
|
1384
|
-
Copyright (c) 2020, Stefan Terdell
|
|
1108
|
+
The above copyright notice and this permission notice shall be
|
|
1109
|
+
included in all copies or substantial portions of the Software.
|
|
1385
1110
|
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1111
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
1112
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
1113
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
1114
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
1115
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
1116
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
1117
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
1118
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
1389
1119
|
|
|
1390
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
1391
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
1392
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
1393
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
1394
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
1395
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
1396
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
1397
1120
|
|
|
1398
1121
|
----------------------------------------
|
|
1399
1122
|
|
|
Binary file
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
<key>CFBundlePackageType</key>
|
|
16
16
|
<string>APPL</string>
|
|
17
17
|
<key>CFBundleShortVersionString</key>
|
|
18
|
-
<string>0.2.
|
|
18
|
+
<string>0.2.244</string>
|
|
19
19
|
<key>CFBundleVersion</key>
|
|
20
|
-
<string>0.2.
|
|
20
|
+
<string>0.2.244</string>
|
|
21
21
|
<key>LSBackgroundOnly</key>
|
|
22
22
|
<true/>
|
|
23
23
|
<key>LSMinimumSystemVersion</key>
|
|
Binary file
|
|
@@ -11,6 +11,15 @@
|
|
|
11
11
|
</dict>
|
|
12
12
|
<key>files2</key>
|
|
13
13
|
<dict>
|
|
14
|
+
<key>Helpers/ReasonPermissionTile</key>
|
|
15
|
+
<dict>
|
|
16
|
+
<key>cdhash</key>
|
|
17
|
+
<data>
|
|
18
|
+
Fc9BOBELKreWKw8ek/Wy9/CsFNA=
|
|
19
|
+
</data>
|
|
20
|
+
<key>requirement</key>
|
|
21
|
+
<string>identifier "so.ara.cli.permission-tile" and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = "5LJFSBRY2F"</string>
|
|
22
|
+
</dict>
|
|
14
23
|
<key>Resources/AppIcon.icns</key>
|
|
15
24
|
<dict>
|
|
16
25
|
<key>hash2</key>
|
package/bin/ara
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/bin/ara
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 72513888 bytes
|
|
4
|
+
sha256: 9e2238ea2385d3a5cb8591a14be10c522d7dcee7686310013da1135547d8363b
|
|
Binary file
|
|
@@ -63,7 +63,7 @@ mux backend dial failed (${H})
|
|
|
63
63
|
`,{flag:"wx",mode:384}),s.renameSync(Q,nJ.join($,`${X}.stub`))}function p4($,J){return(J.type==="f"?$.isFile()&&$.size===BigInt(0):$.isDirectory())&&$.uid===BigInt(J.uid)&&$.dev===J.dev&&$.ino===J.ino&&$.ctimeNs===J.ctimeNs}function w7($){let J=nJ.dirname($),X;try{X=s.openSync(J,s.constants.O_RDONLY|s.constants.O_DIRECTORY|s.constants.O_NOFOLLOW|K9)}catch{return null}try{if(s.readlinkSync(`/proc/self/fd/${X}`)===J)return X}catch{}return s.closeSync(X),null}function d4($,J,X){return{type:$,uid:Number(J.uid),dev:J.dev,ino:J.ino,ctimeNs:J.ctimeNs,dest:X}}function u6($){let J=w7($);if(J===null)return null;try{let X;try{X=s.openSync(`/proc/self/fd/${J}/${nJ.basename($)}`,s.constants.O_RDONLY|s.constants.O_CREAT|s.constants.O_EXCL|s.constants.O_NOFOLLOW|K9,292)}catch(Q){return gX(Q)==="EEXIST"?"exists":null}try{return f4?.($),d4("f",s.fstatSync(X,{bigint:!0}),$)}finally{s.closeSync(X)}}finally{s.closeSync(J)}}function g6($,J){let X=w7($);if(X===null)return null;try{let Q=`/proc/self/fd/${X}/${nJ.basename($)}`;try{s.mkdirSync(Q,{mode:493})}catch(G){return gX(G)==="EEXIST"?"exists":null}f4?.($);let Y;try{Y=s.openSync(Q,s.constants.O_RDONLY|s.constants.O_DIRECTORY|s.constants.O_NOFOLLOW|K9)}catch{return null}try{let G=s.fstatSync(Y,{bigint:!0});if(!G.isDirectory()||G.uid!==BigInt(process.geteuid?.()??-1)||G.nlink>BigInt(2)||s.readdirSync(`/proc/self/fd/${Y}`).length!==0)return null;if(J)s.fchownSync(Y,J.uid,J.gid);return d4("d",s.fstatSync(Y,{bigint:!0}),$)}catch{return null}finally{s.closeSync(Y)}}finally{s.closeSync(X)}}function m6($){let J=w7($.dest);if(J===null)return;try{let X=`/proc/self/fd/${J}/${nJ.basename($.dest)}`,Q=mX(X);if(typeof Q==="object"&&p4(Q,$)){if($.type==="d")s.rmdirSync(X);else s.unlinkSync(X);Z(`[Sandbox Linux] Removed shared mask stub: ${$.dest}`)}}catch{}finally{s.closeSync(J)}}function l6($){try{s.unlinkSync($)}catch{}}function S7($,J,X,Q){let Y=m4(l4($,J));return Y!==null&&Y.type===Q&&Y.dest===J&&p4(X,Y)}function c4($,J,X){let Q=g4();if(Q===null)return hX;if(v6?.($)==="unregistered")return hX;let Y=mX($);if(Y==="unknown")return hX;if(Y!=="absent")return S7(Q,$,Y,J)?T7:v4;let G=X();if(G==="exists"){let W=mX($);return typeof W==="object"&&S7(Q,$,W,J)?T7:v4}if(G===null)return hX;try{h6(Q,G)}catch(W){Z(`[Sandbox Linux] mask stub marker not written for ${$}: ${W}`,{level:"warn"})}return T7}function p6($){return c4($,"f",()=>u6($))}function d6($,J){return c4($,"d",()=>g6($,J))}function n4($,J){let X=g4();if(X===null)return null;let Q=(G)=>J.some((W)=>G.startsWith(W+"/")),Y=[];for(let G=nJ.dirname($);Q(G);G=nJ.dirname(G))Y.unshift(G);for(let G of Y){let W=mX(G);if(typeof W==="object"&&S7(X,G,W,"d"))return G}return null}function i4($,J){try{return $()}catch(X){if(X instanceof uX)throw X;return Z(`[Sandbox Linux] mask stub not recorded for ${J}: ${X}`,{level:"warn"}),hX}}function P7($){return i4(()=>p6($),$)}function o4($,J){return i4(()=>d6($,J),$)}function c6($){let J;try{J=s.readdirSync($)}catch{return}let X=[],Q=[];for(let G of J){let W=/^([0-9a-f]{64})\.stub(\..*)?$/.exec(G);if(W===null)continue;let U=nJ.join($,G);if(Q.push(U),W[2]===void 0){let M=m4(U);if(M!==null&&I7(M.dest)===W[1])X.push(M)}}let Y=(G)=>G.dest.split("/").length;X.sort((G,W)=>G.type===W.type?Y(W)-Y(G):G.type==="f"?-1:1);for(let G of X)m6(G);for(let G of Q)l6(G)}function _7($,J){let X=C7(),Q=V0!==null;if(z9(),b6(),X==="off"){for(let G of $)J(G);return[]}if(X==="error")return[...$];if(!Q&&$.length===0)return[];let Y=y4(X,"lock");if(Y===null)return[...$];try{if(!b4(Y,["-x","-n"]))return[...$];for(let G of $)if(mX(l4(X,G))==="absent")J(G);return c6(X),[]}catch(G){return Z(`[Sandbox Linux] mask stub sweep failed: ${G}`,{level:"warn"}),[...$]}finally{s.closeSync(Y)}}var k7=3;function i6($){let J=$.uid===void 0?$.bwrapCommand:[$.setprivPath??"/usr/bin/setpriv",`--reuid=${$.uid}`,`--regid=${$.gid??$.uid}`,"--clear-groups","--inh-caps=-all","--ambient-caps=-all","--bounding-set=-all",...$.bwrapCommand],X=$.unsetEnvVars??[],Q=Object.entries($.setEnvVars??{});if(X.length===0&&Q.length===0)return J;return["/usr/bin/env",...X.flatMap((Y)=>["-u",Y]),...Q.map(([Y,G])=>`${Y}=${G}`),...J]}function x7($,J){let X=$.split(f$.sep),Q="";for(let Y of X){if(!Y)continue;let G=Q+f$.sep+Y;try{if(r.lstatSync(G).isSymbolicLink()){if(J.some((M)=>G.startsWith(M+"/")||G===M))return G}}catch{break}Q=G}return null}var o6=40;function r4($){let J=$;for(let X=0;X<o6;X++){try{return r.realpathSync(J)}catch{}let Q=J,Y=[],G=null;while(G===null){let M=f$.dirname(Q);if(M===Q)return null;Y.unshift(f$.basename(Q)),Q=M;try{G=r.realpathSync(Q)}catch{}}let W=f$.join(G,Y[0]),U=null;try{U=r.readlinkSync(W)}catch{}if(U===null)return f$.join(G,...Y);J=f$.join(f$.resolve(f$.dirname(W),U),...Y.slice(1))}return null}function a6($){let J=$.split(f$.sep),X="";for(let Q of J){if(!Q)continue;let Y=X+f$.sep+Q;try{let G=r.statSync(Y);if(G.isFile()||G.isSymbolicLink())return!0}catch{break}X=Y}return!1}function s6($){let J=$.split(f$.sep),X="";for(let Q of J){if(!Q)continue;let Y=X+f$.sep+Q;if(!r.existsSync(Y))return Y;X=Y}return $}async function r6($={command:"rg"},J=k7,X=!1,Q){let Y=process.cwd(),G=new AbortController,W=Q??G.signal,U=qY(),M=[...VX.map((K)=>f$.resolve(Y,K)),...U.map((K)=>f$.resolve(Y,K))],O=f$.resolve(Y,".git"),V=!1;try{V=r.statSync(O).isDirectory()}catch{}if(V){if(M.push(f$.resolve(Y,".git/hooks")),!X)M.push(f$.resolve(Y,".git/config"))}let H=[];for(let K of VX)H.push("--iglob",K);for(let K of U)H.push("--iglob",`**/${K}/**`);if(H.push("--iglob","**/.git/hooks/**"),!X)H.push("--iglob","**/.git/config");let q=["--files","--hidden","--no-ignore","--max-depth",String(J),...H,"-g","!**/node_modules/**"],F;try{F=await D7(q,Y,W,$)}catch(K){if(K instanceof H9)throw Error(`mandatory deny scan failed: ${K}`);Z(`[Sandbox] ripgrep scan failed, retrying once: ${K}`);try{F=await D7(q,Y,W,$)}catch(A){throw Error(`mandatory deny scan failed: ${A}`)}}for(let K of F){let A=f$.resolve(Y,K),L=!1;for(let R of[...U,".git"]){let I=p9(R),j=A.split(f$.sep),C=j.findIndex((w)=>p9(w)===I);if(C!==-1){if(R===".git"){let w=j.slice(0,C+1).join(f$.sep);if(K.includes(".git/hooks"))M.push(f$.join(w,"hooks"));else if(K.includes(".git/config"))M.push(f$.join(w,"config"))}else M.push(j.slice(0,C+1).join(f$.sep));L=!0;break}}if(!L)M.push(A)}return[...new Set(M)]}var lX;function t6(){if(process.getuid?.()!==0||process.env.ARA_SRT_FILE_MASK!=="empty")return"/dev/null";if(lX)try{let X=r.lstatSync(lX);if(X.isFile()&&X.size===0&&X.uid===0&&(X.mode&146)===0)return lX}catch{}let $=r.mkdtempSync(f$.join(F9(),"claude-empty-file-"));N9.add($),r.chmodSync($,493);let J=f$.join($,"empty");return r.writeFileSync(J,"",{flag:"wx",mode:292}),r.chmodSync(J,292),lX=J,J}var pX=new Set,N9=new Set;function t4($,J){return $===J?t6():"/dev/null"}var e6="ARA_SRT_MASKED_PATHS",$K=16384;function JK($,J,X=$K){let Q=[],Y=0;for(let G of new Set($)){if(G.includes(`
|
|
64
64
|
`))continue;if(G!==J&&!G.startsWith(J==="/"?"/":J+"/"))continue;let W=G.split("'").length-1,U=Buffer.byteLength(G)+4*W+(Q.length>0?1:0);if(Y+U>X)break;Q.push(G),Y+=U}return Q.length>0?Q.join(`
|
|
65
65
|
`):void 0}function QK($){try{let J=r.lstatSync($);return J.isFile()&&J.size===0}catch{return!1}}var D0=0,e4=!1;function E9(){if(e4)return;process.on("exit",()=>{L9({force:!0})}),e4=!0}function L9($){if(!$?.force){if(D0>0)D0--;if(D0>0){Z(`[Sandbox Linux] Deferring mount point cleanup \u2014 ${D0} sandbox(es) still active`);return}}else D0=0;let J=[],X=[];for(let G of pX)try{let W=r.statSync(G);if(W.isFile()&&W.size===0)J.push(G);else if(W.isDirectory())X.push(G)}catch{}let Q=(G)=>G.split("/").length;X.sort((G,W)=>Q(W)-Q(G));let Y=_7([...J,...X],(G)=>{try{let W=r.statSync(G);if(W.isFile()&&W.size===0)r.unlinkSync(G),Z(`[Sandbox Linux] Cleaned up bwrap mount point (file): ${G}`);else if(W.isDirectory()){if(r.readdirSync(G).length!==0)return;r.rmdirSync(G),Z(`[Sandbox Linux] Cleaned up bwrap mount point (dir): ${G}`)}}catch{}});pX.clear();for(let G of Y)pX.add(G);for(let G of N9)try{r.rmSync(G,{recursive:!0,force:!0})}catch{}N9.clear(),lX=void 0}function $5($){try{return r.accessSync($,r.constants.X_OK),!0}catch{return!1}}function Q5($){let{seccompConfig:J,bwrapPath:X,socatPath:Q}=$??{},Y=[],G=[];if(X){if(!$5(X))Y.push(`bubblewrap (bwrap) not executable at ${X}`)}else if(R0("bwrap")===null)Y.push("bubblewrap (bwrap) not installed");if(Q){if(!$5(Q))Y.push(`socat not executable at ${Q}`)}else if(R0("socat")===null)Y.push("socat not installed");if(!J?.argv0&&j7(J?.applyPath)===null)G.push("seccomp not available - unix socket access not restricted");return{warnings:G,errors:Y}}async function X5($,J,X,Q,Y){let G=X??"socat",W=n6(8).toString("hex"),U=s4(F9(),`claude-http-${W}.sock`),M=s4(F9(),`claude-socks-${W}.sock`),O=[`UNIX-LISTEN:${U},fork,reuseaddr`,`TCP:localhost:${$},keepalive,keepidle=10,keepintvl=5,keepcnt=3`];Z(`Starting HTTP bridge: ${G} ${O.join(" ")}`);let V=a4(G,O,{stdio:"ignore"});if(V.on("error",(K)=>{Z(`HTTP bridge process error: ${K}`,{level:"error"})}),V.on("exit",(K,A)=>{Z(`HTTP bridge process exited with code ${K}, signal ${A}`,{level:K===0?"info":"error"})}),!V.pid)throw Error("Failed to start HTTP bridge process");let H,q;if(J===$)H=V,q=U;else{q=M;let K=[`UNIX-LISTEN:${M},fork,reuseaddr`,`TCP:localhost:${J},keepalive,keepidle=10,keepintvl=5,keepcnt=3`];if(Z(`Starting SOCKS bridge: ${G} ${K.join(" ")}`),H=a4(G,K,{stdio:"ignore"}),H.on("error",(A)=>{Z(`SOCKS bridge process error: ${A}`,{level:"error"})}),H.on("exit",(A,L)=>{Z(`SOCKS bridge process exited with code ${A}, signal ${L}`,{level:A===0?"info":"error"})}),!H.pid){if(V.pid)try{process.kill(V.pid,"SIGTERM")}catch{}throw Error("Failed to start SOCKS bridge process")}}let F=200;for(let K=0;K<F;K++){if(!V.pid||V.killed||!H.pid||H.killed)throw Error("Linux bridge process died unexpectedly");try{if(r.existsSync(U)&&r.existsSync(q)){if(Q!==void 0){let A=Y??Q;for(let L of new Set([U,q]))r.chownSync(L,Q,A),r.chmodSync(L,384)}Z(`Linux bridges ready after ${K+1} attempts`);break}}catch(A){Z(`Error checking sockets (attempt ${K+1}): ${A}`,{level:"error"})}if(K===F-1){if(V.pid)try{process.kill(V.pid,"SIGTERM")}catch{}if(H.pid)try{process.kill(H.pid,"SIGTERM")}catch{}throw Error(`Failed to create bridge sockets after ${F} attempts`)}await new Promise((A)=>setTimeout(A,5))}return{httpSocketPath:U,socksSocketPath:q,httpBridgeProcess:V,socksBridgeProcess:H,httpProxyPort:$,socksProxyPort:J}}function XK($,J){if(J){if(!$)throw Error("seccompConfig.argv0 requires seccompConfig.applyPath");return`ARGV0=${CJ([J])} ${CJ([$])} `}let X=j7($);return X?`${CJ([X])} `:void 0}function YK($,J,X,Q,Y,G){let W=Y||"bash",U=CJ([G??"socat"]),M=["srt_payload_pid=",`${U} TCP4-LISTEN:3128,bind=127.0.0.1,fork,reuseaddr ${CJ([`UNIX-CONNECT:${$}`])} >/dev/null 2>&1 &`,"srt_http_proxy_pid=$!",`${U} TCP4-LISTEN:1080,bind=127.0.0.1,fork,reuseaddr ${CJ([`UNIX-CONNECT:${J}`])} >/dev/null 2>&1 &`,"srt_socks_proxy_pid=$!","srt_cleanup_command() {"," srt_status=$?"," trap - EXIT INT TERM",' if [ -n "$srt_payload_pid" ]; then',' kill -KILL "$srt_payload_pid" 2>/dev/null',' wait "$srt_payload_pid" 2>/dev/null'," fi",' kill -KILL "$srt_http_proxy_pid" "$srt_socks_proxy_pid" 2>/dev/null',' wait "$srt_http_proxy_pid" "$srt_socks_proxy_pid" 2>/dev/null',' exit "$srt_status"',"}","trap srt_cleanup_command EXIT","trap 'exit 143' TERM","trap 'exit 130' INT",...[3128,1080].map((H)=>`${U} -u OPEN:/dev/null TCP4:127.0.0.1:${H},connect-timeout=0.1,retry=480,interval=0.005 >/dev/null 2>&1 || { printf '%s\\n' 'Sandbox proxy listener readiness failed' >&2; exit 1; }`),`kill -0 "$srt_http_proxy_pid" "$srt_socks_proxy_pid" 2>/dev/null || { printf '%s\\n' 'Sandbox proxy listener exited before command' >&2; exit 1; }`],O=(Q??"")+CJ([W,"-c",X]),V=[...M,`${O} <&0 &`,"srt_payload_pid=$!",'wait "$srt_payload_pid"',"srt_payload_status=$?","srt_payload_pid=",'exit "$srt_payload_status"'].join(`
|
|
66
|
-
`);return`${W} -c ${CJ([V])}`}function v7($){try{if(r.lstatSync($).isSymbolicLink())return r.realpathSync($)}catch{}return $}function J5($,J,X,Q){let Y=J==="/"?"/":J+"/";$.push("--tmpfs",J);for(let G of X)if(G.startsWith(Y)||G===J)$.push("--bind",G,G),Z(`[Sandbox Linux] Re-bound write path wiped by denyRead tmpfs: ${G}`);for(let G of Q)if(G.startsWith(Y)||G===J){if(!r.existsSync(G)){Z(`[Sandbox Linux] Skipping non-existent read allow path: ${G}`);continue}if(X.some((W)=>(W.startsWith(Y)||W===J)&&(G===W||G.startsWith(W+"/"))))continue;$.push("--ro-bind",G,G),Z(`[Sandbox Linux] Re-allowed read access within denied region: ${G}`)}}async function GK($,J,X,Q,Y={command:"rg"},G=k7,W=!1,U,M,O=[]){let V=[],H=[],q=[],F=new Set,K=new Map,A=new Map;if(J){V.push("--ro-bind","/","/");for(let u of J.allowOnly||[]){let J$=XJ(u).replace(/\/+$/,"")||"/";if(Z(`[Sandbox Linux] Processing write path: ${u} -> ${J$}`),J$.startsWith("/dev/")){Z(`[Sandbox Linux] Skipping /dev path: ${J$}`);continue}if(!r.existsSync(J$)){Z(`[Sandbox Linux] Skipping non-existent write path: ${J$}`);continue}try{let a=r.realpathSync(J$),V$=J$.replace(/\/+$/,"");if(a!==V$&&HY(J$,a)){Z(`[Sandbox Linux] Skipping symlink write path pointing outside expected location: ${u} -> ${a}`);continue}}catch{Z(`[Sandbox Linux] Skipping write path that could not be resolved: ${J$}`);continue}V.push("--bind",J$,J$),H.push(J$)}let y,n=()=>{if(y!==void 0)return y;let u=[];for(let a of H){u.push(a);try{let V$=r.realpathSync(a);if(V$!==a)u.push(V$)}catch{}}let J$=[];if($){let a=[],V$=new Set(["proc","dev","sys"]);for(let O$ of $.denyOnly||[])if(XJ(O$)==="/")try{for(let $$ of r.readdirSync("/"))if(!V$.has($$))a.push("/"+$$)}catch{}else a.push(O$);if(r.existsSync("/etc/ssh/ssh_config.d"))a.push("/etc/ssh/ssh_config.d");for(let O$ of a){let $$=XJ(O$),P$=!1;try{P$=r.statSync($$).isDirectory()}catch{continue}if(!P$)continue;J$.push($$);try{let G$=r.realpathSync($$);if(G$!==$$)J$.push(G$)}catch{}}}return y={allowedWritePathsBothForms:u,prospectiveReadDenyTmpfsDirsBothForms:J$},y},Y$=(u)=>H.some((J$)=>u.startsWith(J$+"/")||u===J$),L$=[...J.denyWithinAllow||[],...await r6(Y,G,W,U)];u4();let j$=new Set;for(let u of L$){let J$=XJ(u);if(J$.startsWith("/dev/"))continue;let a=r4(J$);if(a===null||a.startsWith("/dev/"))continue;if(x7(a,H))continue;let V$=!1;try{V$=r.statSync(a).isDirectory()}catch{continue}if(!V$)continue;if(Y$(a)){let O$=K.get(a);if(O$===void 0)O$=new Set,K.set(a,O$);O$.add(J$)}}let QJ=new Map,S$=(u)=>{let J$=QJ.get(u);if(J$!==void 0)return J$;let{allowedWritePathsBothForms:a,prospectiveReadDenyTmpfsDirsBothForms:V$}=n(),O$=a.some(($$)=>$$.startsWith(u+"/"))||V$.some(($$)=>$$===u||$$.startsWith(u+"/"))||V$.some(($$)=>[u,...K.get(u)??[]].some((P$)=>P$===$$||P$.startsWith($$+"/")));return QJ.set(u,O$),O$},h$=[...K.keys()];for(let u of L$){let J$=XJ(u);if(J$.startsWith("/dev/"))continue;let a=r4(J$);if(a===null){let $$=x7(J$,H);if($$&&!j$.has($$))j$.add($$),q.push("--ro-bind","/dev/null",$$),A.set($$,J$);Z(`[Sandbox Linux] Deny path could not be resolved through symlinks, failing closed: ${J$}`);continue}if(a!==J$)Z(`[Sandbox Linux] Resolved symlinked deny path: ${J$} -> ${a}`);if(a.startsWith("/dev/"))continue;if(j$.has(a))continue;j$.add(a);let V$=x7(a,H);if(V$){if(!j$.has(V$))j$.add(V$),q.push("--ro-bind","/dev/null",V$),A.set(V$,J$);Z(`[Sandbox Linux] Mounted /dev/null at symlink ${V$} to prevent symlink replacement attack`);continue}if(!r.existsSync(a)){if(a6(a)){Z(`[Sandbox Linux] Skipping deny path with file ancestor (cannot create paths under a file): ${a}`);continue}let $$=f$.dirname(a);while($$!=="/"&&!r.existsSync($$))$$=f$.dirname($$);let P$=Y$($$)||Y$(a),G$=h$.filter((x$)=>$$===x$||$$.startsWith(x$+"/")),c$=G$.length>0&&!G$.some(S$);if(P$&&!c$){let x$=s6(a),E$=n4(x$,H)??x$;if(E$!==a){if(!F.has(E$)){let n$=o4(E$,M),y$=r.mkdtempSync(f$.join(F9(),"claude-empty-"));if(r.chmodSync(y$,365),N9.add(y$),q.push("--ro-bind",y$,E$),A.set(E$,J$),F.add(E$),n$.kind==="unregistered")pX.add(E$);E9(),Z(`[Sandbox Linux] Mounted empty dir at ${E$} to block creation of ${a}`)}}else{let n$=P7(E$),y$=t4(a,J$);if(n$.kind==="masked")q.push("--ro-bind",y$,E$),A.set(E$,J$),E9(),Z(`[Sandbox Linux] Masked shared stub at ${E$} with ${y$} to block creation of ${a}`);else if(n$.kind==="real")q.push("--ro-bind",E$,E$),A.set(E$,J$);else q.push("--ro-bind",y$,E$),A.set(E$,J$),pX.add(E$),E9(),Z(`[Sandbox Linux] Mounted ${y$} at ${E$} to block creation of ${a}`)}}else if(c$)Z(`[Sandbox Linux] Skipping non-existent deny path inside a read-only denied directory (already uncreatable): ${a}`);else Z(`[Sandbox Linux] Skipping non-existent deny path not within allowed paths: ${a}`);continue}if(Y$(a)){if((QK(a)?P7(a):void 0)?.kind==="masked")q.push("--ro-bind",t4(a,J$),a),E9();else q.push("--ro-bind",a,a);A.set(a,J$)}else Z(`[Sandbox Linux] Skipping deny path not within allowed paths: ${a}`)}}else V.push("--bind","/","/");let L=[],R=($?.allowWithinDeny||[]).map((y)=>XJ(y)),I=new Map,j=[],C=new Set(["proc","dev","sys"]);for(let y of $?.denyOnly||[])if(XJ(y)==="/"){for(let n of r.readdirSync("/"))if(!C.has(n))L.push("/"+n)}else L.push(y);if($&&r.existsSync("/etc/ssh/ssh_config.d"))L.push("/etc/ssh/ssh_config.d");let w=L.map((y)=>XJ(y)).sort((y,n)=>y.split("/").length-n.split("/").length);for(let y of w){if(!r.existsSync(y)){Z(`[Sandbox Linux] Skipping non-existent read deny path: ${y}`);continue}if(r.statSync(y).isDirectory())j.push(y),J5(V,y,H,R);else{if(R.includes(y)){Z(`[Sandbox Linux] Skipping read deny for re-allowed path: ${y}`);continue}let Y$=v7(y);V.push("--ro-bind","/dev/null",Y$),I.set(Y$,"/dev/null"),I.set(y,"/dev/null")}}for(let{realPath:y,fakePath:n}of X??[]){let Y$=v7(y);V.push("--ro-bind",n,Y$),I.set(Y$,n),I.set(y,n)}let P=(y)=>j.some((n)=>{if(!(y===n||y.startsWith(n+"/")))return!1;return!H.some((j$)=>(j$===n||j$.startsWith(n+"/"))&&(y===j$||y.startsWith(j$+"/")))}),l=[...F].filter((y)=>{let n=A.get(y)??y;return!I.has(y)&&!P(y)&&!P(n)&&!H.some((Y$)=>Y$===y||Y$.startsWith(y+"/"))}),e=[];for(let y=0;y<q.length;y+=3){let n=q[y+2],Y$=A.get(n)??n;if(I.has(n))continue;if(P(n)||P(Y$)){Z(`[Sandbox Linux] Skipping denyWrite bind already hidden by denyRead tmpfs: ${n}`);continue}if(l.some((L$)=>n.startsWith(L$+"/"))){Z(`[Sandbox Linux] Skipping denyWrite bind under an empty-directory mask: ${n}`);continue}if(V.push(q[y],q[y+1],n),e.push(n),q[y+1]!==n)O.push(n);if(Y$!==n)e.push(Y$)}for(let y of j)if(e.some((n)=>y.startsWith(n+"/")))Z(`[Sandbox Linux] Re-applying denyRead tmpfs re-exposed by denyWrite bind: ${y}`),J5(V,y,H,R);for(let[y,n]of I)if(e.some((Y$)=>y.startsWith(Y$+"/"))){if(v7(y)!==y)continue;Z(`[Sandbox Linux] Re-applying file mask re-exposed by denyWrite bind: ${y}`),V.push("--ro-bind",n,y)}if(Q!==void 0)V.push("--ro-bind",Q,Q);return V}async function Y5($){let{command:J,commandId:X,needsNetworkRestriction:Q,httpSocketPath:Y,socksSocketPath:G,httpProxyPort:W,socksProxyPort:U,proxyAuthToken:M,caCertPath:O,readConfig:V,writeConfig:H,unsetEnvVars:q,setEnvVars:F,maskedFileBinds:K,maskedFileStoreDir:A,enableWeakerNestedSandbox:L,runAsUid:R,runAsGid:I,runAsHostUid:j,runAsHostGid:C,runAsHostHome:w,runAsHostUser:P,setprivPath:l,allowAllUnixSockets:e,binShell:y,ripgrepConfig:n={command:"rg"},mandatoryDenySearchDepth:Y$=k7,allowGitConfig:L$=!1,gitSafeDirectories:j$,seccompConfig:QJ,bwrapPath:S$,socatPath:h$,observeSocketPath:u,abortSignal:J$}=$,a=V&&V.denyOnly.length>0||K!==void 0&&K.length>0,V$=H!==void 0,O$=q!==void 0&&q.length>0||F!==void 0&&Object.keys(F).length>0,$$=(j$?.length??0)>0;if(!Q&&!a&&!V$&&!O$&&!$$)return J;D0++;let P$=[],G$=["--new-session","--die-with-parent"],c$=[],x$;try{if(!e)if(x$=XK(QJ?.applyPath,QJ?.argv0),!x$)Z("[Sandbox Linux] apply-seccomp binary not available - unix socket blocking disabled. Install @anthropic-ai/sandbox-runtime globally for full protection.",{level:"warn"});else Z("[Sandbox Linux] Applying seccomp filter for Unix socket blocking");else Z("[Sandbox Linux] Skipping seccomp filter - allowAllUnixSockets is enabled");if(u&&x$)if(r.existsSync(u))c$.push("--bind",u,u),G$.push("--setenv","SRT_OBSERVE_SOCK",u),G$.push("--setenv","SRT_ENCODED_CMD",PJ(X??J));else Z("[Sandbox Linux] observe socket missing \u2014 supervisor not running; "+"continuing without violation monitoring");if(O$){for(let b$ of q??[])G$.push("--unsetenv",b$);for(let[b$,i$]of Object.entries(F??{}))G$.push("--setenv",b$,i$)}if(j$&&j$.length>0){let b$=KY({safeDirs:j$,unsetEnvVars:q,setEnvVars:F});for(let[i$,MY]of Object.entries(b$))G$.push("--setenv",i$,MY)}if(Q){if(G$.push("--unshare-net"),Y&&G){if(!r.existsSync(Y))throw Error(`Linux HTTP bridge socket does not exist: ${Y}. The bridge process may have died. Try reinitializing the sandbox.`);if(!r.existsSync(G))throw Error(`Linux SOCKS bridge socket does not exist: ${G}. The bridge process may have died. Try reinitializing the sandbox.`);if(c$.push("--bind",Y,Y),G!==Y)c$.push("--bind",G,G);let b$=ZQ(3128,1080,O,M,H===void 0,PJ(X??J));if(G$.push(...b$.flatMap((i$)=>{let MY=i$.indexOf("="),PU=i$.slice(0,MY),_U=i$.slice(MY+1);return["--setenv",PU,_U]})),W!==void 0)G$.push("--setenv","CLAUDE_CODE_HOST_HTTP_PROXY_PORT",String(W));if(U!==void 0)G$.push("--setenv","CLAUDE_CODE_HOST_SOCKS_PROXY_PORT",String(U))}}let E$=await GK(V,H,K,A,n,Y$,L$,J$,j===void 0?void 0:{uid:j,gid:C??j},P$);z9(),G$.push(...E$);let n$=JK(P$,process.cwd());if(n$!==void 0)G$.push("--setenv",e6,n$);if(G$.push(...c$),G$.push("--dev","/dev"),G$.push("--unshare-pid"),!L){if(G$.push("--unshare-user","--cap-drop","ALL","--proc","/proc"),!x$)G$.push("--ro-bind","/dev/null","/proc/sysrq-trigger")}else G$.push("--unshare-user","--bind","/proc","/proc");if(R!==void 0)G$.push("--uid",String(R)),G$.push("--gid",String(I??R));if(j!==void 0){if(w)G$.push("--setenv","HOME",w);if(P)G$.push("--setenv","USER",P),G$.push("--setenv","LOGNAME",P)}let y$=y||"bash",e$=R0(y$);if(!e$)throw Error(`Shell '${y$}' not found in PATH`);if(G$.push("--",e$,"-c"),Q&&Y&&G){let b$=YK(Y,G,J,x$,e$,h$);G$.push(b$)}else if(x$){let b$=x$+CJ([e$,"-c",J]);G$.push(b$)}else G$.push(J);let GJ=[S$??"bwrap",...G$],WJ=CJ(i6({bwrapCommand:GJ,uid:j,gid:C,setprivPath:l,unsetEnvVars:q,setEnvVars:F})),s$=[];if(Q)s$.push("network");if(a||V$)s$.push("filesystem");if(O$)s$.push("env");if(x$)s$.push("seccomp(unix-block)");return Z(`[Sandbox Linux] Wrapped command with bwrap (${s$.join(", ")} restrictions)`),WJ}catch(E$){if(D0>0)D0--;if(z9(),D0===0)_7([],()=>{});throw E$}}import{spawn as WK}from"child_process";import*as Z0 from"path";class A9{violations=[];totalCount=0;maxSize=100;listeners=new Set;addViolation($){if(this.violations.push({...$,line:f7($.line).replace(/[<>]/g,"")}),this.totalCount++,this.violations.length>this.maxSize)this.violations=this.violations.slice(-this.maxSize);this.notifyListeners()}getViolations($){if($===void 0)return[...this.violations];return this.violations.slice(-$)}getCount(){return this.violations.length}getTotalCount(){return this.totalCount}getViolationsForCommand($){let J=PJ($);return this.violations.filter((X)=>X.encodedCommand===J)}clear(){this.violations=[],this.notifyListeners()}subscribe($){return this.listeners.add($),$(this.getViolations()),()=>{this.listeners.delete($)}}notifyListeners(){let $=this.getViolations();this.listeners.forEach((J)=>J($))}}function dQ($,J,X){if(!X)return!1;if((X["*"]??[]).some((Y)=>$.includes(Y)))return!0;if(J===void 0)return!1;for(let[Y,G]of Object.entries(X))if(Y!=="*"&&J.includes(Y)&&G.some((W)=>$.includes(W)))return!0;return!1}function f7($){return $.replace(/[\x00-\x1f\x7f-\x9f]+/g," ").trim()}function UK($=!1){let J=process.cwd(),X=[];for(let Q of VX)X.push(Z0.resolve(J,Q)),X.push(`**/${Q}`);for(let Q of qY())X.push(Z0.resolve(J,Q)),X.push(`**/${Q}/**`);if(X.push(Z0.resolve(J,".git/hooks")),X.push("**/.git/hooks/**"),!$)X.push(Z0.resolve(J,".git/config")),X.push("**/.git/config");return[...new Set(X)]}var G5=`_${Math.random().toString(36).slice(2,11)}_SBX`;function MK($){return`CMD64_${PJ($)}_END_${G5}`}function cQ($){return NJ($)?`(regex ${iJ(zX($))})`:`(subpath ${iJ($)})`}function u7($){return zX($).slice(0,-1)+"(/.*)?$"}function qQ($){return NJ($)?`(regex ${iJ(u7($))})`:`(subpath ${iJ($)})`}function W5($){return $.replace(/\[[^\]]*\]|[*?]+/g,"x")}function b7($,J){let X=[...new Set(J)];if(X.length===0)return $;let Q=X.map((Y)=>`(require-not ${Y})`).join(" ");return`(require-all ${$} ${Q})`}function y7($){let J=XJ($);return{path:J,glob:NJ(J)}}function U5($,J){return $.test(J.glob?W5(J.path):J.path)}function R9($,J){let X=$.glob?W5($.path):$.path;return X.startsWith(J==="/"?"/":J+"/")&&X!==J}function OK($,J){return{denies:($.denyOnly||[]).map(y7),allows:($.allowWithinDeny||[]).map(y7),writeRoots:(J||[]).map(y7)}}function VK($){let J=[],X=!1,Q=$.allows.filter((Y)=>!Y.glob).map((Y)=>Y.path);for(let Y of $.denies){if(!Y.glob){if(Q.some((U)=>Y.path.startsWith(U+"/")))J.push(qQ(Y.path));continue}let G=new RegExp(u7(Y.path));if(G.test("/"))X=!0;let W=$.allows.filter((U)=>U5(G,U)).map((U)=>cQ(U.path));J.push(b7(qQ(Y.path),W))}return{filters:J,coversRoot:X}}function M5($){let J=$.split(/[*?[\]]/)[0];if(!J||J==="/")return"/";return J.endsWith("/")?J.slice(0,-1):Z0.dirname(J)}function HK($,J){let{denies:X,allows:Q,writeRoots:Y}=$;if(Y.length===0)return[];let G=Y.filter((H)=>H.glob).map((H)=>new RegExp(zX(H.path))),W=Y.filter((H)=>!H.glob).map((H)=>H.path),U=(H)=>W.some((q)=>R9({path:H,glob:!1},q))||G.some((q)=>q.test(H)),M=(H)=>[...Q,...Y].filter((q)=>R9(q,H)).map((q)=>cQ(q.path)),O=new Set,V=(H)=>{for(let q of H)if(U(q))O.add(`(literal ${iJ(q)})`)};for(let H of X)if(H.glob){let q=M5(H.path);if(!(G.length>0||W.some((L)=>q===L||R9({path:q,glob:!1},L)||R9({path:L,glob:!1},q))))continue;let K=new RegExp(u7(H.path)),A=[...Q,...Y].filter((L)=>U5(K,L)).map((L)=>cQ(L.path));if(O.add(b7(qQ(H.path),A)),q!=="/")V([q,...h7(q)])}else{if(!U(H.path))continue;O.add(b7(qQ(H.path),M(H.path))),V(h7(H.path))}return u0("deny",["file-write-unlink"],O,J)}function u0($,J,X,Q){if(X.size===0)return[];return[`(${$} ${J.join(" ")}`,...[...X].map((Y)=>` ${Y}`),` (with message "${Q}"))`]}function h7($){let J=[],X=Z0.dirname($);while(X!=="/"&&X!=="."){J.push(X);let Q=Z0.dirname(X);if(Q===X)break;X=Q}return J}function O5($,J){let X=new Set;for(let Q of $){let Y=XJ(Q);X.add(qQ(Y));let G;if(NJ(Y)){if(G=M5(Y),G==="/")continue;X.add(`(literal ${iJ(G)})`)}else G=Y;for(let W of h7(G))X.add(`(literal ${iJ(W)})`)}return u0("deny",["file-write-unlink","file-write-create"],X,J)}function qK($,J){if(!$)return["(allow file-read*)"];let X=[];X.push("(allow file-read*)");let Q=$.denies.some((M)=>M.path==="/"),Y=new Set($.denies.map((M)=>qQ(M.path)));X.push(...u0("deny",["file-read*"],Y,J));let G=new Set($.allows.map((M)=>cQ(M.path)));X.push(...u0("allow",["file-read*"],G,J));let W=VK($);if(X.push(...u0("deny",["file-read*"],new Set(W.filters),J)),Q||W.coversRoot)X.push('(allow file-read* (literal "/"))');if($.denies.length>0)X.push("(allow file-read-metadata"," (vnode-type DIRECTORY))");X.push(...O5($.denies.map((M)=>M.path),J));let U=new Set($.writeRoots.map((M)=>cQ(M.path)));return X.push(...u0("allow",["file-write-unlink","file-write-create"],U,J)),X}function KK($,J,X=!1){if(!$)return["(allow file-write*)"];let Q=[],Y=new Set;for(let U of $.allowOnly||[])Y.add(cQ(XJ(U)));Q.push(...u0("allow",["file-write*"],Y,J));let G=[...$.denyWithinAllow||[],...UK(X)],W=new Set;for(let U of G)W.add(qQ(XJ(U)));return Q.push(...u0("deny",["file-write*"],W,J)),Q.push(...O5(G,J)),Q}function zK({readConfig:$,writeConfig:J,httpProxyPort:X,socksProxyPort:Q,needsNetworkRestriction:Y,allowUnixSockets:G,allowAllUnixSockets:W,allowLocalBinding:U,allowMachLookup:M,allowPty:O,allowGitConfig:V=!1,enableWeakerNetworkIsolation:H=!1,allowAppleEvents:q=!1,logTag:F}){let K=["(version 1)",`(deny default (with message "${F}"))`,"",`; LogTag: ${F}`,"","; Essential permissions - based on Chrome sandbox policy","; Process permissions","(allow process-exec)","(allow process-fork)","(allow process-info* (target same-sandbox))","(allow signal (target same-sandbox))","(allow mach-priv-task-port (target same-sandbox))","","; User preferences","(allow user-preference-read)","","; Mach IPC - specific services only (no wildcard)","(allow mach-lookup",' (global-name "com.apple.audio.systemsoundserver")',' (global-name "com.apple.distributed_notifications@Uv3")',' (global-name "com.apple.FontObjectsServer")',' (global-name "com.apple.fonts")',' (global-name "com.apple.logd")',' (global-name "com.apple.lsd.mapdb")',' (global-name "com.apple.PowerManagement.control")',' (global-name "com.apple.system.logger")',' (global-name "com.apple.system.notification_center")',' (global-name "com.apple.system.opendirectoryd.libinfo")',' (global-name "com.apple.system.opendirectoryd.membership")',' (global-name "com.apple.bsd.dirhelper")',' (global-name "com.apple.securityd.xpc")',' (global-name "com.apple.coreservices.launchservicesd")',")","",...H?["; trustd.agent - needed for Go TLS certificate verification (weaker network isolation)",'(allow mach-lookup (global-name "com.apple.trustd.agent"))']:[],...q?["; Apple Events - opt-in; needed for open/osascript to talk to other apps (appleeventsd)","(allow appleevent-send)",'(allow mach-lookup (global-name "com.apple.coreservices.appleevents"))',"; Launch Services open requests need the lsopen operation plus, on","; macOS 14/15, coreservicesd and the quarantine resolver - without","; these open fails with -10822 kLSServerCommunicationErr or -54","(allow lsopen)",'(allow mach-lookup (global-name "com.apple.CoreServices.coreservicesd"))','(allow mach-lookup (global-name "com.apple.coreservices.quarantine-resolver"))']:[],...M&&M.length>0?["; User-specified XPC/Mach services",...M.map((L)=>L.endsWith("*")?`(allow mach-lookup (global-name-prefix ${iJ(L.slice(0,-1))}))`:`(allow mach-lookup (global-name ${iJ(L)}))`)]:[],"","; POSIX IPC - shared memory","(allow ipc-posix-shm)","","; POSIX IPC - semaphores for Python multiprocessing","(allow ipc-posix-sem)","","; IOKit - specific operations only","(allow iokit-open",' (iokit-registry-entry-class "IOSurfaceRootUserClient")',' (iokit-registry-entry-class "RootDomainUserClient")',' (iokit-user-client-class "IOSurfaceSendRight")',")","","; IOKit properties","(allow iokit-get-properties)","","; Specific safe system-sockets, doesn't allow network access","(allow system-socket (require-all (socket-domain AF_SYSTEM) (socket-protocol 2)))","","; sysctl - specific sysctls only","(allow sysctl-read",' (sysctl-name "hw.activecpu")',' (sysctl-name "hw.busfrequency_compat")',' (sysctl-name "hw.byteorder")',' (sysctl-name "hw.cacheconfig")',' (sysctl-name "hw.cachelinesize_compat")',' (sysctl-name "hw.cpufamily")',' (sysctl-name "hw.cpufrequency")',' (sysctl-name "hw.cpufrequency_compat")',' (sysctl-name "hw.cputype")',' (sysctl-name "hw.l1dcachesize_compat")',' (sysctl-name "hw.l1icachesize_compat")',' (sysctl-name "hw.l2cachesize_compat")',' (sysctl-name "hw.l3cachesize_compat")',' (sysctl-name "hw.logicalcpu")',' (sysctl-name "hw.logicalcpu_max")',' (sysctl-name "hw.machine")',' (sysctl-name "hw.memsize")',' (sysctl-name "hw.ncpu")',' (sysctl-name "hw.nperflevels")',' (sysctl-name "hw.packages")',' (sysctl-name "hw.pagesize_compat")',' (sysctl-name "hw.pagesize")',' (sysctl-name "hw.physicalcpu")',' (sysctl-name "hw.physicalcpu_max")',' (sysctl-name "hw.tbfrequency_compat")',' (sysctl-name "hw.vectorunit")',' (sysctl-name "kern.argmax")',' (sysctl-name "kern.bootargs")',' (sysctl-name "kern.hostname")',' (sysctl-name "kern.maxfiles")',' (sysctl-name "kern.maxfilesperproc")',' (sysctl-name "kern.maxproc")',' (sysctl-name "kern.ngroups")',' (sysctl-name "kern.osproductversion")',' (sysctl-name "kern.osrelease")',' (sysctl-name "kern.ostype")',' (sysctl-name "kern.osvariant_status")',' (sysctl-name "kern.osversion")',' (sysctl-name "kern.secure_kernel")',' (sysctl-name "kern.tcsm_available")',' (sysctl-name "kern.tcsm_enable")',' (sysctl-name "kern.usrstack64")',' (sysctl-name "kern.version")',' (sysctl-name "kern.willshutdown")',' (sysctl-name "machdep.cpu.brand_string")',' (sysctl-name "machdep.ptrauth_enabled")',' (sysctl-name "security.mac.lockdown_mode_state")',' (sysctl-name "sysctl.proc_cputype")',' (sysctl-name "vm.loadavg")',' (sysctl-name-prefix "hw.optional.arm")',' (sysctl-name-prefix "hw.optional.arm.")',' (sysctl-name-prefix "hw.optional.armv8_")',' (sysctl-name-prefix "hw.perflevel")',' (sysctl-name-prefix "kern.proc.all")',' (sysctl-name-prefix "kern.proc.pgrp.")',' (sysctl-name-prefix "kern.proc.pid.")',' (sysctl-name-prefix "machdep.cpu.")',' (sysctl-name-prefix "net.routetable.")',")","","; V8 thread calculations","(allow sysctl-write",' (sysctl-name "kern.tcsm_enable")',")","","; Distributed notifications","(allow distributed-notification-post)","","; Specific mach-lookup permissions for security operations",'(allow mach-lookup (global-name "com.apple.SecurityServer"))',"","; File I/O on device files",'(allow file-ioctl (literal "/dev/null"))','(allow file-ioctl (literal "/dev/zero"))','(allow file-ioctl (literal "/dev/random"))','(allow file-ioctl (literal "/dev/urandom"))','(allow file-ioctl (literal "/dev/dtracehelper"))','(allow file-ioctl (literal "/dev/tty"))',"","(allow file-ioctl file-read-data file-write-data"," (require-all",' (literal "/dev/null")'," (vnode-type CHARACTER-DEVICE)"," )",")",""];if(K.push("; Network"),!Y)K.push("(allow network*)");else{if(U)K.push('(allow network-bind (local ip "*:*"))'),K.push('(allow network-inbound (local ip "*:*"))'),K.push('(allow network-outbound (remote ip "localhost:*"))');if(W)K.push("(allow system-socket (socket-domain AF_UNIX))"),K.push('(allow network-bind (local unix-socket (path-regex #"^/")))'),K.push('(allow network-outbound (remote unix-socket (path-regex #"^/")))');else if(G&&G.length>0){K.push("(allow system-socket (socket-domain AF_UNIX))");for(let L of G){let R=XJ(L);K.push(`(allow network-bind (local unix-socket (subpath ${iJ(R)})))`),K.push(`(allow network-outbound (remote unix-socket (subpath ${iJ(R)})))`)}}if(X!==void 0)K.push(`(allow network-bind (local ip "localhost:${X}"))`),K.push(`(allow network-inbound (local ip "localhost:${X}"))`),K.push(`(allow network-outbound (remote ip "localhost:${X}"))`);if(Q!==void 0&&Q!==X)K.push(`(allow network-bind (local ip "localhost:${Q}"))`),K.push(`(allow network-inbound (local ip "localhost:${Q}"))`),K.push(`(allow network-outbound (remote ip "localhost:${Q}"))`)}K.push("");let A=$?OK($,J?.allowOnly):void 0;if(K.push("; File read"),K.push(...qK(A,F)),K.push(""),K.push("; File write"),K.push(...KK(J,F,V)),A){let L=HK(A,F);if(L.length>0)K.push(""),K.push("; File read: keep read-denied paths inside write roots in place"),K.push(...L)}if(O)K.push(""),K.push("; Pseudo-terminal (pty) support"),K.push("(allow pseudo-tty)"),K.push("(allow file-ioctl"),K.push(' (literal "/dev/ptmx")'),K.push(' (regex #"^/dev/ttys")'),K.push(")"),K.push("(allow file-read* file-write*"),K.push(' (literal "/dev/ptmx")'),K.push(' (regex #"^/dev/ttys")'),K.push(")");return K.join(`
|
|
66
|
+
`);return`${W} -c ${CJ([V])}`}function v7($){try{if(r.lstatSync($).isSymbolicLink())return r.realpathSync($)}catch{}return $}function J5($,J,X,Q){let Y=J==="/"?"/":J+"/";$.push("--tmpfs",J);for(let G of X)if(G.startsWith(Y)||G===J)$.push("--bind",G,G),Z(`[Sandbox Linux] Re-bound write path wiped by denyRead tmpfs: ${G}`);for(let G of Q)if(G.startsWith(Y)||G===J){if(!r.existsSync(G)){Z(`[Sandbox Linux] Skipping non-existent read allow path: ${G}`);continue}if(X.some((W)=>(W.startsWith(Y)||W===J)&&(G===W||G.startsWith(W+"/"))))continue;$.push("--ro-bind",G,G),Z(`[Sandbox Linux] Re-allowed read access within denied region: ${G}`)}}async function GK($,J,X,Q,Y={command:"rg"},G=k7,W=!1,U,M,O=[]){let V=[],H=[],q=[],F=new Set,K=new Map,A=new Map;if(J){V.push("--ro-bind","/","/");for(let u of J.allowOnly||[]){let J$=XJ(u).replace(/\/+$/,"")||"/";if(Z(`[Sandbox Linux] Processing write path: ${u} -> ${J$}`),J$.startsWith("/dev/")){Z(`[Sandbox Linux] Skipping /dev path: ${J$}`);continue}if(!r.existsSync(J$)){Z(`[Sandbox Linux] Skipping non-existent write path: ${J$}`);continue}try{let a=r.realpathSync(J$),V$=J$.replace(/\/+$/,"");if(a!==V$&&HY(J$,a)){Z(`[Sandbox Linux] Skipping symlink write path pointing outside expected location: ${u} -> ${a}`);continue}}catch{Z(`[Sandbox Linux] Skipping write path that could not be resolved: ${J$}`);continue}V.push("--bind",J$,J$),H.push(J$)}let y,n=()=>{if(y!==void 0)return y;let u=[];for(let a of H){u.push(a);try{let V$=r.realpathSync(a);if(V$!==a)u.push(V$)}catch{}}let J$=[];if($){let a=[],V$=new Set(["proc","dev","sys"]);for(let O$ of $.denyOnly||[])if(XJ(O$)==="/")try{for(let $$ of r.readdirSync("/"))if(!V$.has($$))a.push("/"+$$)}catch{}else a.push(O$);if(r.existsSync("/etc/ssh/ssh_config.d"))a.push("/etc/ssh/ssh_config.d");for(let O$ of a){let $$=XJ(O$),P$=!1;try{P$=r.statSync($$).isDirectory()}catch{continue}if(!P$)continue;J$.push($$);try{let G$=r.realpathSync($$);if(G$!==$$)J$.push(G$)}catch{}}}return y={allowedWritePathsBothForms:u,prospectiveReadDenyTmpfsDirsBothForms:J$},y},Y$=(u)=>H.some((J$)=>u.startsWith(J$+"/")||u===J$),L$=[...J.denyWithinAllow||[],...await r6(Y,G,W,U)];u4();let j$=new Set;for(let u of L$){let J$=XJ(u);if(J$.startsWith("/dev/"))continue;let a=r4(J$);if(a===null||a.startsWith("/dev/"))continue;if(x7(a,H))continue;let V$=!1;try{V$=r.statSync(a).isDirectory()}catch{continue}if(!V$)continue;if(Y$(a)){let O$=K.get(a);if(O$===void 0)O$=new Set,K.set(a,O$);O$.add(J$)}}let QJ=new Map,S$=(u)=>{let J$=QJ.get(u);if(J$!==void 0)return J$;let{allowedWritePathsBothForms:a,prospectiveReadDenyTmpfsDirsBothForms:V$}=n(),O$=a.some(($$)=>$$.startsWith(u+"/"))||V$.some(($$)=>$$===u||$$.startsWith(u+"/"))||V$.some(($$)=>[u,...K.get(u)??[]].some((P$)=>P$===$$||P$.startsWith($$+"/")));return QJ.set(u,O$),O$},h$=[...K.keys()];for(let u of L$){let J$=XJ(u);if(J$.startsWith("/dev/"))continue;let a=r4(J$);if(a===null){let $$=x7(J$,H);if($$&&!j$.has($$))j$.add($$),q.push("--ro-bind","/dev/null",$$),A.set($$,J$);Z(`[Sandbox Linux] Deny path could not be resolved through symlinks, failing closed: ${J$}`);continue}if(a!==J$)Z(`[Sandbox Linux] Resolved symlinked deny path: ${J$} -> ${a}`);if(a.startsWith("/dev/"))continue;if(j$.has(a))continue;j$.add(a);let V$=x7(a,H);if(V$){if(!j$.has(V$))j$.add(V$),q.push("--ro-bind","/dev/null",V$),A.set(V$,J$);Z(`[Sandbox Linux] Mounted /dev/null at symlink ${V$} to prevent symlink replacement attack`);continue}if(!r.existsSync(a)){if(a6(a)){Z(`[Sandbox Linux] Skipping deny path with file ancestor (cannot create paths under a file): ${a}`);continue}let $$=f$.dirname(a);while($$!=="/"&&!r.existsSync($$))$$=f$.dirname($$);let P$=Y$($$)||Y$(a),G$=h$.filter((x$)=>$$===x$||$$.startsWith(x$+"/")),c$=G$.length>0&&!G$.some(S$);if(P$&&!c$){let x$=s6(a),E$=n4(x$,H)??x$;if(E$!==a){if(!F.has(E$)){let n$=o4(E$,M),y$=r.mkdtempSync(f$.join(F9(),"claude-empty-"));if(r.chmodSync(y$,365),N9.add(y$),q.push("--ro-bind",y$,E$),A.set(E$,J$),F.add(E$),n$.kind==="unregistered")pX.add(E$);E9(),Z(`[Sandbox Linux] Mounted empty dir at ${E$} to block creation of ${a}`)}}else{let n$=P7(E$),y$=t4(a,J$);if(n$.kind==="masked")q.push("--ro-bind",y$,E$),A.set(E$,J$),E9(),Z(`[Sandbox Linux] Masked shared stub at ${E$} with ${y$} to block creation of ${a}`);else if(n$.kind==="real")q.push("--ro-bind",E$,E$),A.set(E$,J$);else q.push("--ro-bind",y$,E$),A.set(E$,J$),pX.add(E$),E9(),Z(`[Sandbox Linux] Mounted ${y$} at ${E$} to block creation of ${a}`)}}else if(c$)Z(`[Sandbox Linux] Skipping non-existent deny path inside a read-only denied directory (already uncreatable): ${a}`);else Z(`[Sandbox Linux] Skipping non-existent deny path not within allowed paths: ${a}`);continue}if(Y$(a)){if((QK(a)?P7(a):void 0)?.kind==="masked")q.push("--ro-bind",t4(a,J$),a),E9();else q.push("--ro-bind",a,a);A.set(a,J$)}else Z(`[Sandbox Linux] Skipping deny path not within allowed paths: ${a}`)}}else V.push("--bind","/","/");let L=[],R=($?.allowWithinDeny||[]).map((y)=>XJ(y)),I=new Map,j=[],C=new Set(["proc","dev","sys"]);for(let y of $?.denyOnly||[])if(XJ(y)==="/"){for(let n of r.readdirSync("/"))if(!C.has(n))L.push("/"+n)}else L.push(y);if($&&r.existsSync("/etc/ssh/ssh_config.d"))L.push("/etc/ssh/ssh_config.d");let w=L.map((y)=>XJ(y)).sort((y,n)=>y.split("/").length-n.split("/").length);for(let y of w){if(!r.existsSync(y)){Z(`[Sandbox Linux] Skipping non-existent read deny path: ${y}`);continue}if(r.statSync(y).isDirectory())j.push(y),J5(V,y,H,R);else{if(R.includes(y)){Z(`[Sandbox Linux] Skipping read deny for re-allowed path: ${y}`);continue}let Y$=v7(y);V.push("--ro-bind","/dev/null",Y$),I.set(Y$,"/dev/null"),I.set(y,"/dev/null")}}for(let{realPath:y,fakePath:n}of X??[]){let Y$=v7(y);V.push("--ro-bind",n,Y$),I.set(Y$,n),I.set(y,n)}let P=(y)=>j.some((n)=>{if(!(y===n||y.startsWith(n+"/")))return!1;return!H.some((j$)=>(j$===n||j$.startsWith(n+"/"))&&(y===j$||y.startsWith(j$+"/")))}),l=[...F].filter((y)=>{let n=A.get(y)??y;return!I.has(y)&&!P(y)&&!P(n)&&!H.some((Y$)=>Y$===y||Y$.startsWith(y+"/"))}),e=[];for(let y=0;y<q.length;y+=3){let n=q[y+2],Y$=A.get(n)??n;if(I.has(n))continue;if(P(n)||P(Y$)){Z(`[Sandbox Linux] Skipping denyWrite bind already hidden by denyRead tmpfs: ${n}`);continue}if(l.some((L$)=>n.startsWith(L$+"/"))){Z(`[Sandbox Linux] Skipping denyWrite bind under an empty-directory mask: ${n}`);continue}if(V.push(q[y],q[y+1],n),e.push(n),q[y+1]!==n)O.push(n);if(Y$!==n)e.push(Y$)}for(let y of j)if(e.some((n)=>y.startsWith(n+"/")))Z(`[Sandbox Linux] Re-applying denyRead tmpfs re-exposed by denyWrite bind: ${y}`),J5(V,y,H,R);for(let[y,n]of I)if(e.some((Y$)=>y.startsWith(Y$+"/"))){if(v7(y)!==y)continue;Z(`[Sandbox Linux] Re-applying file mask re-exposed by denyWrite bind: ${y}`),V.push("--ro-bind",n,y)}if(Q!==void 0)V.push("--ro-bind",Q,Q);return V}async function Y5($){let{command:J,commandId:X,needsNetworkRestriction:Q,httpSocketPath:Y,socksSocketPath:G,httpProxyPort:W,socksProxyPort:U,proxyAuthToken:M,caCertPath:O,readConfig:V,writeConfig:H,unsetEnvVars:q,setEnvVars:F,maskedFileBinds:K,maskedFileStoreDir:A,enableWeakerNestedSandbox:L,runAsUid:R,runAsGid:I,runAsHostUid:j,runAsHostGid:C,runAsHostHome:w,runAsHostUser:P,setprivPath:l,allowAllUnixSockets:e,binShell:y,ripgrepConfig:n={command:"rg"},mandatoryDenySearchDepth:Y$=k7,allowGitConfig:L$=!1,gitSafeDirectories:j$,seccompConfig:QJ,bwrapPath:S$,socatPath:h$,observeSocketPath:u,abortSignal:J$}=$,a=V&&V.denyOnly.length>0||K!==void 0&&K.length>0,V$=H!==void 0,O$=q!==void 0&&q.length>0||F!==void 0&&Object.keys(F).length>0,$$=(j$?.length??0)>0;if(!Q&&!a&&!V$&&!O$&&!$$)return J;D0++;let P$=[],G$=["--new-session","--die-with-parent"],c$=[],x$;try{if(!e)if(x$=XK(QJ?.applyPath,QJ?.argv0),!x$)throw Error("seccomp_unavailable: the policy requires the unix-socket filter (allowAllUnixSockets is false) but apply-seccomp is not installed beside srt (vendor/seccomp/<arch>/apply-seccomp; build it with `bun run build:seccomp` in packages/sandbox-runtime)");else Z("[Sandbox Linux] Applying seccomp filter for Unix socket blocking");else Z("[Sandbox Linux] Skipping seccomp filter - allowAllUnixSockets is enabled");if(u&&x$)if(r.existsSync(u))c$.push("--bind",u,u),G$.push("--setenv","SRT_OBSERVE_SOCK",u),G$.push("--setenv","SRT_ENCODED_CMD",PJ(X??J));else Z("[Sandbox Linux] observe socket missing \u2014 supervisor not running; "+"continuing without violation monitoring");if(O$){for(let b$ of q??[])G$.push("--unsetenv",b$);for(let[b$,i$]of Object.entries(F??{}))G$.push("--setenv",b$,i$)}if(j$&&j$.length>0){let b$=KY({safeDirs:j$,unsetEnvVars:q,setEnvVars:F});for(let[i$,MY]of Object.entries(b$))G$.push("--setenv",i$,MY)}if(Q){if(G$.push("--unshare-net"),Y&&G){if(!r.existsSync(Y))throw Error(`Linux HTTP bridge socket does not exist: ${Y}. The bridge process may have died. Try reinitializing the sandbox.`);if(!r.existsSync(G))throw Error(`Linux SOCKS bridge socket does not exist: ${G}. The bridge process may have died. Try reinitializing the sandbox.`);if(c$.push("--bind",Y,Y),G!==Y)c$.push("--bind",G,G);let b$=ZQ(3128,1080,O,M,H===void 0,PJ(X??J));if(G$.push(...b$.flatMap((i$)=>{let MY=i$.indexOf("="),PU=i$.slice(0,MY),_U=i$.slice(MY+1);return["--setenv",PU,_U]})),W!==void 0)G$.push("--setenv","CLAUDE_CODE_HOST_HTTP_PROXY_PORT",String(W));if(U!==void 0)G$.push("--setenv","CLAUDE_CODE_HOST_SOCKS_PROXY_PORT",String(U))}}let E$=await GK(V,H,K,A,n,Y$,L$,J$,j===void 0?void 0:{uid:j,gid:C??j},P$);z9(),G$.push(...E$);let n$=JK(P$,process.cwd());if(n$!==void 0)G$.push("--setenv",e6,n$);if(G$.push(...c$),G$.push("--dev","/dev"),G$.push("--unshare-pid"),!L){if(G$.push("--unshare-user","--cap-drop","ALL","--proc","/proc"),!x$)G$.push("--ro-bind","/dev/null","/proc/sysrq-trigger")}else G$.push("--unshare-user","--bind","/proc","/proc");if(R!==void 0)G$.push("--uid",String(R)),G$.push("--gid",String(I??R));if(j!==void 0){if(w)G$.push("--setenv","HOME",w);if(P)G$.push("--setenv","USER",P),G$.push("--setenv","LOGNAME",P)}let y$=y||"bash",e$=R0(y$);if(!e$)throw Error(`Shell '${y$}' not found in PATH`);if(G$.push("--",e$,"-c"),Q&&Y&&G){let b$=YK(Y,G,J,x$,e$,h$);G$.push(b$)}else if(x$){let b$=x$+CJ([e$,"-c",J]);G$.push(b$)}else G$.push(J);let GJ=[S$??"bwrap",...G$],WJ=CJ(i6({bwrapCommand:GJ,uid:j,gid:C,setprivPath:l,unsetEnvVars:q,setEnvVars:F})),s$=[];if(Q)s$.push("network");if(a||V$)s$.push("filesystem");if(O$)s$.push("env");if(x$)s$.push("seccomp(unix-block)");return Z(`[Sandbox Linux] Wrapped command with bwrap (${s$.join(", ")} restrictions)`),WJ}catch(E$){if(D0>0)D0--;if(z9(),D0===0)_7([],()=>{});throw E$}}import{spawn as WK}from"child_process";import*as Z0 from"path";class A9{violations=[];totalCount=0;maxSize=100;listeners=new Set;addViolation($){if(this.violations.push({...$,line:f7($.line).replace(/[<>]/g,"")}),this.totalCount++,this.violations.length>this.maxSize)this.violations=this.violations.slice(-this.maxSize);this.notifyListeners()}getViolations($){if($===void 0)return[...this.violations];return this.violations.slice(-$)}getCount(){return this.violations.length}getTotalCount(){return this.totalCount}getViolationsForCommand($){let J=PJ($);return this.violations.filter((X)=>X.encodedCommand===J)}clear(){this.violations=[],this.notifyListeners()}subscribe($){return this.listeners.add($),$(this.getViolations()),()=>{this.listeners.delete($)}}notifyListeners(){let $=this.getViolations();this.listeners.forEach((J)=>J($))}}function dQ($,J,X){if(!X)return!1;if((X["*"]??[]).some((Y)=>$.includes(Y)))return!0;if(J===void 0)return!1;for(let[Y,G]of Object.entries(X))if(Y!=="*"&&J.includes(Y)&&G.some((W)=>$.includes(W)))return!0;return!1}function f7($){return $.replace(/[\x00-\x1f\x7f-\x9f]+/g," ").trim()}function UK($=!1){let J=process.cwd(),X=[];for(let Q of VX)X.push(Z0.resolve(J,Q)),X.push(`**/${Q}`);for(let Q of qY())X.push(Z0.resolve(J,Q)),X.push(`**/${Q}/**`);if(X.push(Z0.resolve(J,".git/hooks")),X.push("**/.git/hooks/**"),!$)X.push(Z0.resolve(J,".git/config")),X.push("**/.git/config");return[...new Set(X)]}var G5=`_${Math.random().toString(36).slice(2,11)}_SBX`;function MK($){return`CMD64_${PJ($)}_END_${G5}`}function cQ($){return NJ($)?`(regex ${iJ(zX($))})`:`(subpath ${iJ($)})`}function u7($){return zX($).slice(0,-1)+"(/.*)?$"}function qQ($){return NJ($)?`(regex ${iJ(u7($))})`:`(subpath ${iJ($)})`}function W5($){return $.replace(/\[[^\]]*\]|[*?]+/g,"x")}function b7($,J){let X=[...new Set(J)];if(X.length===0)return $;let Q=X.map((Y)=>`(require-not ${Y})`).join(" ");return`(require-all ${$} ${Q})`}function y7($){let J=XJ($);return{path:J,glob:NJ(J)}}function U5($,J){return $.test(J.glob?W5(J.path):J.path)}function R9($,J){let X=$.glob?W5($.path):$.path;return X.startsWith(J==="/"?"/":J+"/")&&X!==J}function OK($,J){return{denies:($.denyOnly||[]).map(y7),allows:($.allowWithinDeny||[]).map(y7),writeRoots:(J||[]).map(y7)}}function VK($){let J=[],X=!1,Q=$.allows.filter((Y)=>!Y.glob).map((Y)=>Y.path);for(let Y of $.denies){if(!Y.glob){if(Q.some((U)=>Y.path.startsWith(U+"/")))J.push(qQ(Y.path));continue}let G=new RegExp(u7(Y.path));if(G.test("/"))X=!0;let W=$.allows.filter((U)=>U5(G,U)).map((U)=>cQ(U.path));J.push(b7(qQ(Y.path),W))}return{filters:J,coversRoot:X}}function M5($){let J=$.split(/[*?[\]]/)[0];if(!J||J==="/")return"/";return J.endsWith("/")?J.slice(0,-1):Z0.dirname(J)}function HK($,J){let{denies:X,allows:Q,writeRoots:Y}=$;if(Y.length===0)return[];let G=Y.filter((H)=>H.glob).map((H)=>new RegExp(zX(H.path))),W=Y.filter((H)=>!H.glob).map((H)=>H.path),U=(H)=>W.some((q)=>R9({path:H,glob:!1},q))||G.some((q)=>q.test(H)),M=(H)=>[...Q,...Y].filter((q)=>R9(q,H)).map((q)=>cQ(q.path)),O=new Set,V=(H)=>{for(let q of H)if(U(q))O.add(`(literal ${iJ(q)})`)};for(let H of X)if(H.glob){let q=M5(H.path);if(!(G.length>0||W.some((L)=>q===L||R9({path:q,glob:!1},L)||R9({path:L,glob:!1},q))))continue;let K=new RegExp(u7(H.path)),A=[...Q,...Y].filter((L)=>U5(K,L)).map((L)=>cQ(L.path));if(O.add(b7(qQ(H.path),A)),q!=="/")V([q,...h7(q)])}else{if(!U(H.path))continue;O.add(b7(qQ(H.path),M(H.path))),V(h7(H.path))}return u0("deny",["file-write-unlink"],O,J)}function u0($,J,X,Q){if(X.size===0)return[];return[`(${$} ${J.join(" ")}`,...[...X].map((Y)=>` ${Y}`),` (with message "${Q}"))`]}function h7($){let J=[],X=Z0.dirname($);while(X!=="/"&&X!=="."){J.push(X);let Q=Z0.dirname(X);if(Q===X)break;X=Q}return J}function O5($,J){let X=new Set;for(let Q of $){let Y=XJ(Q);X.add(qQ(Y));let G;if(NJ(Y)){if(G=M5(Y),G==="/")continue;X.add(`(literal ${iJ(G)})`)}else G=Y;for(let W of h7(G))X.add(`(literal ${iJ(W)})`)}return u0("deny",["file-write-unlink","file-write-create"],X,J)}function qK($,J){if(!$)return["(allow file-read*)"];let X=[];X.push("(allow file-read*)");let Q=$.denies.some((M)=>M.path==="/"),Y=new Set($.denies.map((M)=>qQ(M.path)));X.push(...u0("deny",["file-read*"],Y,J));let G=new Set($.allows.map((M)=>cQ(M.path)));X.push(...u0("allow",["file-read*"],G,J));let W=VK($);if(X.push(...u0("deny",["file-read*"],new Set(W.filters),J)),Q||W.coversRoot)X.push('(allow file-read* (literal "/"))');if($.denies.length>0)X.push("(allow file-read-metadata"," (vnode-type DIRECTORY))");X.push(...O5($.denies.map((M)=>M.path),J));let U=new Set($.writeRoots.map((M)=>cQ(M.path)));return X.push(...u0("allow",["file-write-unlink","file-write-create"],U,J)),X}function KK($,J,X=!1){if(!$)return["(allow file-write*)"];let Q=[],Y=new Set;for(let U of $.allowOnly||[])Y.add(cQ(XJ(U)));Q.push(...u0("allow",["file-write*"],Y,J));let G=[...$.denyWithinAllow||[],...UK(X)],W=new Set;for(let U of G)W.add(qQ(XJ(U)));return Q.push(...u0("deny",["file-write*"],W,J)),Q.push(...O5(G,J)),Q}function zK({readConfig:$,writeConfig:J,httpProxyPort:X,socksProxyPort:Q,needsNetworkRestriction:Y,allowUnixSockets:G,allowAllUnixSockets:W,allowLocalBinding:U,allowMachLookup:M,allowPty:O,allowGitConfig:V=!1,enableWeakerNetworkIsolation:H=!1,allowAppleEvents:q=!1,logTag:F}){let K=["(version 1)",`(deny default (with message "${F}"))`,"",`; LogTag: ${F}`,"","; Essential permissions - based on Chrome sandbox policy","; Process permissions","(allow process-exec)","(allow process-fork)","(allow process-info* (target same-sandbox))","(allow signal (target same-sandbox))","(allow mach-priv-task-port (target same-sandbox))","","; User preferences","(allow user-preference-read)","","; Mach IPC - specific services only (no wildcard)","(allow mach-lookup",' (global-name "com.apple.audio.systemsoundserver")',' (global-name "com.apple.distributed_notifications@Uv3")',' (global-name "com.apple.FontObjectsServer")',' (global-name "com.apple.fonts")',' (global-name "com.apple.logd")',' (global-name "com.apple.lsd.mapdb")',' (global-name "com.apple.PowerManagement.control")',' (global-name "com.apple.system.logger")',' (global-name "com.apple.system.notification_center")',' (global-name "com.apple.system.opendirectoryd.libinfo")',' (global-name "com.apple.system.opendirectoryd.membership")',' (global-name "com.apple.bsd.dirhelper")',' (global-name "com.apple.securityd.xpc")',' (global-name "com.apple.coreservices.launchservicesd")',")","",...H?["; trustd.agent - needed for Go TLS certificate verification (weaker network isolation)",'(allow mach-lookup (global-name "com.apple.trustd.agent"))']:[],...q?["; Apple Events - opt-in; needed for open/osascript to talk to other apps (appleeventsd)","(allow appleevent-send)",'(allow mach-lookup (global-name "com.apple.coreservices.appleevents"))',"; Launch Services open requests need the lsopen operation plus, on","; macOS 14/15, coreservicesd and the quarantine resolver - without","; these open fails with -10822 kLSServerCommunicationErr or -54","(allow lsopen)",'(allow mach-lookup (global-name "com.apple.CoreServices.coreservicesd"))','(allow mach-lookup (global-name "com.apple.coreservices.quarantine-resolver"))']:[],...M&&M.length>0?["; User-specified XPC/Mach services",...M.map((L)=>L.endsWith("*")?`(allow mach-lookup (global-name-prefix ${iJ(L.slice(0,-1))}))`:`(allow mach-lookup (global-name ${iJ(L)}))`)]:[],"","; POSIX IPC - shared memory","(allow ipc-posix-shm)","","; POSIX IPC - semaphores for Python multiprocessing","(allow ipc-posix-sem)","","; IOKit - specific operations only","(allow iokit-open",' (iokit-registry-entry-class "IOSurfaceRootUserClient")',' (iokit-registry-entry-class "RootDomainUserClient")',' (iokit-user-client-class "IOSurfaceSendRight")',")","","; IOKit properties","(allow iokit-get-properties)","","; Specific safe system-sockets, doesn't allow network access","(allow system-socket (require-all (socket-domain AF_SYSTEM) (socket-protocol 2)))","","; sysctl - specific sysctls only","(allow sysctl-read",' (sysctl-name "hw.activecpu")',' (sysctl-name "hw.busfrequency_compat")',' (sysctl-name "hw.byteorder")',' (sysctl-name "hw.cacheconfig")',' (sysctl-name "hw.cachelinesize_compat")',' (sysctl-name "hw.cpufamily")',' (sysctl-name "hw.cpufrequency")',' (sysctl-name "hw.cpufrequency_compat")',' (sysctl-name "hw.cputype")',' (sysctl-name "hw.l1dcachesize_compat")',' (sysctl-name "hw.l1icachesize_compat")',' (sysctl-name "hw.l2cachesize_compat")',' (sysctl-name "hw.l3cachesize_compat")',' (sysctl-name "hw.logicalcpu")',' (sysctl-name "hw.logicalcpu_max")',' (sysctl-name "hw.machine")',' (sysctl-name "hw.memsize")',' (sysctl-name "hw.ncpu")',' (sysctl-name "hw.nperflevels")',' (sysctl-name "hw.packages")',' (sysctl-name "hw.pagesize_compat")',' (sysctl-name "hw.pagesize")',' (sysctl-name "hw.physicalcpu")',' (sysctl-name "hw.physicalcpu_max")',' (sysctl-name "hw.tbfrequency_compat")',' (sysctl-name "hw.vectorunit")',' (sysctl-name "kern.argmax")',' (sysctl-name "kern.bootargs")',' (sysctl-name "kern.hostname")',' (sysctl-name "kern.maxfiles")',' (sysctl-name "kern.maxfilesperproc")',' (sysctl-name "kern.maxproc")',' (sysctl-name "kern.ngroups")',' (sysctl-name "kern.osproductversion")',' (sysctl-name "kern.osrelease")',' (sysctl-name "kern.ostype")',' (sysctl-name "kern.osvariant_status")',' (sysctl-name "kern.osversion")',' (sysctl-name "kern.secure_kernel")',' (sysctl-name "kern.tcsm_available")',' (sysctl-name "kern.tcsm_enable")',' (sysctl-name "kern.usrstack64")',' (sysctl-name "kern.version")',' (sysctl-name "kern.willshutdown")',' (sysctl-name "machdep.cpu.brand_string")',' (sysctl-name "machdep.ptrauth_enabled")',' (sysctl-name "security.mac.lockdown_mode_state")',' (sysctl-name "sysctl.proc_cputype")',' (sysctl-name "vm.loadavg")',' (sysctl-name-prefix "hw.optional.arm")',' (sysctl-name-prefix "hw.optional.arm.")',' (sysctl-name-prefix "hw.optional.armv8_")',' (sysctl-name-prefix "hw.perflevel")',' (sysctl-name-prefix "kern.proc.all")',' (sysctl-name-prefix "kern.proc.pgrp.")',' (sysctl-name-prefix "kern.proc.pid.")',' (sysctl-name-prefix "machdep.cpu.")',' (sysctl-name-prefix "net.routetable.")',")","","; V8 thread calculations","(allow sysctl-write",' (sysctl-name "kern.tcsm_enable")',")","","; Distributed notifications","(allow distributed-notification-post)","","; Specific mach-lookup permissions for security operations",'(allow mach-lookup (global-name "com.apple.SecurityServer"))',"","; File I/O on device files",'(allow file-ioctl (literal "/dev/null"))','(allow file-ioctl (literal "/dev/zero"))','(allow file-ioctl (literal "/dev/random"))','(allow file-ioctl (literal "/dev/urandom"))','(allow file-ioctl (literal "/dev/dtracehelper"))','(allow file-ioctl (literal "/dev/tty"))',"","(allow file-ioctl file-read-data file-write-data"," (require-all",' (literal "/dev/null")'," (vnode-type CHARACTER-DEVICE)"," )",")",""];if(K.push("; Network"),!Y)K.push("(allow network*)");else{if(U)K.push('(allow network-bind (local ip "*:*"))'),K.push('(allow network-inbound (local ip "*:*"))'),K.push('(allow network-outbound (remote ip "localhost:*"))');if(W)K.push("(allow system-socket (socket-domain AF_UNIX))"),K.push('(allow network-bind (local unix-socket (path-regex #"^/")))'),K.push('(allow network-outbound (remote unix-socket (path-regex #"^/")))');else if(G&&G.length>0){K.push("(allow system-socket (socket-domain AF_UNIX))");for(let L of G){let R=XJ(L);K.push(`(allow network-bind (local unix-socket (subpath ${iJ(R)})))`),K.push(`(allow network-outbound (remote unix-socket (subpath ${iJ(R)})))`)}}if(X!==void 0)K.push(`(allow network-bind (local ip "localhost:${X}"))`),K.push(`(allow network-inbound (local ip "localhost:${X}"))`),K.push(`(allow network-outbound (remote ip "localhost:${X}"))`);if(Q!==void 0&&Q!==X)K.push(`(allow network-bind (local ip "localhost:${Q}"))`),K.push(`(allow network-inbound (local ip "localhost:${Q}"))`),K.push(`(allow network-outbound (remote ip "localhost:${Q}"))`)}K.push("");let A=$?OK($,J?.allowOnly):void 0;if(K.push("; File read"),K.push(...qK(A,F)),K.push(""),K.push("; File write"),K.push(...KK(J,F,V)),A){let L=HK(A,F);if(L.length>0)K.push(""),K.push("; File read: keep read-denied paths inside write roots in place"),K.push(...L)}if(O)K.push(""),K.push("; Pseudo-terminal (pty) support"),K.push("(allow pseudo-tty)"),K.push("(allow file-ioctl"),K.push(' (literal "/dev/ptmx")'),K.push(' (regex #"^/dev/ttys")'),K.push(")"),K.push("(allow file-read* file-write*"),K.push(' (literal "/dev/ptmx")'),K.push(' (regex #"^/dev/ttys")'),K.push(")");return K.join(`
|
|
67
67
|
`)}function iJ($){return JSON.stringify($)}function V5($){let{command:J,commandId:X,needsNetworkRestriction:Q,httpProxyPort:Y,socksProxyPort:G,proxyAuthToken:W,caCertPath:U,allowUnixSockets:M,allowAllUnixSockets:O,allowLocalBinding:V,allowMachLookup:H,readConfig:q,writeConfig:F,unsetEnvVars:K,setEnvVars:A,maskedFileBinds:L,allowPty:R,allowGitConfig:I=!1,gitSafeDirectories:j,enableWeakerNetworkIsolation:C=!1,allowAppleEvents:w=!1,binShell:P}=$,l=q;if(L&&L.length>0)Z("[Sandbox macOS] file mask degrades to deny on macOS until the interposer lands"),l={denyOnly:[...q?.denyOnly??[],...L.map((O$)=>O$.realPath)],allowWithinDeny:q?.allowWithinDeny};let e=l&&l.denyOnly.length>0,y=F!==void 0,n=K!==void 0&&K.length>0||A!==void 0&&Object.keys(A).length>0,Y$=(j?.length??0)>0;if(!Q&&!e&&!y&&!n&&!Y$)return J;let L$=X??J,j$=MK(L$),QJ=zK({readConfig:l,writeConfig:F,httpProxyPort:Y,socksProxyPort:G,needsNetworkRestriction:Q,allowUnixSockets:M,allowAllUnixSockets:O,allowLocalBinding:V,allowMachLookup:H,allowPty:R,allowGitConfig:I,enableWeakerNetworkIsolation:C,allowAppleEvents:w,logTag:j$}),S$=ZQ(Y,G,U,W,F===void 0,PJ(L$));if(V&&Q){let P$=(K??[]).includes("JAVA_TOOL_OPTIONS")?"":process.env.JAVA_TOOL_OPTIONS??"",G$=P$.includes("-Djava.net.preferIPv4Stack=true")?P$:[P$,"-Djava.net.preferIPv4Stack=true"].filter(Boolean).join(" ");S$.push(`JAVA_TOOL_OPTIONS=${G$}`)}if(j&&j.length>0){let O$=KY({safeDirs:j,unsetEnvVars:K,setEnvVars:A});for(let[$$,P$]of Object.entries(O$))S$.push(`${$$}=${P$}`)}let h$=P||"bash",u=R0(h$);if(!u)throw Error(`Shell '${h$}' not found in PATH`);let J$=(K??[]).flatMap((O$)=>["-u",O$]),a=Object.entries(A??{}).map(([O$,$$])=>`${O$}=${$$}`),V$=CJ(["env",...J$,...a,...S$,"/usr/bin/sandbox-exec","-p",QJ,u,"-c",J]);return Z(`[Sandbox macOS] Applied restrictions - network: ${!!(Y||G)}, read: ${l?"allowAllExcept"in l?"allowAllExcept":"denyAllExcept":"none"}, write: ${F?"allowAllExcept"in F?"allowAllExcept":"denyAllExcept":"none"}`),V$}function H5($,J,X=(Q)=>Q){let Q=/CMD64_(.+?)_END/,Y=/Sandbox:\s+(.+)$/,G=WK("log",["stream","--predicate",`(eventMessage ENDSWITH "${G5}")`,"--style","compact"]);return G.stdout?.on("data",(W)=>{let U=W.toString().split(`
|
|
68
68
|
`),M=U.find((K)=>K.includes("Sandbox:")&&K.includes("deny")),O=U.find((K)=>K.startsWith("CMD64_"));if(!M)return;let V=M.match(Y);if(!V?.[1])return;let H=V[1],q,F;if(O){if(F=O.match(Q)?.[1],F)try{q=X(t0(F))}catch{}}if(H.includes("mDNSResponder")||H.includes("mach-lookup com.apple.diagnosticd")||H.includes("mach-lookup com.apple.analyticsd"))return;if(dQ(H,q,J))return;$({line:H,command:q,encodedCommand:F,timestamp:new Date})}),G.stderr?.on("data",(W)=>{Z(`[Sandbox Monitor] Log stream stderr: ${W.toString()}`)}),G.on("error",(W)=>{Z(`[Sandbox Monitor] Failed to start log stream: ${W.message}`)}),G.on("exit",(W)=>{Z(`[Sandbox Monitor] Log stream exited with code: ${W}`)}),()=>{Z("[Sandbox Monitor] Stopping log monitor"),G.kill("SIGTERM")}}import{randomBytes as EK}from"crypto";import{chmodSync as q5,chownSync as FK,mkdtempSync as NK,rmSync as LK}from"fs";import{createServer as AK}from"net";import{tmpdir as RK}from"os";import{join as K5,posix as DK}from"path";import{createInterface as ZK}from"readline";function z5($,J){let{allowWritePaths:X,denyWritePaths:Q,ignoreViolations:Y,resolveCommandText:G=(j)=>j,consumerUid:W,consumerGid:U}=J,M=NK(K5(RK(),"srt-obs-")),O=K5(M,`s${EK(4).toString("hex")}.sock`),V=(j,C)=>j===C||j.startsWith(C.endsWith("/")?C:C+"/"),H=(j)=>{let C=DK.normalize(j);if(Q.some((w)=>V(C,w)))return!0;return!X.some((w)=>V(C,w))},q=(j,C)=>{if(j.observe_init_error){Z(`[Sandbox Linux Monitor] observe filter not installed: ${j.observe_init_error}`);return}if(typeof j.path!=="string")return;if(!j.path.startsWith("/"))return;if(!H(j.path))return;let w;if(C)try{w=G(t0(C))}catch{}if(dQ(j.path,w,Y))return;let P={line:`deny ${j.syscall??"syscall"} ${j.path}`,command:w,encodedCommand:C,timestamp:new Date};$(P)},F,K=new Promise((j)=>{F=j}),A=O,L=AK((j)=>{let C,w=ZK({input:j});w.on("line",(P)=>{if(!P)return;let l;try{l=JSON.parse(P)}catch{return}if(l.encodedCommand&&C===void 0)C=l.encodedCommand;q(l,C??l.encodedCommand)}),j.on("error",()=>w.close()),j.on("close",()=>w.close())});L.on("error",(j)=>{Z(`[Sandbox Linux Monitor] listen failed: ${j.message} - violation monitoring disabled`,{level:"warn"}),A=void 0,F()}),L.listen(O,()=>{if(W!==void 0)q5(M,457),FK(O,W,U??W),q5(O,384);F()});let R=new Set;return L.on("connection",(j)=>{R.add(j),j.on("close",()=>R.delete(j))}),{get observeSocketPath(){return A},ready:K,stop:()=>{Z("[Sandbox Linux Monitor] stopping");for(let j of R)j.destroy();L.close();try{LK(M,{recursive:!0,force:!0})}catch{}}}}import*as JJ from"fs";import*as N5 from"net";import*as $J from"path";import{spawn as BK,spawnSync as jK}from"child_process";import{once as TK}from"events";import{fileURLToPath as SK}from"url";class A$ extends Error{code;subcommand;constructor($,J,X){super(J);this.name="WindowsSandboxError",this.code=$,this.subcommand=X}}var D9=[60080,60089],E5=["-NoProfile","-Command"];function Z9($){let J=process.env.SystemRoot??"C:\\Windows",X={exe:$J.win32.join(J,"System32","cmd.exe"),args:["/d","/s","/c"]};if($===void 0||$===null)return X;if(typeof $==="object"){if(!$J.win32.isAbsolute($.exe))throw new A$("bin_shell_invalid",`binShell.exe must be an absolute path (got ${JSON.stringify($.exe)})`);if(!Array.isArray($.args))throw new A$("bin_shell_invalid",`binShell.args must be an array (got ${JSON.stringify($.args)})`);return $}let Q=$J.win32.basename($),Y=Q.toLowerCase(),G=$J.win32.isAbsolute($);if(!G&&$!==Q)throw new A$("bin_shell_invalid",`binShell string must be a bare token or an absolute path (got ${JSON.stringify($)})`);switch(Y){case"bash":case"bash.exe":case"sh":case"sh.exe":if(!G)throw new A$("bin_shell_invalid",`binShell bash path must be absolute (got ${JSON.stringify($)}); pass the resolved Git Bash install path`);return{exe:$,args:["-c"]};case"pwsh":case"pwsh.exe":return{exe:G?$:"pwsh.exe",args:E5};case"powershell":case"powershell.exe":return{exe:G?$:$J.win32.join(J,"System32","WindowsPowerShell","v1.0","powershell.exe"),args:E5};case"cmd":case"cmd.exe":return G?{exe:$,args:X.args}:X;default:throw new A$("bin_shell_invalid",`unrecognised binShell ${JSON.stringify($)}: expected 'cmd' | 'powershell' | 'pwsh' or an absolute path to bash.exe/sh.exe/pwsh.exe/powershell.exe`)}}function L5(){let $=$J.dirname(SK(import.meta.url));return $J.resolve($,"..","..")}var A5={x64:"x64",arm64:"arm64"},IK=$J.join(L5(),"vendor","srt-win",A5[process.arch]??process.arch,"srt-win.exe");function CK(){let $=L5(),J=A5[process.arch],X=[];if(J)X.push($J.join($,"vendor","srt-win",J,"srt-win.exe"));X.push($J.join($,"vendor","srt-win-src","target","release","srt-win.exe"));for(let Q of X)if(JJ.existsSync(Q))return Q;throw new A$("srt_win_not_found",`srt-win.exe not found. Set windows.srtWin.path or build with \`cargo build --release --manifest-path vendor/srt-win-src/Cargo.toml\`. Looked in: ${X.join(", ")}`)}var R5="--srt-win";function wJ($){if($?.path===void 0)throw new A$("srt_win_not_found","no srt-win path configured; set windows.srtWin.path (e.g. to the exported VENDORED_SRT_WIN_EXE constant for the packaged binary)");if(!JJ.existsSync($.path))throw new A$("srt_win_not_found",`windows.srtWin.path is set to '${$.path}' but the file does not exist`);return{exe:$.path,prependArgs:[R5]}}function g0($,J={}){let{exe:X,prependArgs:Q}=J.srtWin??wJ(),Y=jK(X,[...Q,...$],{encoding:"utf8",windowsHide:!0,timeout:J.timeoutMs??15000,...J.stdin!==void 0?{input:J.stdin}:{}});if(Y.error){if(Y.error.code==="ETIMEDOUT")throw new A$("srt_win_timeout",`srt-win ${$.join(" ")} timed out after ${J.timeoutMs??15000}ms`+(Y.signal?` (killed by ${Y.signal})`:""),$[0]);throw new A$("spawn_failed",`srt-win ${$[0]}: spawn failed: ${Y.error.message}`,$[0])}return{status:Y.status,signal:Y.signal,stdout:(Y.stdout??"").trim(),stderr:(Y.stderr??"").trim()}}function m7($,J={}){let{exe:X,prependArgs:Q}=J.srtWin??wJ(),Y=J.timeoutMs??15000;return new Promise((G,W)=>{let U=BK(X,[...Q,...$],{windowsHide:!0}),M=!1,O=Y>0?setTimeout(()=>{M=!0,U.kill()},Y):void 0,V="",H="";U.stdout?.setEncoding("utf8").on("data",(q)=>V+=q),U.stderr?.setEncoding("utf8").on("data",(q)=>H+=q),U.stdin?.on("error",()=>{}).end(J.stdin),U.once("error",(q)=>{clearTimeout(O),W(new A$("spawn_failed",`srt-win ${$[0]}: spawn failed: ${q.message}`,$[0]))}),U.once("close",(q,F)=>{if(clearTimeout(O),M){W(new A$("srt_win_timeout",`srt-win ${$.join(" ")} timed out after ${Y}ms`+(F?` (killed by ${F})`:""),$[0]));return}G({status:q,signal:F,stdout:V.trim(),stderr:H.trim()})})})}function D5($,J){if(J.status!==0)throw new A$("srt_win_nonzero",`srt-win ${$.join(" ")} exited ${J.status}: ${J.stderr||J.stdout}`,$[0]);try{return JSON.parse(J.stdout)}catch(X){throw new A$("srt_win_bad_json",`srt-win ${$.join(" ")}: unparseable JSON output ${JSON.stringify(J.stdout)}: ${X.message}`,$[0])}}function l7($,J){return D5($,g0($,J))}async function p7($,J){return D5($,await m7($,J))}function Z5($,J){let X=g0($,J),Q;try{Q=JSON.parse(X.stdout)}catch(Y){throw new A$("srt_win_bad_json",`srt-win ${$.join(" ")}: unparseable JSON output ${JSON.stringify(X.stdout)}: ${Y.message}`,$[0])}return{ok:X.status===0,json:Q,stderr:X.stderr}}function B5($){let J=["wfp","status"];if($)J.push("--sublayer-guid",$);return J}function B9($){return{state:$.state,filters:$.filters,...$.port_range&&{portRange:$.port_range},...$.user_sid&&{userSid:$.user_sid},...$.hint&&{hint:$.hint}}}function j9($){return{provisioned:$.user.exists,...$.user.sid&&{sid:$.user.sid},groupExists:$.user.group_exists,...$.user.group_sid&&{groupSid:$.user.group_sid},inBuiltinUsers:$.user.in_builtin_users,inSandboxGroup:$.user.in_sandbox_group,hiddenFromLogon:$.user.hidden_from_logon,credPresent:$.cred_present,...typeof $.marker_version==="number"&&{markerVersion:$.marker_version},realUserSid:$.real_user_sid,...$.ca_cert_thumb&&{caCertThumb:$.ca_cert_thumb},...$.ca_cert_pem&&{caCertPem:$.ca_cert_pem}}}function j5($={}){let J=["status"];if($.sublayerGuid)J.push("--sublayer-guid",$.sublayerGuid);let X=l7(J,{srtWin:$.srtWin});return{user:j9(X.user),wfp:B9(X.wfp)}}async function T5($={}){let J=["status"];if($.sublayerGuid)J.push("--sublayer-guid",$.sublayerGuid);let X=await p7(J,{srtWin:$.srtWin});return{user:j9(X.user),wfp:B9(X.wfp)}}function S5($={}){return B9(l7(B5($.sublayerGuid),{srtWin:$.srtWin}))}async function I5($={}){return B9(await p7(B5($.sublayerGuid),{srtWin:$.srtWin}))}async function d7($={}){let J=$.target,X;if(!J){let[Q,Y]=$.proxyPortRange??D9;for(let G=0;G<5;G++){let W=N5.createServer();W.listen(0,"127.0.0.1"),await TK(W,"listening");let U=W.address().port;if(U<Q||U>Y){X=W,J=`127.0.0.1:${U}`;break}W.close()}if(!J)throw new A$("wfp_verify_bind_failed",`verifyWindowsWfpEgress: could not bind a loopback listener outside the WFP permit range [${Q},${Y}] in 5 attempts`)}try{let Q=g0(["wfp","verify","--target",J],{timeoutMs:30000,srtWin:$.srtWin});Z(`[Sandbox Windows] wfp verify exit=${Q.status}: ${Q.stderr||Q.stdout}`);let Y;try{Y=JSON.parse(Q.stdout)}catch{throw new A$("wfp_verify_unparseable","WFP egress fence could not be verified \u2014 `srt-win wfp "+`verify\` exited ${Q.status}`+(Q.signal?` (signal ${Q.signal})`:"")+` with unparseable output ${JSON.stringify(Q.stdout)} (stderr: ${JSON.stringify(Q.stderr)})`)}if(Q.status===3)throw new A$("wfp_fence_inactive","WFP egress fence is not active \u2014 direct outbound from the "+`sandbox user to ${Y.target} succeeded. Re-run \`srt-win install\` (one UAC prompt). (${Q.stderr})`);if(Q.status!==0)throw new A$("wfp_verify_inconclusive","WFP egress fence could not be verified \u2014 probe to "+`${Y.target} was '${Y.egress_probe}' (exit ${Q.status}). The fence may be absent. Re-run \`srt-win install\`. (${Q.stderr})`);return{target:Y.target,stderr:Q.stderr}}finally{X?.close()}}function c7($={}){return j9(l7(["user","status"],{srtWin:$.srtWin}))}async function dX($={}){return j9(await p7(["user","status"],{srtWin:$.srtWin}))}function n7($,J={}){let X=$??c7(J);if(!X.caCertThumb||!X.caCertPem)return null;return{pem:X.caCertPem,thumb:X.caCertThumb}}function wK($,J={}){let X=g0(["user","trust-ca",$],{timeoutMs:60000,srtWin:J.srtWin});w5($,X)}async function C5($,J={}){let X=await m7(["user","trust-ca",$],{timeoutMs:60000,srtWin:J.srtWin});w5($,X)}function w5($,J){if(Z(`[Sandbox Windows] user trust-ca exit=${J.status}: ${J.stderr||J.stdout}`),J.status!==0)throw new A$("trust_ca_failed",`srt-win user trust-ca '${$}' failed (exit ${J.status}): ${J.stderr||J.stdout}`)}function P5(){let $=process.env.ProgramData;if(!$)throw Error("ProgramData is not set");return $J.win32.join($,"sandbox-runtime")}async function i7($={}){let J=$.status??await dX({srtWin:$.srtWin});if(!J.provisioned||!J.credPresent)throw Error(`ensurePersistentWindowsCa: sandbox user is not provisioned (user=${J.provisioned}, cred=${J.credPresent}). Run \`npx sandbox-runtime windows-install\` first.`);let X=$.dir?void 0:P5();if(X&&!JJ.existsSync(X))throw Error(`ensurePersistentWindowsCa: state directory ${X} does not exist. Run \`npx sandbox-runtime windows-install\` first.`);let Q=$.dir??$J.win32.join(X,"ca"),Y=$J.join(Q,"ca.json"),G=$J.join(Q,"cert.pem"),W=$J.join(Q,"key.pem"),U=($.regenerateWithinDays??30)*24*60*60*1000,M=(L,R)=>{let I=`${L}.tmp.${process.pid}`;JJ.writeFileSync(I,R),JJ.renameSync(I,L)},O=async(L,R,I,j)=>{M(G,L),M(W,R);let C=j||J.caCertThumb!==I;if(C){let w=$J.join(Q,`.trust.${process.pid}.${Date.now()}.pem`);JJ.writeFileSync(w,L);try{await C5(w,{srtWin:$.srtWin})}finally{JJ.rmSync(w,{force:!0})}}return Z(`[Sandbox Windows] persistent CA ${j?"generated":"reused"} (thumb=${I}${C&&!j?", trust reconciled":""})`),{certPem:L,keyPem:R,certPath:G,keyPath:W,thumbprint:I,generated:j,trusted:C}},V=()=>{let L;try{L=JSON.parse(JJ.readFileSync(Y,"utf8"))}catch(I){Z(`[Sandbox Windows] persistent CA ca.json unreadable (${I.message})`,{level:"warn"});return}if(typeof L.certPem!=="string"||typeof L.keyPem!=="string")return;let R=xX(L.certPem,L.keyPem);if(!R.ok){Z(`[Sandbox Windows] persistent CA invalid (${R.reason})`,{level:"warn"});return}return{certPem:L.certPem,keyPem:L.keyPem,thumbprint:R.thumbprint,notAfter:R.notAfter}};if(!$.force){let L=V();if(L&&L.notAfter.getTime()-Date.now()>U)return await O(L.certPem,L.keyPem,L.thumbprint,!1);if(L)Z(`[Sandbox Windows] persistent CA expiring ${L.notAfter.toISOString()}; regenerating`,{level:"warn"})}JJ.mkdirSync(Q,{recursive:!0});try{let L=Date.now()-300000;for(let R of JJ.readdirSync(Q)){if(!R.includes(".tmp.")&&!R.startsWith(".trust."))continue;let I=$J.join(Q,R);if(JJ.statSync(I).mtimeMs<L)JJ.rmSync(I,{force:!0})}}catch{}let H=aY({cn:"sandbox-runtime persistent CA"});M(Y,JSON.stringify({certPem:H.certPem,keyPem:H.keyPem}));let q=V(),{certPem:F,keyPem:K,thumbprint:A}=q??{certPem:H.certPem,keyPem:H.keyPem,thumbprint:gQ(H.certPem)};return await O(F,K,A,!0)}function o7($){return $.timeoutMs??120000}function _5($){let J=["install"];if($.sublayerGuid)J.push("--sublayer-guid",$.sublayerGuid);if($.proxyPortRange)J.push("--proxy-port-range",`${$.proxyPortRange[0]}-${$.proxyPortRange[1]}`);if($.sandboxUser)J.push("--sandbox-user",$.sandboxUser);if($.force)J.push("--force");return J}function x5($){if($ instanceof A$&&$.code==="srt_win_timeout")throw new A$("install_timeout","srt-win install timed out \u2014 the UAC prompt may still be open. "+`Re-run when ready to grant elevation. (${$.message})`);throw $}function v5($){if(Z(`[Sandbox Windows] install exit=${$.status}: ${$.stderr||$.stdout}`),$.status===0||$.status===10)return;let J=$.stderr||$.stdout;switch($.status){case 12:throw new A$("install_wfp_failed",`srt-win install: WFP filter install failed: ${J}`);case 14:throw new A$("install_user_failed",`srt-win install: sandbox user provisioning failed: ${J}`);case 13:throw new A$("install_config_conflict",`srt-win install: filters already exist under this sublayer with a different port range or sandbox-user name. Pass {force: true} to replace, or pick a different sublayerGuid. Output: ${J}`);case 17:throw new A$("install_ambient_failed",`srt-win install: ambient write-deny stamping failed (stock world-writable system dirs could not be deny-stamped for the sandbox user): ${J}`);default:throw new A$("install_failed",`srt-win install failed (exit ${$.status}): ${J}`)}}function PK($={}){let J=$.srtWin??wJ(),X;try{X=g0(_5($),{timeoutMs:o7($),srtWin:J})}catch(Y){x5(Y)}v5(X);let Q=j5({sublayerGuid:$.sublayerGuid,srtWin:J});return X.status===10?{...Q,cancelled:!0}:Q}async function _K($={}){let J=$.srtWin??wJ(),X;try{X=await m7(_5($),{timeoutMs:o7($),srtWin:J})}catch(Y){x5(Y)}v5(X);let Q=await T5({sublayerGuid:$.sublayerGuid,srtWin:J});return X.status===10?{...Q,cancelled:!0}:Q}function xK($={}){let J=["uninstall"];if($.sublayerGuid)J.push("--sublayer-guid",$.sublayerGuid);if($.keepUser)J.push("--keep-user");let X=g0(J,{timeoutMs:o7($),srtWin:$.srtWin});if(Z(`[Sandbox Windows] uninstall exit=${X.status}: ${X.stderr||X.stdout}`),X.status===10)return{cancelled:!0};if(X.status!==0)throw new A$("uninstall_failed",`srt-win uninstall failed (exit ${X.status}): ${X.stderr||X.stdout}`);return{}}function T9($,J){let X=new Set;for(let Q of $){let Y=XJ(Q),G=HX(Y);if(qX(Y)&&!G){X.add(Y);continue}let W=G?e0(Y,{caseInsensitive:!0}):[Y];for(let U of W){if(!JJ.statSync(U,{throwIfNoEntry:!1})){if(J?.mode==="deny"&&!G)X.add(/[\\/]$/.test(Q)&&!/[\\/]$/.test(U)?U+"\\":U);continue}X.add(U)}}return[...X]}function vK($){for(let J of $.split(/\r?\n/)){let X=J.trim();if(!X.startsWith("{")||!X.includes('"code"'))continue;try{let Q=JSON.parse(X);if(Q.code==="mapped_drive_cwd")return Object.assign(new A$("mapped_drive_cwd",Q.message??"mapped/network-drive working directory","exec"),{drive:Q.drive})}catch{}}return}function a7($){let J=$.holderPid??process.pid,X=JSON.stringify({denyRead:$.denyRead,denyWrite:$.denyWrite}),Q=g0(["acl","stamp","--holder-pid",`${J}`,"--sandbox-user-sid",$.sandboxUserSid],{timeoutMs:60000,stdin:X,srtWin:$.srtWin});if(Z(`[Sandbox Windows] acl stamp exit=${Q.status}: ${Q.stderr||Q.stdout}`),Q.status!==0)throw new A$("acl_stamp_failed",`srt-win acl stamp exited ${Q.status} `+(Q.status===2?"(partial \u2014 some inputs skipped)":"(failed)")+`: ${Q.stderr||Q.stdout}`)}function S9($){let J=$.holderPid??process.pid;try{let X=Z5(["acl","restore","--holder-pid",`${J}`,"--sandbox-user-sid",$.sandboxUserSid,"--json"],{timeoutMs:60000,srtWin:$.srtWin});if(!X.ok)Z(`[Sandbox Windows] acl restore exited non-zero (per-path outcomes preserved): ${X.stderr}`,{level:"error"});return Array.isArray(X.json)?X.json:[...X.json.paths??[],...X.json.parents??[]]}catch(X){Z(`[Sandbox Windows] acl restore: ${X.message}`,{level:"error"});return}}function s7($){let J=$.holderPid??process.pid,X=JSON.stringify({read:$.read,write:$.write}),Q=g0(["acl","grant","--holder-pid",`${J}`,"--sandbox-user-sid",$.sandboxUserSid],{timeoutMs:60000,stdin:X,srtWin:$.srtWin});if(Z(`[Sandbox Windows] acl grant exit=${Q.status}: ${Q.stderr||Q.stdout}`),Q.status!==0)throw new A$("acl_grant_failed",`srt-win acl grant exited ${Q.status}: ${Q.stderr||Q.stdout}`)}function I9($){let J=$.holderPid??process.pid;try{let X=Z5(["acl","revoke","--holder-pid",`${J}`,"--sandbox-user-sid",$.sandboxUserSid,"--json"],{timeoutMs:60000,srtWin:$.srtWin});if(!X.ok)Z(`[Sandbox Windows] acl revoke exited non-zero: ${X.stderr}`,{level:"error"});return X.json}catch(X){Z(`[Sandbox Windows] acl revoke: ${X.message}`,{level:"error"});return}}function k5($){let{exe:J,prependArgs:X}=$.srtWin??wJ(),Q=kK(ZQ($.httpProxyPort,$.socksProxyPort,$.caCertPath?.replace(/\\/g,"/"),$.proxyAuthToken,void 0,PJ($.commandId??$.command)));delete Q.TMPDIR,delete Q.NO_PROXY,delete Q.no_proxy;let Y=KX({safeDirs:[$.cwd??process.cwd(),...$.allowWrite??[],...$.gitSafeDirectories??[]],schannelCa:$.caCertPath!==void 0,baseEnv:$.setEnvVars}),G=[J,...X,"exec"];if($.quiet!==!1)G.push("--quiet");for(let V of $.denyRead??[])G.push("--deny-read",V);for(let V of $.denyWrite??[])G.push("--deny-write",V);let W={PATH:process.env.PATH,PATHEXT:process.env.PATHEXT,...$.setEnvVars??{},...Q,...Y};for(let[V,H]of Object.entries(W))if(H!==void 0)G.push("--env",`${V}=${H}`);G.push("--");let U=$.binShell??Z9(void 0);G.push(U.exe,...U.args,$.command);let M=G.reduce((V,H)=>V+H.length+3,0);if(M>30000)throw new A$("argv_too_long",`Windows sandbox argv is ~${M} chars (CreateProcessW limit is 32 767).`);let O={...process.env,...Q};return{argv:G,env:O}}function kK($){let J={};for(let X of $){let Q=X.indexOf("=");if(Q===-1)continue;J[X.slice(0,Q)]=X.slice(Q+1)}return J}function g7($){let J=$?` --sublayer-guid ${$}`:"";return`Windows sandbox needs a one-time install (one UAC prompt):
|
|
69
69
|
npx sandbox-runtime windows-install
|