ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / platform / agentHost / test / node / sessionPermissions.test.ts 752 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
import assert from 'assert' ;
import { mkdirSync, mkdtempSync, realpathSync, rmSync, symlinkSync } from 'fs' ;
import { homedir, tmpdir } from 'os' ;
import { DisposableStore } from '../../../../base/common/lifecycle.js' ;
import { Schemas } from '../../../../base/common/network.js' ;
import { join } from '../../../../base/common/path.js' ;
import { isLinux, isWindows } from '../../../../base/common/platform.js' ;
import
ensureNoDisposablesAreLeakedInTestSuite
NullLogService
withChatSurfaceMeta
AgentHostEditAutoApprovePatternsConfigKey AgentHostGlobalAutoApproveEnabledConfigKey AgentHostTerminalAutoApproveEnabledConfigKey AgentHostTerminalAutoApproveRulesConfigKey platformSessionSchema
ISessionDataService
mergeChatEditAutoApprovePatterns
SessionConfigKey
buildChatUri SessionStatus ToolCallConfirmationReason
AgentConfigurationService
AgentHostStateManager
SessionPermissionManager
createSessionDataService
disposables
manager AgentHostStateManager
configService AgentConfigurationService
permissions SessionPermissionManager
sessionDataService ISessionDataService
workDir
workDir2
outsideDir
sessionUri scheme path
directoryLinkType isWindows
resource workingDirectories SessionSummary
resource
provider
title
status SessionStatus Idle
createdAt
modifiedAt
project uri displayName
workingDirectories workingDirectories length workingDirectories
permissionPath IToolApprovalEvent
toolCallId session sessionUri permissionKind permissionPath
permissionPath resource sessionUri IToolApprovalEvent
toolCallId session resource permissionKind permissionPath
commandLine shellLanguage IToolApprovalEvent IToolApprovalEvent
toolCallId session sessionUri permissionKind toolInput commandLine shellLanguage
commandLine IToolApprovalEvent
commandLine
baseTmp process env process env
workDir baseTmp
workDir2 baseTmp
outsideDir baseTmp
manager disposables
configService disposables manager
baseSessionDataService
sessionDataRoot outsideDir
sessionDataService
baseSessionDataService
session sessionDataRoot session path
permissions disposables manager configService sessionDataService
permissions
manager sessionUri workDir
disposables
workDir recursive force
workDir2 recursive force
outsideDir recursive force
result permissions workDir sessionUri
assert result ToolCallConfirmationReason NotNeeded
peerChat sessionUri
attachmentPath
sessionDataService sessionUri
fsPath
otherAttachmentPath
sessionDataService scheme path
fsPath
results
permissions attachmentPath peerChat peerChat
permissions otherAttachmentPath peerChat peerChat
assert results ToolCallConfirmationReason NotNeeded
snapshot sessionDataService sessionUri fsPath
assert
snapshotWrite permissions snapshot sessionUri
workingDirWrite permissions workDir sessionUri
snapshotRead permissions snapshot sessionUri
snapshotWrite
workingDirWrite
snapshotRead
configService AgentHostGlobalAutoApproveEnabledConfigKey
snapshot sessionDataService sessionUri fsPath
assert
autoApproval permissions snapshot sessionUri
forbidden permissions snapshot sessionUri
autoApproval ToolCallConfirmationReason Setting
forbidden
result permissions outsideDir sessionUri
assert result
files
results ToolCallConfirmationReason
file files
results permissions workDir file sessionUri
assert results files
isLinux
files
results files file permissions workDir file sessionUri
assert results files
files
results files file permissions workDir file sessionUri
assert results files
configService
AgentHostEditAutoApprovePatternsConfigKey
assert
permissions workDir sessionUri
permissions workDir sessionUri
permissions workDir sessionUri
permissions workDir sessionUri
permissions workDir sessionUri
ToolCallConfirmationReason NotNeeded
assert
patterns
configService AgentHostEditAutoApprovePatternsConfigKey patterns
assert
lastPatterns Object patterns
approval permissions workDir sessionUri
lastPatterns
approval
configService
AgentHostEditAutoApprovePatternsConfigKey
result permissions workDir sessionUri
assert result
files
results ToolCallConfirmationReason
file files
results permissions workDir file sessionUri
assert results files
files
results ToolCallConfirmationReason
file files
results permissions workDir file sessionUri
assert results files
result permissions workDir sessionUri
assert result
outsideDir workDir directoryLinkType
result permissions workDir sessionUri
assert result
workDir
workDir workDir directoryLinkType
result permissions workDir sessionUri
assert result ToolCallConfirmationReason NotNeeded
homeSession scheme path
manager homeSession
result permissions homeSession
assert result
manager sessionUri
schema platformSessionSchema
values SessionConfigKey AutoApprove
result permissions outsideDir sessionUri
assert result ToolCallConfirmationReason Setting
inside permissions workDir sessionUri
outside permissions outsideDir sessionUri
assert inside outside ToolCallConfirmationReason NotNeeded
remoteSessionUri scheme path
remoteWorkingDirectory scheme Schemas vscodeRemote authority path workDir path
manager remoteSessionUri remoteWorkingDirectory
result permissions workDir remoteSessionUri remoteSessionUri
assert result
workDir
outsideDir workDir directoryLinkType
result permissions workDir sessionUri
assert result
workDir
workDir workDir directoryLinkType
result permissions workDir sessionUri
assert result ToolCallConfirmationReason NotNeeded
workDir outsideDir directoryLinkType
result permissions outsideDir sessionUri
assert result
linkedWorkDir outsideDir
linkedSessionUri scheme path
workDir linkedWorkDir directoryLinkType
manager linkedSessionUri linkedWorkDir
result permissions linkedWorkDir linkedSessionUri linkedSessionUri
assert result ToolCallConfirmationReason NotNeeded
results ToolCallConfirmationReason
code
deniedPermissions disposables manager
error NodeJS ErrnoException
error code code
error
configService sessionDataService
deniedPermissions
results deniedPermissions workDir sessionUri
assert results
result permissions sessionUri
assert result ToolCallConfirmationReason NotNeeded
event
assert
approval permissions event sessionUri
ruleResolvable permissions event sessionUri
approval
ruleResolvable
configService AgentHostTerminalAutoApproveRulesConfigKey
result permissions sessionUri
assert result
configService AgentHostTerminalAutoApproveRulesConfigKey echo
result permissions sessionUri
assert result
configService AgentHostTerminalAutoApproveRulesConfigKey python
result permissions sessionUri
assert result ToolCallConfirmationReason NotNeeded
configService
AgentHostTerminalAutoApproveEnabledConfigKey
AgentHostTerminalAutoApproveRulesConfigKey echo
result permissions sessionUri
assert result
cases name event IToolApprovalEvent expected
requestSandboxBypass
assert
cases name e
cases name expected
configService AgentHostTerminalAutoApproveEnabledConfigKey
assert permissions sessionUri
pwshEvent
assert
permissions pwshEvent sessionUri
permissions sessionUri
permissions pwshEvent sessionUri
permissions sessionUri
ToolCallConfirmationReason NotNeeded
configService
AgentHostTerminalAutoApproveRulesConfigKey
assert
permissions sessionUri
permissions sessionUri
permissions sessionUri
permissions sessionUri
dynamicResults
dest
dynamicResults permissions sessionUri
assert
dynamicResults
literalWorkspaceDestination permissions sessionUri
nullSink permissions sessionUri
dynamicResults
literalWorkspaceDestination ToolCallConfirmationReason NotNeeded
nullSink ToolCallConfirmationReason NotNeeded
delayedExpansion
literalExclamation
assert
delayedApproval permissions delayedExpansion sessionUri
delayedRuleResolvable permissions delayedExpansion sessionUri
literalApproval permissions literalExclamation sessionUri
delayedApproval
delayedRuleResolvable
literalApproval ToolCallConfirmationReason NotNeeded
event
assert
approval permissions event sessionUri
ruleResolvable permissions event sessionUri
approval
ruleResolvable
configService
AgentHostTerminalAutoApproveEnabledConfigKey
AgentHostTerminalAutoApproveRulesConfigKey echo
manager sessionUri
schema platformSessionSchema
values SessionConfigKey AutoApprove
result permissions sessionUri
assert result ToolCallConfirmationReason Setting
configService AgentHostGlobalAutoApproveEnabledConfigKey
result permissions outsideDir sessionUri
assert result ToolCallConfirmationReason Setting
configService
AgentHostGlobalAutoApproveEnabledConfigKey
AgentHostTerminalAutoApproveEnabledConfigKey
result permissions sessionUri
assert result ToolCallConfirmationReason Setting
assert permissions
assert permissions sessionUri
configService AgentHostGlobalAutoApproveEnabledConfigKey
assert permissions
assert permissions sessionUri
inlineSessionUri scheme path
targetUri
manager
inlineSessionUri workDir
_meta
surface
languageId
targetUri targetUri
event IToolApprovalEvent IToolApprovalEvent
event session inlineSessionUri
target workDir
target
result permissions target inlineSessionUri
assert result ToolCallConfirmationReason NotNeeded
target outsideDir
target
assert
inlineWrite permissions target inlineSessionUri
inlineRead permissions target inlineSessionUri inlineSessionUri
unscopedWrite permissions target sessionUri
unscopedRead permissions target sessionUri
inlineWrite ToolCallConfirmationReason NotNeeded
inlineRead ToolCallConfirmationReason NotNeeded
unscopedWrite
unscopedRead
workDir
otherFile workDir
assert
inline permissions otherFile inlineSessionUri
unscoped permissions otherFile sessionUri
inline
unscoped ToolCallConfirmationReason NotNeeded
workDir
configService AgentHostTerminalAutoApproveRulesConfigKey echo
assert
inline permissions inlineSessionUri
unscoped permissions sessionUri
inline
unscoped ToolCallConfirmationReason NotNeeded
workDir
result permissions
workDir inlineSessionUri
inlineSessionUri
assert result ToolCallConfirmationReason NotNeeded
result permissions workDir inlineSessionUri
assert result
workDir
configService AgentHostGlobalAutoApproveEnabledConfigKey
result permissions workDir inlineSessionUri
assert result ToolCallConfirmationReason Setting
multiUri scheme path
manager multiUri workDir workDir2
results
permissions workDir multiUri multiUri
permissions workDir2 multiUri multiUri
permissions outsideDir multiUri multiUri
permissions workDir multiUri
permissions workDir2 multiUri
permissions outsideDir multiUri
assert results
ToolCallConfirmationReason NotNeeded
ToolCallConfirmationReason NotNeeded
ToolCallConfirmationReason NotNeeded
ToolCallConfirmationReason NotNeeded
result permissions multiUri
assert result ToolCallConfirmationReason NotNeeded
isWindows test skip test
intoPeer permissions multiUri
outside permissions multiUri
assert intoPeer outside ToolCallConfirmationReason NotNeeded
workDir2 workDir directoryLinkType
read permissions workDir multiUri multiUri
write permissions workDir multiUri
assert read write
{
URI
}
from
'../../../../base/common/uri.js'
;
import
{
}
from
'../../../../base/test/common/utils.js'
;
import
{
}
from
'../../../log/common/log.js'
;
import
{
}
from
'../../common/meta/agentChatSurfaceMeta.js'
;
import
{
,
,
,
,
}
from
'../../common/agentHostSchema.js'
;
import
{
,
SESSION_ATTACHMENTS_DIRNAME
}
from
'../../common/sessionDataService.js'
;
import
{
DEFAULT_EDIT_AUTO_APPROVE_PATTERNS
,
}
from
'../../../chat/common/chatSettings.js'
;
import
{
}
from
'../../common/sessionConfigKeys.js'
;
import
{
,
,
,
type
SessionSummary
}
from
'../../common/state/sessionState.js'
;
import
{
}
from
'../../node/agentConfigurationService.js'
;
import
{
}
from
'../../node/agentHostStateManager.js'
;
import
{
,
type
IToolApprovalEvent
}
from
'../../node/sessionPermissions.js'
;
import
{
}
from
'../common/sessionTestHelpers.js'
;
suite
(
'SessionPermissionManager'
,
(
)
=>
{
const
=
new
DisposableStore
(
)
;
let
:
;
let
:
;
let
:
;
let
:
;
let
:
string
;
let
:
string
;
let
:
string
;
const
=
URI
.
from
(
{
:
'copilot'
,
:
'/s'
}
)
.
toString
(
)
;
const
=
?
'junction'
:
'dir'
;
function
makeSummary
(
:
string
,
...
:
string
[
]
)
:
{
return
{
,
:
'copilot'
,
:
't'
,
:
.
,
:
new
Date
(
)
.
toISOString
(
)
,
:
new
Date
(
)
.
toISOString
(
)
,
:
{
:
'file:///project'
,
:
'Project'
}
,
:
.
>
0
?
:
undefined
,
}
;
}
function
writeEvent
(
:
string
)
:
{
return
{
:
'tc-1'
,
:
URI
.
parse
(
)
,
:
'write'
,
}
;
}
function
readEvent
(
:
string
,
=
)
:
{
return
{
:
'tc-read'
,
:
URI
.
parse
(
)
,
:
'read'
,
}
;
}
function
shellEvent
(
:
string
,
:
[
'shellLanguage'
]
)
:
{
return
{
:
'tc-shell'
,
:
URI
.
parse
(
)
,
:
'shell'
,
:
,
}
;
}
function
powershellEvent
(
:
string
)
:
{
return
shellEvent
(
,
'powershell'
)
;
}
setup
(
async
(
)
=>
{
const
=
.
.
AGENT_TEMPDIRECTORY
||
.
.
RUNNER_TEMP
||
tmpdir
(
)
;
=
realpathSync
(
mkdtempSync
(
join
(
,
'sesperm-work-'
)
)
)
;
=
realpathSync
(
mkdtempSync
(
join
(
,
'sesperm-work2-'
)
)
)
;
=
realpathSync
(
mkdtempSync
(
join
(
,
'sesperm-out-'
)
)
)
;
=
.
add
(
new
AgentHostStateManager
(
new
NullLogService
(
)
)
)
;
=
.
add
(
new
AgentConfigurationService
(
,
new
NullLogService
(
)
)
)
;
const
=
createSessionDataService
(
)
;
const
=
URI
.
file
(
join
(
,
'session-data'
)
)
;
=
{
...
,
getSessionDataDir
:
=>
URI
.
joinPath
(
,
.
.
slice
(
1
)
)
,
}
;
=
.
add
(
new
SessionPermissionManager
(
,
{
}
,
,
new
NullLogService
(
)
,
)
)
;
await
.
initialize
(
)
;
.
createSession
(
makeSummary
(
,
URI
.
file
(
)
.
toString
(
)
)
)
;
}
)
;
teardown
(
(
)
=>
{
.
clear
(
)
;
rmSync
(
,
{
:
true
,
:
true
}
)
;
rmSync
(
,
{
:
true
,
:
true
}
)
;
rmSync
(
,
{
:
true
,
:
true
}
)
;
}
)
;
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
test
(
'auto-approves a normal file inside the working directory'
,
async
(
)
=>
{
const
=
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'src'
,
'app.ts'
)
)
,
)
;
.
strictEqual
(
,
.
)
;
}
)
;
test
(
'auto-approves an owning-session attachment for a peer chat but not another session attachment'
,
async
(
)
=>
{
const
=
buildChatUri
(
,
'peer'
)
;
const
=
URI
.
joinPath
(
.
getSessionDataDir
(
URI
.
parse
(
)
)
,
SESSION_ATTACHMENTS_DIRNAME
,
'attachment-id'
,
'Pasted text #1.txt'
,
)
.
;
const
=
URI
.
joinPath
(
.
getSessionDataDir
(
URI
.
from
(
{
:
'copilot'
,
:
'/other'
}
)
)
,
SESSION_ATTACHMENTS_DIRNAME
,
'attachment-id'
,
'other.txt'
,
)
.
;
const
=
await
Promise
.
all
(
[
.
getAutoApproval
(
readEvent
(
,
)
,
)
,
.
getAutoApproval
(
readEvent
(
,
)
,
)
,
]
)
;
.
deepStrictEqual
(
,
[
.
,
undefined
]
)
;
}
)
;
test
(
'isForbiddenSnapshotWrite flags writes to a session attachment snapshot but not reads or working-dir writes (#331154)'
,
(
)
=>
{
const
=
URI
.
joinPath
(
.
getSessionDataDir
(
URI
.
parse
(
)
)
,
SESSION_ATTACHMENTS_DIRNAME
,
'id'
,
'Pasted text #1.txt'
)
.
;
.
deepStrictEqual
(
{
:
.
isForbiddenSnapshotWrite
(
writeEvent
(
)
,
)
,
:
.
isForbiddenSnapshotWrite
(
writeEvent
(
join
(
,
'app.ts'
)
)
,
)
,
:
.
isForbiddenSnapshotWrite
(
readEvent
(
)
,
)
,
}
,
{
:
true
,
:
false
,
:
false
,
}
)
;
}
)
;
test
(
'isForbiddenSnapshotWrite is independent of auto-approve config (used by the interactive deny path) (#331154)'
,
async
(
)
=>
{
.
updateRootConfig
(
{
[
]
:
true
}
)
;
const
=
URI
.
joinPath
(
.
getSessionDataDir
(
URI
.
parse
(
)
)
,
SESSION_ATTACHMENTS_DIRNAME
,
'id'
,
'Pasted text #1.txt'
)
.
;
.
deepStrictEqual
(
{
:
await
.
getAutoApproval
(
writeEvent
(
)
,
)
,
:
.
isForbiddenSnapshotWrite
(
writeEvent
(
)
,
)
,
}
,
{
:
.
,
:
true
,
}
)
;
}
)
;
test
(
'requires confirmation for writes outside the working directory'
,
async
(
)
=>
{
const
=
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'app.ts'
)
)
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'requires confirmation for protected files inside the working directory'
,
async
(
)
=>
{
const
=
[
'.env'
,
'.mcp.json'
,
'package.json'
,
'Cargo.toml'
,
'build.gradle'
,
'build.gradle.kts'
,
'gradle.properties'
,
join
(
'ruby_lsp'
,
'example'
,
'addon'
)
,
join
(
'.git'
,
'config'
)
,
'deps.lock'
,
join
(
'.vscode'
,
'settings.json'
)
,
]
;
const
:
(
|
undefined
)
[
]
=
[
]
;
for
(
const
of
)
{
.
push
(
await
.
getAutoApproval
(
writeEvent
(
join
(
,
)
)
,
)
)
;
}
.
deepStrictEqual
(
,
.
map
(
(
)
=>
undefined
)
)
;
}
)
;
if
(
!
)
{
test
(
'requires confirmation for protected files with non-canonical casing'
,
async
(
)
=>
{
const
=
[
'.ENV'
,
'.MCP.JSON'
,
'Package.json'
,
join
(
'.GIT'
,
'config'
)
,
join
(
'.VSCODE'
,
'settings.json'
)
]
;
const
=
await
Promise
.
all
(
.
map
(
=>
.
getAutoApproval
(
writeEvent
(
join
(
,
)
)
,
)
)
)
;
.
deepStrictEqual
(
,
.
map
(
(
)
=>
undefined
)
)
;
}
)
;
test
(
'requires confirmation for lifecycle configuration files with non-canonical casing'
,
async
(
)
=>
{
const
=
[
join
(
'.GITHUB'
,
'agents'
,
'dev-helper.md'
)
,
join
(
'.GITHUB'
,
'hooks'
,
'say-hi.json'
)
,
join
(
'.CLAUDE'
,
'agents'
,
'dev-helper.md'
)
,
join
(
'.CLAUDE'
,
'settings.json'
)
,
join
(
'.CLAUDE'
,
'settings.local.json'
)
,
join
(
'.claude'
,
'SETTINGS.LOCAL.JSON'
)
,
]
;
const
=
await
Promise
.
all
(
.
map
(
=>
.
getAutoApproval
(
writeEvent
(
join
(
,
)
)
,
)
)
)
;
.
deepStrictEqual
(
,
.
map
(
(
)
=>
undefined
)
)
;
}
)
;
}
test
(
'respects forwarded edit auto-approve patterns'
,
async
(
)
=>
{
.
updateRootConfig
(
{
[
]
:
{
'**/*'
:
false
,
'**/*.ts'
:
true
,
'**/.github/hooks/**'
:
true
,
'**/.npmrc'
:
true
,
}
,
}
)
;
.
deepStrictEqual
(
[
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'src'
,
'app.ts'
)
)
,
)
,
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'README.md'
)
)
,
)
,
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'.github'
,
'hooks'
,
'pre-tool.json'
)
)
,
)
,
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'.npmrc'
)
)
,
)
,
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'packages'
,
'nested'
,
'.npmrc'
)
)
,
)
,
]
,
[
.
,
undefined
,
undefined
,
undefined
,
undefined
]
)
;
}
)
;
test
(
'merges configured edit auto-approve patterns with defaults'
,
(
)
=>
{
.
deepStrictEqual
(
mergeChatEditAutoApprovePatterns
(
{
'**/generated/**'
:
false
,
}
)
,
{
...
DEFAULT_EDIT_AUTO_APPROVE_PATTERNS
,
'**/generated/**'
:
false
,
}
)
;
}
)
;
test
(
'overriding a default pattern keeps the configured order'
,
async
(
)
=>
{
const
=
mergeChatEditAutoApprovePatterns
(
{
'**/*.ts'
:
true
,
'**/*'
:
false
}
)
;
.
updateRootConfig
(
{
[
]
:
}
)
;
.
deepStrictEqual
(
{
:
.
keys
(
)
.
slice
(
-
2
)
,
:
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'src'
,
'app.ts'
)
)
,
)
,
}
,
{
:
[
'**/*.ts'
,
'**/*'
]
,
:
undefined
,
}
)
;
}
)
;
test
(
'malformed edit auto-approve values fail closed'
,
async
(
)
=>
{
.
updateRootConfig
(
{
[
]
:
{
'**/*'
:
'false'
,
}
,
}
)
;
const
=
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'src'
,
'app.ts'
)
)
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'requires confirmation for files that can register lifecycle hooks'
,
async
(
)
=>
{
const
=
[
join
(
'.github'
,
'agents'
,
'dev-helper.md'
)
,
join
(
'.github'
,
'hooks'
,
'say-hi.json'
)
,
join
(
'.claude'
,
'agents'
,
'dev-helper.md'
)
,
join
(
'.claude'
,
'settings.json'
)
,
join
(
'.claude'
,
'settings.local.json'
)
,
]
;
const
:
(
|
undefined
)
[
]
=
[
]
;
for
(
const
of
)
{
.
push
(
await
.
getAutoApproval
(
writeEvent
(
join
(
,
)
)
,
)
)
;
}
.
deepStrictEqual
(
,
.
map
(
(
)
=>
undefined
)
)
;
}
)
;
test
(
'requires confirmation for package manager configuration files'
,
async
(
)
=>
{
const
=
[
'.npmrc'
,
'.yarnrc'
,
'.yarnrc.yml'
,
'.pnpmfile.js'
,
'.pnpmfile.cjs'
,
'.pnpmfile.mjs'
,
'pnpm-workspace.yaml'
,
join
(
'packages'
,
'nested'
,
'.npmrc'
)
,
]
;
const
:
(
|
undefined
)
[
]
=
[
]
;
for
(
const
of
)
{
.
push
(
await
.
getAutoApproval
(
writeEvent
(
join
(
,
)
)
,
)
)
;
}
.
deepStrictEqual
(
,
.
map
(
(
)
=>
undefined
)
)
;
}
)
;
test
(
'requires confirmation for paths containing null bytes'
,
async
(
)
=>
{
const
=
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'a\u0000b.txt'
)
)
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'requires confirmation when a symlink redirects outside the working directory'
,
async
(
)
=>
{
symlinkSync
(
,
join
(
,
'link'
)
,
)
;
const
=
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'link'
,
'secret.txt'
)
)
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'auto-approves when a symlink stays inside the working directory'
,
async
(
)
=>
{
mkdirSync
(
join
(
,
'real'
)
)
;
symlinkSync
(
join
(
,
'real'
)
,
join
(
,
'link-in'
)
,
)
;
const
=
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'link-in'
,
'note.txt'
)
)
,
)
;
.
strictEqual
(
,
.
)
;
}
)
;
test
(
'requires confirmation for home-directory dotfiles'
,
async
(
)
=>
{
const
=
URI
.
from
(
{
:
'copilot'
,
:
'/home'
}
)
.
toString
(
)
;
.
createSession
(
makeSummary
(
,
URI
.
file
(
homedir
(
)
)
.
toString
(
)
)
)
;
const
=
await
.
getAutoApproval
(
writeEvent
(
join
(
homedir
(
)
,
'.sesperm-config-xyz'
)
)
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'auto-approves any write when session bypass is enabled'
,
async
(
)
=>
{
.
setSessionConfig
(
,
{
:
.
toProtocol
(
)
,
:
{
[
.
]
:
'autoApprove'
}
,
}
)
;
const
=
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'anything.txt'
)
)
,
)
;
.
strictEqual
(
,
.
)
;
}
)
;
test
(
'auto-approves reads inside but requires confirmation outside the working directory'
,
async
(
)
=>
{
const
=
await
.
getAutoApproval
(
readEvent
(
join
(
,
'a.txt'
)
)
,
)
;
const
=
await
.
getAutoApproval
(
readEvent
(
join
(
,
'a.txt'
)
)
,
)
;
.
deepStrictEqual
(
[
,
]
,
[
.
,
undefined
]
)
;
}
)
;
test
(
'requires confirmation when the working directory is not a file URI'
,
async
(
)
=>
{
const
=
URI
.
from
(
{
:
'copilot'
,
:
'/remote'
}
)
.
toString
(
)
;
const
=
URI
.
from
(
{
:
.
,
:
'ssh-remote+host'
,
:
URI
.
file
(
)
.
}
)
;
.
createSession
(
makeSummary
(
,
.
toString
(
)
)
)
;
const
=
await
.
getAutoApproval
(
readEvent
(
join
(
,
'a.txt'
)
,
)
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'requires confirmation when a symlinked read ancestor redirects outside the working directory'
,
async
(
)
=>
{
mkdirSync
(
join
(
,
'nested'
)
)
;
symlinkSync
(
,
join
(
,
'nested'
,
'link'
)
,
)
;
const
=
await
.
getAutoApproval
(
readEvent
(
join
(
,
'nested'
,
'link'
,
'secret.txt'
)
)
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'auto-approves a read through a symlink that stays inside the working directory'
,
async
(
)
=>
{
mkdirSync
(
join
(
,
'real-read'
)
)
;
symlinkSync
(
join
(
,
'real-read'
)
,
join
(
,
'link-read'
)
,
)
;
const
=
await
.
getAutoApproval
(
readEvent
(
join
(
,
'link-read'
,
'note.txt'
)
)
,
)
;
.
strictEqual
(
,
.
)
;
}
)
;
test
(
'requires confirmation when only the real read path is inside the working directory'
,
async
(
)
=>
{
symlinkSync
(
,
join
(
,
'link-to-workspace'
)
,
)
;
const
=
await
.
getAutoApproval
(
readEvent
(
join
(
,
'link-to-workspace'
,
'note.txt'
)
)
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'auto-approves reads when the working directory is itself symlinked'
,
async
(
)
=>
{
const
=
join
(
,
'linked-workspace'
)
;
const
=
URI
.
from
(
{
:
'copilot'
,
:
'/linked'
}
)
.
toString
(
)
;
symlinkSync
(
,
,
)
;
.
createSession
(
makeSummary
(
,
URI
.
file
(
)
.
toString
(
)
)
)
;
const
=
await
.
getAutoApproval
(
readEvent
(
join
(
,
'note.txt'
)
,
)
,
)
;
.
strictEqual
(
,
.
)
;
}
)
;
test
(
'requires confirmation when read realpath resolution is denied'
,
async
(
)
=>
{
const
:
(
|
undefined
)
[
]
=
[
]
;
for
(
const
of
[
'EACCES'
,
'EPERM'
]
)
{
const
=
.
add
(
new
SessionPermissionManager
(
,
{
realpath
:
async
(
)
=>
{
const
:
.
=
new
Error
(
` realpath failed with ${ code} `
)
;
.
=
;
throw
;
}
,
}
,
,
new
NullLogService
(
)
,
)
)
;
await
.
initialize
(
)
;
.
push
(
await
.
getAutoApproval
(
readEvent
(
join
(
,
'secret.txt'
)
)
,
)
)
;
}
.
deepStrictEqual
(
,
[
undefined
,
undefined
]
)
;
}
)
;
test
(
'auto-approves shell commands in default permission mode when terminal auto-approve is enabled'
,
async
(
)
=>
{
const
=
await
.
getAutoApproval
(
shellEvent
(
'echo hello'
,
'bash'
)
,
)
;
.
strictEqual
(
,
.
)
;
}
)
;
test
(
'requires confirmation for sed in-place edits'
,
async
(
)
=>
{
const
=
shellEvent
(
'sed -i "s/foo/bar/" file.txt'
,
'bash'
)
;
.
deepStrictEqual
(
{
:
await
.
getAutoApproval
(
,
)
,
:
.
isAutoApproveRuleResolvable
(
,
)
,
}
,
{
:
undefined
,
:
false
,
}
)
;
}
)
;
test
(
'uses forwarded terminal auto-approve rules as the source of truth over fallback defaults'
,
async
(
)
=>
{
.
updateRootConfig
(
{
[
]
:
{
}
}
)
;
const
=
await
.
getAutoApproval
(
shellEvent
(
'echo hello'
,
'bash'
)
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'respects forwarded terminal auto-approve deny rules in default permission mode'
,
async
(
)
=>
{
.
updateRootConfig
(
{
[
]
:
{
:
false
}
}
)
;
const
=
await
.
getAutoApproval
(
shellEvent
(
'echo hello'
,
'bash'
)
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'respects forwarded terminal auto-approve allow rules in default permission mode'
,
async
(
)
=>
{
.
updateRootConfig
(
{
[
]
:
{
:
true
}
}
)
;
const
=
await
.
getAutoApproval
(
shellEvent
(
'python script.py'
,
'bash'
)
,
)
;
.
strictEqual
(
,
.
)
;
}
)
;
test
(
'requires confirmation for shell commands in default permission mode when terminal auto-approve is disabled'
,
async
(
)
=>
{
.
updateRootConfig
(
{
[
]
:
false
,
[
]
:
{
:
true
}
,
}
)
;
const
=
await
.
getAutoApproval
(
shellEvent
(
'echo hello'
,
'bash'
)
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'isAutoApproveRuleResolvable is true only when a missing allow rule is the sole blocker'
,
(
)
=>
{
const
:
[
:
string
,
:
,
:
boolean
]
[
]
=
[
[
'unknown command'
,
shellEvent
(
'my-custom-script'
,
'bash'
)
,
true
]
,
[
'already approved'
,
shellEvent
(
'echo hello'
,
'bash'
)
,
false
]
,
[
'denied'
,
shellEvent
(
'rm file.txt'
,
'bash'
)
,
false
]
,
[
'unapproved write redirect'
,
shellEvent
(
'my-custom-script > /etc/passwd'
,
'bash'
)
,
false
]
,
[
'sandbox bypass'
,
{
...
shellEvent
(
'my-custom-script'
,
'bash'
)
,
:
true
}
,
false
]
,
[
'non-shell'
,
writeEvent
(
'/outside/app.ts'
)
,
false
]
,
]
;
.
deepStrictEqual
(
.
map
(
(
[
,
]
)
=>
` ${ name} = ${ permissions. isAutoApproveRuleResolvable ( e, sessionUri) } `
)
,
.
map
(
(
[
,
,
]
)
=>
` ${ name} = ${ expected} `
)
)
;
}
)
;
test
(
'isAutoApproveRuleResolvable is false when terminal auto-approve is disabled'
,
(
)
=>
{
.
updateRootConfig
(
{
[
]
:
false
}
)
;
.
strictEqual
(
.
isAutoApproveRuleResolvable
(
shellEvent
(
'my-custom-script'
,
'bash'
)
,
)
,
false
)
;
}
)
;
test
(
'shell approval and rule eligibility respect the event shell language'
,
async
(
)
=>
{
const
=
powershellEvent
(
'get-childitem'
)
;
.
deepStrictEqual
(
[
await
.
getAutoApproval
(
,
)
,
await
.
getAutoApproval
(
shellEvent
(
'get-childitem'
,
'bash'
)
,
)
,
.
isAutoApproveRuleResolvable
(
,
)
,
.
isAutoApproveRuleResolvable
(
shellEvent
(
'get-childitem'
,
'bash'
)
,
)
,
]
,
[
.
,
undefined
,
false
,
true
]
)
;
}
)
;
test
(
'PowerShell script-block payloads with nested denials require confirmation'
,
async
(
)
=>
{
.
updateRootConfig
(
{
[
]
:
{
'Measure-Command'
:
true
,
'Set-Content'
:
false
,
'Invoke-Expression'
:
false
,
}
,
}
)
;
.
deepStrictEqual
(
[
await
.
getAutoApproval
(
powershellEvent
(
'Measure-Command { Set-Content -Path out.txt -Value pwned }'
)
,
)
,
await
.
getAutoApproval
(
powershellEvent
(
'Measure-Command { Invoke-Expression "Write-Output hi" }'
)
,
)
,
await
.
getAutoApproval
(
shellEvent
(
'Write-Host hi; Set-Content -Path out.txt -Value pwned'
,
'powershell'
)
,
)
,
await
.
getAutoApproval
(
shellEvent
(
'Measure-Command { Get-ChildItem }'
,
undefined
)
,
)
,
]
,
[
undefined
,
undefined
,
undefined
,
undefined
]
)
;
}
)
;
test
(
'PowerShell redirects require a literal approved destination'
,
async
(
)
=>
{
const
=
[
]
;
for
(
const
of
[
'$HOME/outside.txt'
,
'$env:TEMP/x.txt'
,
'$(Get-Location)/x.txt'
,
'`pwd`/x.txt'
,
'${HOME}/x.txt'
,
'%APPDATA%/x.txt'
]
)
{
.
push
(
await
.
getAutoApproval
(
powershellEvent
(
` Write-Host hi > ${ dest} `
)
,
)
)
;
}
.
deepStrictEqual
(
{
,
:
await
.
getAutoApproval
(
powershellEvent
(
'Write-Host hi >out.txt'
)
,
)
,
:
await
.
getAutoApproval
(
powershellEvent
(
'Write-Host hi >$null'
)
,
)
,
}
,
{
:
[
undefined
,
undefined
,
undefined
,
undefined
,
undefined
,
undefined
]
,
:
.
,
:
.
,
}
)
;
}
)
;
test
(
'CMD delayed-expansion redirect destinations require confirmation'
,
async
(
)
=>
{
const
=
shellEvent
(
'echo hi >!APPDATA!\\outside.txt'
,
'bash'
)
;
const
=
shellEvent
(
'echo hi >important!.txt'
,
'bash'
)
;
.
deepStrictEqual
(
{
:
await
.
getAutoApproval
(
,
)
,
:
.
isAutoApproveRuleResolvable
(
,
)
,
:
await
.
getAutoApproval
(
,
)
,
}
,
{
:
undefined
,
:
false
,
:
.
,
}
)
;
}
)
;
test
(
'missing shell language disables terminal rules and rule suggestions'
,
async
(
)
=>
{
const
=
shellEvent
(
'Get-ChildItem'
,
undefined
)
;
.
deepStrictEqual
(
{
:
await
.
getAutoApproval
(
,
)
,
:
.
isAutoApproveRuleResolvable
(
,
)
,
}
,
{
:
undefined
,
:
false
,
}
)
;
}
)
;
test
(
'does not affect session bypass permission mode when terminal auto-approve is disabled'
,
async
(
)
=>
{
.
updateRootConfig
(
{
[
]
:
false
,
[
]
:
{
:
false
}
,
}
)
;
.
setSessionConfig
(
,
{
:
.
toProtocol
(
)
,
:
{
[
.
]
:
'autoApprove'
}
,
}
)
;
const
=
await
.
getAutoApproval
(
shellEvent
(
'echo hello'
,
'bash'
)
,
)
;
.
strictEqual
(
,
.
)
;
}
)
;
test
(
'auto-approves any write when global auto-approve is enabled, even in default permission mode'
,
async
(
)
=>
{
.
updateRootConfig
(
{
[
]
:
true
}
)
;
const
=
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'anything.txt'
)
)
,
)
;
.
strictEqual
(
,
.
)
;
}
)
;
test
(
'auto-approves shell commands when global auto-approve is enabled, even with terminal auto-approve disabled'
,
async
(
)
=>
{
.
updateRootConfig
(
{
[
]
:
true
,
[
]
:
false
,
}
)
;
const
=
await
.
getAutoApproval
(
shellEvent
(
'rm -rf /tmp/whatever'
,
'bash'
)
,
)
;
.
strictEqual
(
,
.
)
;
}
)
;
test
(
'global auto-approve is reported independently of the session permission picker'
,
(
)
=>
{
.
strictEqual
(
.
isGlobalAutoApproveEnabled
(
)
,
false
)
;
.
strictEqual
(
.
isSessionAutoApproveEnabled
(
)
,
false
)
;
.
updateRootConfig
(
{
[
]
:
true
}
)
;
.
strictEqual
(
.
isGlobalAutoApproveEnabled
(
)
,
true
)
;
.
strictEqual
(
.
isSessionAutoApproveEnabled
(
)
,
false
)
;
}
)
;
suite
(
'surface edit scope'
,
(
)
=>
{
const
=
URI
.
from
(
{
:
'copilot'
,
:
'/inline'
}
)
.
toString
(
)
;
function
createInlineSession
(
:
string
|
undefined
)
:
void
{
.
createSession
(
{
...
makeSummary
(
,
URI
.
file
(
)
.
toString
(
)
)
,
:
withChatSurfaceMeta
(
undefined
,
{
:
'editorInline'
,
:
'typescript'
,
...
(
!==
undefined
?
{
}
:
{
}
)
,
}
)
,
}
)
;
}
function
inlineEvent
(
:
)
:
{
return
{
...
,
:
URI
.
parse
(
)
}
;
}
test
(
'auto-approves a write to the inline chat target file'
,
async
(
)
=>
{
const
=
join
(
,
'src'
,
'inline.ts'
)
;
createInlineSession
(
URI
.
file
(
)
.
toString
(
)
)
;
const
=
await
.
getAutoApproval
(
inlineEvent
(
writeEvent
(
)
)
,
)
;
.
strictEqual
(
,
.
)
;
}
)
;
test
(
'auto-approves reads and writes of the target file outside the working directory'
,
async
(
)
=>
{
const
=
join
(
,
'detached.ts'
)
;
createInlineSession
(
URI
.
file
(
)
.
toString
(
)
)
;
.
deepStrictEqual
(
{
:
await
.
getAutoApproval
(
inlineEvent
(
writeEvent
(
)
)
,
)
,
:
await
.
getAutoApproval
(
inlineEvent
(
readEvent
(
,
)
)
,
)
,
:
await
.
getAutoApproval
(
writeEvent
(
)
,
)
,
:
await
.
getAutoApproval
(
readEvent
(
)
,
)
,
}
,
{
:
.
,
:
.
,
:
undefined
,
:
undefined
,
}
)
;
}
)
;
test
(
'requires confirmation for a write to another file in the working directory'
,
async
(
)
=>
{
createInlineSession
(
URI
.
file
(
join
(
,
'src'
,
'inline.ts'
)
)
.
toString
(
)
)
;
const
=
join
(
,
'src'
,
'app.ts'
)
;
.
deepStrictEqual
(
{
:
await
.
getAutoApproval
(
inlineEvent
(
writeEvent
(
)
)
,
)
,
:
await
.
getAutoApproval
(
writeEvent
(
)
,
)
,
}
,
{
:
undefined
,
:
.
,
}
)
;
}
)
;
test
(
'requires confirmation for shell commands that would otherwise auto-approve'
,
async
(
)
=>
{
createInlineSession
(
URI
.
file
(
join
(
,
'src'
,
'inline.ts'
)
)
.
toString
(
)
)
;
.
updateRootConfig
(
{
[
]
:
{
:
true
}
}
)
;
.
deepStrictEqual
(
{
:
await
.
getAutoApproval
(
inlineEvent
(
powershellEvent
(
'echo hello'
)
)
,
)
,
:
await
.
getAutoApproval
(
powershellEvent
(
'echo hello'
)
,
)
,
}
,
{
:
undefined
,
:
.
,
}
)
;
}
)
;
test
(
'leaves reads unscoped so context gathering stays silent'
,
async
(
)
=>
{
createInlineSession
(
URI
.
file
(
join
(
,
'src'
,
'inline.ts'
)
)
.
toString
(
)
)
;
const
=
await
.
getAutoApproval
(
inlineEvent
(
readEvent
(
join
(
,
'src'
,
'app.ts'
)
,
)
)
,
,
)
;
.
strictEqual
(
,
.
)
;
}
)
;
test
(
'fails closed when the surface recorded no usable target'
,
async
(
)
=>
{
createInlineSession
(
undefined
)
;
const
=
await
.
getAutoApproval
(
inlineEvent
(
writeEvent
(
join
(
,
'src'
,
'app.ts'
)
)
)
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'does not override an explicit global auto-approve opt-in'
,
async
(
)
=>
{
createInlineSession
(
URI
.
file
(
join
(
,
'src'
,
'inline.ts'
)
)
.
toString
(
)
)
;
.
updateRootConfig
(
{
[
]
:
true
}
)
;
const
=
await
.
getAutoApproval
(
inlineEvent
(
writeEvent
(
join
(
,
'src'
,
'app.ts'
)
)
)
,
)
;
.
strictEqual
(
,
.
)
;
}
)
;
}
)
;
suite
(
'multi-root'
,
(
)
=>
{
const
=
URI
.
from
(
{
:
'copilot'
,
:
'/multi'
}
)
.
toString
(
)
;
setup
(
(
)
=>
{
.
createSession
(
makeSummary
(
,
URI
.
file
(
)
.
toString
(
)
,
URI
.
file
(
)
.
toString
(
)
)
)
;
}
)
;
test
(
'auto-approves reads and writes under any root, confirms outside all roots'
,
async
(
)
=>
{
const
=
[
await
.
getAutoApproval
(
readEvent
(
join
(
,
'a.txt'
)
,
)
,
)
,
await
.
getAutoApproval
(
readEvent
(
join
(
,
'a.txt'
)
,
)
,
)
,
await
.
getAutoApproval
(
readEvent
(
join
(
,
'a.txt'
)
,
)
,
)
,
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'x.txt'
)
)
,
)
,
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'x.txt'
)
)
,
)
,
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'x.txt'
)
)
,
)
,
]
;
.
deepStrictEqual
(
,
[
.
,
.
,
undefined
,
.
,
.
,
undefined
,
]
)
;
}
)
;
test
(
'a relative shell redirect resolves against the primary root (index 0)'
,
async
(
)
=>
{
const
=
await
.
getAutoApproval
(
shellEvent
(
'echo hi > out.txt'
,
'bash'
)
,
)
;
.
strictEqual
(
,
.
)
;
}
)
;
(
?
.
:
)
(
'an absolute shell redirect auto-approves under a non-primary root but confirms outside'
,
async
(
)
=>
{
const
=
await
.
getAutoApproval
(
shellEvent
(
` echo hi > ${ join ( workDir2, 'out.txt' ) } `
,
'bash'
)
,
)
;
const
=
await
.
getAutoApproval
(
shellEvent
(
` echo hi > ${ join ( outsideDir, 'out.txt' ) } `
,
'bash'
)
,
)
;
.
deepStrictEqual
(
[
,
]
,
[
.
,
undefined
]
)
;
}
)
;
test
(
'requires confirmation for a symlink that crosses from one root into another (fail-closed)'
,
async
(
)
=>
{
symlinkSync
(
,
join
(
,
'cross-link'
)
,
)
;
const
=
await
.
getAutoApproval
(
readEvent
(
join
(
,
'cross-link'
,
'note.txt'
)
,
)
,
)
;
const
=
await
.
getAutoApproval
(
writeEvent
(
join
(
,
'cross-link'
,
'note.txt'
)
)
,
)
;
.
deepStrictEqual
(
[
,
]
,
[
undefined
,
undefined
]
)
;
}
)
;
}
)
;
}
)
;