Skip to content

Commit 9e176fa

Browse files
koki-developclaude
andcommitted
test: add e2e tests verifying file isolation between sandbox requests
Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fccee12 commit 9e176fa

1 file changed

Lines changed: 129 additions & 0 deletions

File tree

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
tests:
2+
- name: "files created in sandbox are not visible to subsequent requests (node)"
3+
requests:
4+
- input:
5+
runtime: node
6+
files:
7+
- name: index.js
8+
type: plain
9+
content: |
10+
const fs = require("fs");
11+
fs.writeFileSync("/sandbox/persist_test.txt", "secret data");
12+
console.log("written");
13+
output:
14+
status: 200
15+
body:
16+
run:
17+
stdout: "written\n"
18+
stderr: ""
19+
output: "written\n"
20+
exit_code: 0
21+
status: "OK"
22+
signal: null
23+
- input:
24+
runtime: node
25+
files:
26+
- name: index.js
27+
type: plain
28+
content: |
29+
const fs = require("fs");
30+
try {
31+
fs.readFileSync("/sandbox/persist_test.txt");
32+
console.log("LEAKED");
33+
} catch {
34+
console.log("not found");
35+
}
36+
output:
37+
status: 200
38+
body:
39+
run:
40+
stdout: "not found\n"
41+
stderr: ""
42+
output: "not found\n"
43+
exit_code: 0
44+
status: "OK"
45+
signal: null
46+
47+
- name: "files created in sandbox are not visible to subsequent requests (bash)"
48+
requests:
49+
- input:
50+
runtime: bash
51+
files:
52+
- name: main.sh
53+
type: plain
54+
content: |
55+
echo "secret data" > /sandbox/persist_test.txt
56+
echo "written"
57+
output:
58+
status: 200
59+
body:
60+
run:
61+
stdout: "written\n"
62+
stderr: ""
63+
output: "written\n"
64+
exit_code: 0
65+
status: "OK"
66+
signal: null
67+
- input:
68+
runtime: bash
69+
files:
70+
- name: main.sh
71+
type: plain
72+
content: |
73+
if [ -f /sandbox/persist_test.txt ]; then
74+
echo "LEAKED"
75+
else
76+
echo "not found"
77+
fi
78+
output:
79+
status: 200
80+
body:
81+
run:
82+
stdout: "not found\n"
83+
stderr: ""
84+
output: "not found\n"
85+
exit_code: 0
86+
status: "OK"
87+
signal: null
88+
89+
- name: "files written to /tmp are not visible to subsequent requests"
90+
requests:
91+
- input:
92+
runtime: bash
93+
files:
94+
- name: main.sh
95+
type: plain
96+
content: |
97+
echo "secret" > /tmp/leak_test.txt
98+
echo "written"
99+
output:
100+
status: 200
101+
body:
102+
run:
103+
stdout: "written\n"
104+
stderr: ""
105+
output: "written\n"
106+
exit_code: 0
107+
status: "OK"
108+
signal: null
109+
- input:
110+
runtime: bash
111+
files:
112+
- name: main.sh
113+
type: plain
114+
content: |
115+
if [ -f /tmp/leak_test.txt ]; then
116+
echo "LEAKED"
117+
else
118+
echo "not found"
119+
fi
120+
output:
121+
status: 200
122+
body:
123+
run:
124+
stdout: "not found\n"
125+
stderr: ""
126+
output: "not found\n"
127+
exit_code: 0
128+
status: "OK"
129+
signal: null

0 commit comments

Comments
 (0)