@@ -34,7 +34,7 @@ import { encodeManagedStartupProfile } from "../../../onboard/managed-startup/pr
3434import type { RuntimeProviderBundle } from "../../../onboard/runtime-provider/contract" ;
3535import type { SandboxEntry , SandboxWorkloadReceipt } from "../../../state/registry/types" ;
3636import { createSandboxHostLocalInferenceProvenance } from "../../../state/registry/host-local-inference" ;
37- import type { BackupOptions , BackupResult , StateFileCaptureRequest } from "../../../state/sandbox" ;
37+ import type { BackupOptions , BackupResult } from "../../../state/sandbox" ;
3838import {
3939 backupSandboxStateWithManagedAuthority ,
4040 captureOpenClawStateFile ,
@@ -78,15 +78,6 @@ function sandbox(
7878 } ;
7979}
8080
81- function expectOpenClawStateFilesRejected (
82- requests : readonly StateFileCaptureRequest [ ] ,
83- ) : void {
84- for ( const request of requests ) {
85- expect ( captureOpenClawStateFile ( "alpha" , request ) ) . toBeNull ( ) ;
86- }
87- }
88-
89-
9081function runtime ( handle = "session-1" ) {
9182 return {
9283 schemaVersion : 1 ,
@@ -325,26 +316,33 @@ describe("managed snapshot backup authority", () => {
325316 } ) ;
326317 } ) ;
327318
328- it ( "does not grant privileged capture to undeclared paths or strategies" , ( ) => {
329- const requests : StateFileCaptureRequest [ ] = [
330- {
319+ it . each ( [
320+ {
321+ input : "an undeclared OpenClaw state file path" ,
322+ request : {
331323 sandboxName : "alpha" ,
332324 dir : "/sandbox/.openclaw" ,
333325 spec : { path : "credentials/token" , strategy : "copy" } ,
334326 } ,
335- {
327+ } ,
328+ {
329+ input : "an undeclared OpenClaw state file strategy" ,
330+ request : {
336331 sandboxName : "alpha" ,
337332 dir : "/sandbox/.openclaw" ,
338333 spec : { path : "openclaw.json" , strategy : "sqlite_backup" } ,
339334 } ,
340- {
335+ } ,
336+ {
337+ input : "an undeclared OpenClaw state directory" ,
338+ request : {
341339 sandboxName : "alpha" ,
342340 dir : "/sandbox/other" ,
343341 spec : { path : "openclaw.json" , strategy : "copy" } ,
344342 } ,
345- ] ;
346-
347- expectOpenClawStateFilesRejected ( requests ) ;
343+ } ,
344+ ] as const ) ( "rejects $input before privileged capture" , ( { request } ) => {
345+ expect ( captureOpenClawStateFile ( "alpha" , request ) ) . toBeNull ( ) ;
348346 expect ( privilegedCaptureMocks . withPrivilegedSandboxExecutionLease ) . not . toHaveBeenCalled ( ) ;
349347 expect ( privilegedCaptureMocks . dockerSpawnSync ) . not . toHaveBeenCalled ( ) ;
350348 } ) ;
0 commit comments