external-sandbox-quicksand 0.1.0__tar.gz
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.
- external_sandbox_quicksand-0.1.0/.python-version +1 -0
- external_sandbox_quicksand-0.1.0/LICENSE +202 -0
- external_sandbox_quicksand-0.1.0/PKG-INFO +147 -0
- external_sandbox_quicksand-0.1.0/PROVENANCE.md +47 -0
- external_sandbox_quicksand-0.1.0/README.md +114 -0
- external_sandbox_quicksand-0.1.0/docs/verification.md +59 -0
- external_sandbox_quicksand-0.1.0/examples/proxy-public.json +5 -0
- external_sandbox_quicksand-0.1.0/examples/proxy.json +22 -0
- external_sandbox_quicksand-0.1.0/guest-mux/build.sh +12 -0
- external_sandbox_quicksand-0.1.0/guest-mux/guest_mux.go +209 -0
- external_sandbox_quicksand-0.1.0/pyproject.toml +90 -0
- external_sandbox_quicksand-0.1.0/pyproject.toml.orig +74 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/__init__.py +1 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/__main__.py +4 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/api.py +515 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/app_state.py +8 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/backend.py +415 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/cli.py +130 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/codex.py +553 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/guest_agent.py +350 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/guest_bin/LICENSE-Go +27 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/guest_bin/NOTICE.md +11 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/guest_bin/guest-mux-linux-amd64 +0 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/guest_bin/guest-mux-linux-arm64 +0 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/guest_fs.py +421 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/images.py +196 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/proxy.py +494 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/proxy_bridge.py +208 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/proxy_certificates.py +86 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/proxy_management.py +128 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/proxy_policy.py +344 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/terminal.py +82 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/ui/assets/proxy.html +116 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/ui/assets/terminal.html +17 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/ui/assets/terminal.js +566 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/ui/manifest.json +16 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/ui/package.json +13 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/ui/test/load-assets.mjs +30 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/ui/test/proxy-client.test.mjs +80 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/ui/test/templates.test.mjs +44 -0
- external_sandbox_quicksand-0.1.0/src/external_sandbox_quicksand/ui/test/terminal-client.test.mjs +535 -0
- external_sandbox_quicksand-0.1.0/tests/conftest.py +17 -0
- external_sandbox_quicksand-0.1.0/tests/test_api.py +418 -0
- external_sandbox_quicksand-0.1.0/tests/test_backend.py +201 -0
- external_sandbox_quicksand-0.1.0/tests/test_codex.py +225 -0
- external_sandbox_quicksand-0.1.0/tests/test_codex_cli.py +424 -0
- external_sandbox_quicksand-0.1.0/tests/test_codex_filesystem.py +161 -0
- external_sandbox_quicksand-0.1.0/tests/test_images.py +67 -0
- external_sandbox_quicksand-0.1.0/tests/test_legacy_client.py +68 -0
- external_sandbox_quicksand-0.1.0/tests/test_proxy.py +398 -0
- external_sandbox_quicksand-0.1.0/tests/test_proxy_bridge.py +220 -0
- external_sandbox_quicksand-0.1.0/tests/test_proxy_cli.py +111 -0
- external_sandbox_quicksand-0.1.0/tests/test_proxy_integration.py +357 -0
- external_sandbox_quicksand-0.1.0/tests/test_proxy_management.py +196 -0
- external_sandbox_quicksand-0.1.0/tests/test_proxy_policy.py +120 -0
- external_sandbox_quicksand-0.1.0/tests/test_quicksand_integration.py +170 -0
- external_sandbox_quicksand-0.1.0/tests/test_real_clients.py +85 -0
- external_sandbox_quicksand-0.1.0/tests/test_terminal_js.mjs +4 -0
- external_sandbox_quicksand-0.1.0/tests/test_terminal_ui.py +242 -0
- external_sandbox_quicksand-0.1.0/tests/test_ui_bundle.py +24 -0
- external_sandbox_quicksand-0.1.0/uv.lock +1357 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.14
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: external-sandbox-quicksand
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: External Sandbox server backed by Quicksand QEMU virtual machines
|
|
5
|
+
Author: Simon Willison
|
|
6
|
+
Author-email: Simon Willison <swillison@gmail.com>
|
|
7
|
+
License-Expression: Apache-2.0 AND BSD-3-Clause
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
License-File: src/external_sandbox_quicksand/guest_bin/LICENSE-Go
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: MacOS
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
19
|
+
Classifier: Topic :: Software Development
|
|
20
|
+
Requires-Dist: aiohttp>=3.12,<4
|
|
21
|
+
Requires-Dist: cryptography>=45,<48
|
|
22
|
+
Requires-Dist: h11>=0.16,<1
|
|
23
|
+
Requires-Dist: quick-sandbox==0.12.0
|
|
24
|
+
Requires-Dist: quicksand-core==0.13.0
|
|
25
|
+
Requires-Dist: quicksand-qemu==0.5.12
|
|
26
|
+
Requires-Dist: quicksand-alpine==0.10.0
|
|
27
|
+
Requires-Python: >=3.12
|
|
28
|
+
Project-URL: Homepage, https://github.com/prime-radiant-inc/external-sandbox-quicksand
|
|
29
|
+
Project-URL: Repository, https://github.com/prime-radiant-inc/external-sandbox-quicksand
|
|
30
|
+
Project-URL: Issues, https://github.com/prime-radiant-inc/external-sandbox-quicksand/issues
|
|
31
|
+
Project-URL: Changelog, https://github.com/prime-radiant-inc/external-sandbox-quicksand/releases
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# external-sandbox-quicksand
|
|
35
|
+
|
|
36
|
+
A Python execution server for coding agents that runs commands inside a [Quicksand](https://microsoft.github.io/quicksand/) QEMU virtual machine. It implements the shared [External Sandbox protocol](https://github.com/prime-radiant-inc/external-sandbox/blob/main/PROTOCOL.md), alongside [external-sandbox-v86](https://github.com/prime-radiant-inc/external-sandbox-v86) and [external-sandbox-container](https://github.com/prime-radiant-inc/external-sandbox-container): the same buffered and streaming shell APIs, Codex endpoint, browser terminal, host mounts, and allow-listed HTTP(S) proxy, with a full virtual machine as the sandbox.
|
|
37
|
+
|
|
38
|
+
## Start
|
|
39
|
+
|
|
40
|
+
Requirements: [`uv`](https://docs.astral.sh/uv/) and a host supported by Quicksand. This release is tested on Apple silicon macOS with HVF acceleration; Quicksand publishes no QEMU wheel for Intel Macs. QEMU and the Alpine image arrive as Python wheels; no Homebrew, Docker or separate VM tooling is needed.
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
uvx external-sandbox-quicksand --preserve-paths \
|
|
44
|
+
--mount-rw project=/absolute/path/to/project \
|
|
45
|
+
--mount-ro reference=/absolute/path/to/reference
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`uvx` downloads and runs the latest release from PyPI, including about 100 MB of QEMU and Alpine image wheels on first use. To install the command permanently, use `uv tool install external-sandbox-quicksand`. From a source checkout, use `uv run external-sandbox-quicksand` instead.
|
|
49
|
+
|
|
50
|
+
The server listens on `127.0.0.1:8688`, so it can run beside the v86 (`8686`) and container (`8687`) servers. Mounts appear at `/mnt/project` and `/mnt/reference`; `--preserve-paths` also binds them at their original absolute host paths for clients that send host paths. The first mount is the default working directory; without mounts it is `/workspace`. Stop the server with Ctrl-C to shut down and discard the VM. Files in writable mounts persist on the host; all other guest changes are disposable.
|
|
51
|
+
|
|
52
|
+
The VM gets two CPUs and 1 GiB of memory by default (`--cpus`, `--memory`). `--accel tcg` forces software emulation when hardware acceleration is unavailable. Run `uvx external-sandbox-quicksand --help` for every option.
|
|
53
|
+
|
|
54
|
+
## Guest images
|
|
55
|
+
|
|
56
|
+
**Alpine (default).** Quicksand's Alpine 3.23 image lacks Bash and Python, which the protocol and agent need. On first use, the server boots that image once, installs `bash`, `python3`, `git` and `ripgrep` from `https://dl-cdn.alpinelinux.org` through its own allow-listed proxy (only GET/HEAD to that origin), and saves the result as a Quicksand save under `~/.cache/external-sandbox-quicksand/images/`. On an Apple silicon Mac this took about seven seconds and produced a 65 MB save; later starts boot it directly and serve requests in about a second.
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
uvx external-sandbox-quicksand --prepare-image # prepare now, then exit
|
|
60
|
+
uvx external-sandbox-quicksand --packages git,ripgrep,nodejs,npm,uv,jq
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`--packages` replaces the optional package list (`bash` and `python3` are always included) and prepares a separately cached image. The cache key covers the Quicksand Alpine build, architecture and package list, so a Quicksand upgrade prepares a fresh image. Each prepared image records its installed package versions in `external-sandbox-image.json`. Alpine package versions come from the 3.23 branch at preparation time. Set `--cache-dir` or `XDG_CACHE_HOME` to move the cache.
|
|
64
|
+
|
|
65
|
+
**Ubuntu 24.04 (source checkout only).** Quicksand's Ubuntu image already includes Bash and Python 3.12. Its image wheel (about 300 MB) comes from Microsoft's Quicksand package index rather than PyPI, so it is not part of the published package. From a source checkout, the `ubuntu` dependency group installs it:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
uv run --group ubuntu external-sandbox-quicksand --image ubuntu
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`--image` also accepts a Quicksand save directory, provided it has `/bin/bash` and `python3`.
|
|
72
|
+
|
|
73
|
+
## How it works
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
host: external-sandbox-quicksand (aiohttp) guest: Quicksand VM
|
|
77
|
+
/exec, /exec/ws, /codex ── virtio-serial port ───────────▶ guest_agent.py (python3)
|
|
78
|
+
9p fsdev (readonly=on for ro mounts) ─────────────────────▶ /mnt/<name>
|
|
79
|
+
host proxy ◀── bridge ◀── QEMU guestfwd stream ◀── guest-mux ◀── 127.0.0.1:3128 ◀── HTTP(S)_PROXY
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Quicksand boots the VM and its own guest agent installs this server's agent from the Python package. The private agent speaks length-prefixed JSON over a dedicated virtio-serial port, separate from Quicksand's agent channel and unreachable through guest networking. It runs each command as `/bin/bash -c` in its own process group, streams binary output, and performs Codex filesystem operations inside the guest. These modules, the HTTP/WebSocket/Codex adapters, and the proxy engine are shared with `external-sandbox-container`; see [PROVENANCE.md](https://github.com/prime-radiant-inc/external-sandbox-quicksand/blob/main/PROVENANCE.md).
|
|
83
|
+
|
|
84
|
+
Host directories use QEMU virtio-9p mounts. Read-only mounts set QEMU's `readonly=on`, so the host rejects writes regardless of guest privileges. The VM starts with Quicksand's `NetworkMode.NONE`, which removes its default NIC, host agent port forward and SMB relay.
|
|
85
|
+
|
|
86
|
+
## Browser terminal
|
|
87
|
+
|
|
88
|
+
Open `http://127.0.0.1:8688/` to run commands through the streaming WebSocket API, with stdin, EOF, cancel, history and **Copy session**. Each run starts a new Bash process; files persist for the VM's lifetime. The terminal uses pipes, not a PTY. The HTML, CSS and JavaScript are a pinned bundle of [`external-sandbox-ui`](https://github.com/prime-radiant-inc/external-sandbox-ui) 0.3.0; update it with that repository's `scripts/sync.py`, as described in its README.
|
|
89
|
+
|
|
90
|
+
## Controlled network access
|
|
91
|
+
|
|
92
|
+
Without `--proxy-config` the VM has no network interface. With a policy file, it gets exactly one: a QEMU user-mode NIC with `restrict=on` and a single `guestfwd` rule, `10.0.2.101:3128`, connected to a host stream. Save this starter policy as `proxy.json`; it allows only GET and HEAD requests to `https://example.com`:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"allow": [
|
|
97
|
+
{"origin": "https://example.com", "methods": ["GET", "HEAD"]}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
uvx external-sandbox-quicksand --proxy-config proxy.json
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
QEMU's `guestfwd` TCP backend is one persistent byte stream, so a small static Go helper ([`guest-mux`](https://github.com/prime-radiant-inc/external-sandbox-quicksand/blob/main/guest-mux/guest_mux.go), from the Quicksand proxy prototype) listens on guest `127.0.0.1:3128` and multiplexes each connection over that stream. The host [bridge](https://github.com/prime-radiant-inc/external-sandbox-quicksand/blob/main/src/external_sandbox_quicksand/proxy_bridge.py) opens one connection per channel to the embedded host proxy and nowhere else. Commands receive standard proxy variables, `NODE_USE_ENV_PROXY=1`, and a CA bundle containing the proxy's public certificate.
|
|
107
|
+
|
|
108
|
+
The proxy, policy format, management page and API are the same as the container server's and follow the protocol's proxy profile: exact-origin allow rules with optional methods, paths and CIDRs; public addresses only by default; credential placeholders replaced on the host; secret redaction; and live policy edits at `http://127.0.0.1:8688/proxy` that close existing connections. [examples/proxy.json](https://github.com/prime-radiant-inc/external-sandbox-quicksand/blob/main/examples/proxy.json) demonstrates credential substitution and needs `OPENAI_API_KEY` in the server's environment. Literal redaction cannot prevent an allowed upstream from transforming and echoing a credential, so use credential rules only with trusted services and narrow their methods and paths. Removing proxy variables cannot open another route: QEMU drops everything except the guestfwd stream. If the guestfwd stream fails, proxy access fails closed until restart; `/health` reports `proxyTransport`.
|
|
109
|
+
|
|
110
|
+
## Agents
|
|
111
|
+
|
|
112
|
+
Agent integrations are maintained in [external-sandbox](https://github.com/prime-radiant-inc/external-sandbox):
|
|
113
|
+
|
|
114
|
+
- [Claude Code](https://github.com/prime-radiant-inc/external-sandbox/tree/main/claude-code): set `EXTERNAL_SANDBOX_API_URL=http://127.0.0.1:8688` and start this server with `--preserve-paths --mount-rw project=$PWD`.
|
|
115
|
+
- [Codex](https://github.com/prime-radiant-inc/external-sandbox/tree/main/codex): use executor URL `ws://127.0.0.1:8688/codex`.
|
|
116
|
+
- [Pi](https://github.com/prime-radiant-inc/external-sandbox/tree/main/pi): use `--sandbox-url http://127.0.0.1:8688`. The default Alpine image includes the Python and ripgrep its tools need.
|
|
117
|
+
|
|
118
|
+
## Scope
|
|
119
|
+
|
|
120
|
+
- Commands and Codex filesystem operations run in the VM as guest root. The VM is the isolation boundary; guest root cannot change QEMU's mount modes or network restrictions.
|
|
121
|
+
- Mounts deliberately expose host directories. Read-write mounts change host files immediately; host changes are visible in the guest. Guest root can follow symlinks only within the guest view. A pre-existing host hardlink in a writable mount remains editable even if another name for the same file is in a read-only mount; avoid that alias if the file must stay unchanged. This backend does not reproduce v86's hardlink checks.
|
|
122
|
+
- The guest agent and proxy helper are not trusted by the host. The host bounds frame sizes and validates messages; a compromised guest can disrupt its own commands or proxy access. The host does not provision real credentials to the VM, but an allowed upstream can transform and echo one in its response.
|
|
123
|
+
- Quicksand's own guest agent remains in the VM and is used only by the host for setup.
|
|
124
|
+
- Agent processes, model traffic and host-side tools remain on the host; routing shell commands into the VM does not constrain those tools.
|
|
125
|
+
- The execution listener is for trusted local clients, with the same browser token, Origin, Fetch Metadata and Host checks as the other servers. It is not authentication between mutually untrusted host users or a remote multi-user service.
|
|
126
|
+
|
|
127
|
+
## Test
|
|
128
|
+
|
|
129
|
+
```sh
|
|
130
|
+
uv run pytest -m 'not integration'
|
|
131
|
+
node --test tests/test_terminal_js.mjs
|
|
132
|
+
uv run ruff check .
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Tests marked `integration` boot real VMs and are opt-in:
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
RUN_QUICKSAND_TESTS=1 uv run pytest -m integration
|
|
139
|
+
RUN_QUICKSAND_TESTS=1 SANDBOX_TEST_IMAGE=ubuntu uv run --group ubuntu pytest -m integration
|
|
140
|
+
RUN_QUICKSAND_TESTS=1 RUN_SANDBOX_TOOL_IMAGE_TESTS=1 uv run pytest tests/test_proxy_integration.py
|
|
141
|
+
EXTERNAL_SANDBOX_CLIENT=/absolute/path/to/external-sandbox/claude-code/external_sandbox_exec.py \
|
|
142
|
+
RUN_QUICKSAND_TESTS=1 uv run pytest tests/test_legacy_client.py tests/test_real_clients.py
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The tool-image tests prepare an Alpine image with Node, npm and uv and check they reach a synthetic HTTPS service only through the proxy. The mux bridge tests also compile `guest-mux` for the host when Go is installed. To rebuild the bundled helpers, run `guest-mux/build.sh`; Go 1.27.2 reproduces the committed binaries exactly.
|
|
146
|
+
|
|
147
|
+
See [verification](https://github.com/prime-radiant-inc/external-sandbox-quicksand/blob/main/docs/verification.md) for recorded results, including the shared conformance suite.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Provenance
|
|
2
|
+
|
|
3
|
+
This project began on 9 October 2026 with `uv init --app --package remote-sandbox-quicksand`. `--package` adds the build system needed for the `remote-sandbox-quicksand` command. The repository was initialized separately with `git init`, because the parent directory is inside another Git working tree.
|
|
4
|
+
|
|
5
|
+
## Shared server code
|
|
6
|
+
|
|
7
|
+
The HTTP, streaming WebSocket and Codex adapters, browser routes, guest agent, guest filesystem operations, and host proxy engine were copied from [remote-sandbox-container](https://github.com/prime-radiant-inc/remote-sandbox-container) at commit `b26d3f5c6a610fcdd61e03b7911228225b8b1c74`, with the module renamed to `remote_sandbox_quicksand`. That commit passed the shared conformance suite in all profiles. Changes from the copied code:
|
|
8
|
+
|
|
9
|
+
- `backend.py` replaces the Apple Container lifecycle with a Quicksand VM. The guest agent transport is a dedicated virtio-serial port instead of a container's stdin/stdout.
|
|
10
|
+
- `guest_agent.py` opens that port, restores default SIGINT/SIGQUIT handling for commands, and supervises the guest-mux helper instead of relaying proxy streams over its own channel.
|
|
11
|
+
- The container's `proxy_relay.py` and `guest_proxy.py` are replaced by `proxy_bridge.py` and the guest-mux helper.
|
|
12
|
+
- `proxy.py` closes active connections before waiting for its listener to close.
|
|
13
|
+
- Branding and error messages name the VM instead of a container.
|
|
14
|
+
- `images.py` is new: Alpine image preparation and caching.
|
|
15
|
+
|
|
16
|
+
The container's protocol, proxy, UI-adapter and client tests were copied with the same renames. The backend, CLI and integration tests were adapted for Quicksand.
|
|
17
|
+
|
|
18
|
+
## Guest proxy multiplexer
|
|
19
|
+
|
|
20
|
+
`guest-mux/guest_mux.go` and the bridge design come from the Quicksand parent-process egress proxy prototype (`quicksand-proxy-prototype`, archive manifest dated 8 October 2026). The Go source is unchanged. `proxy_bridge.py` adapts the prototype's `guest_relay.py`, keeping its wire format and limits. It adds a fixed target, a readiness wait, and refusal of replacement transports. The prototype's mitmproxy-based egress proxy was not used; this server keeps the shared proxy engine and policy format.
|
|
21
|
+
|
|
22
|
+
The bundled binaries are the prototype's prebuilt files. Rebuilding the unchanged source with `guest-mux/build.sh` (Go 1.27.2, `-trimpath -ldflags '-s -w'`, `CGO_ENABLED=0`) reproduces them byte for byte:
|
|
23
|
+
|
|
24
|
+
| File | SHA-256 |
|
|
25
|
+
| --- | --- |
|
|
26
|
+
| `guest-mux/guest_mux.go` | `a4ea4490df7278c74dac5fb825b7cc8cbc8e1567400b5ae333ec854a75ca11f6` |
|
|
27
|
+
| `guest_bin/guest-mux-linux-arm64` | `cf60291a818a2ca9dd6cccf7c70e8c8997ca633525d9f585b846577a5e9c1551` |
|
|
28
|
+
| `guest_bin/guest-mux-linux-amd64` | `0371898cb7a4c589850f21a6c4bb7b1599eea4c5be4708e4b72eb04c4df797fe` |
|
|
29
|
+
|
|
30
|
+
## Browser UI
|
|
31
|
+
|
|
32
|
+
`src/remote_sandbox_quicksand/ui/` is [remote-sandbox-ui](https://github.com/prime-radiant-inc/remote-sandbox-ui) 0.2.0 at `fdbe4530c6ec72636f949bc4e1b2e0e2e3cc3392`, imported with that repository's `scripts/sync.py`. `manifest.json` records the file hashes.
|
|
33
|
+
|
|
34
|
+
## Quicksand
|
|
35
|
+
|
|
36
|
+
[Quicksand](https://microsoft.github.io/quicksand/) is used unmodified as a dependency: `quick-sandbox` 0.12.0, `quicksand-core` 0.13.0, `quicksand-qemu` 0.5.12 and `quicksand-alpine` 0.10.0 from PyPI. The optional `quicksand-ubuntu` 0.10.0 comes from Microsoft's index at `https://microsoft.github.io/quicksand/simple/`, because its PyPI release is an image-less stub. This project relies on some Quicksand internals, so those versions are pinned exactly:
|
|
37
|
+
|
|
38
|
+
- the virtio-serial bus created for Quicksand's own agent
|
|
39
|
+
- the 9p mount arguments
|
|
40
|
+
- `extra_qemu_args` ordering
|
|
41
|
+
- the private `_cleanup()` used after a partial start
|
|
42
|
+
|
|
43
|
+
Prepared Alpine images are built locally from Quicksand's Alpine 3.23 image and packages from `https://dl-cdn.alpinelinux.org`. No VM image is committed to this repository.
|
|
44
|
+
|
|
45
|
+
## Rename to External Sandbox — 30 October 2026
|
|
46
|
+
|
|
47
|
+
The project, its GitHub repository, distribution, command and Python module are now `external-sandbox-quicksand` / `external_sandbox_quicksand`, matching the rename of the shared protocol project from Remote Sandbox to External Sandbox. Environment variables use the `EXTERNAL_SANDBOX_` prefix, the prepared-image cache moved to `~/.cache/external-sandbox-quicksand`, guest paths and the agent's virtio-serial port name follow the new name, and the shared UI bundle is `external-sandbox-ui` 0.3.0. Wire protocol, default ports and behaviour are unchanged. The names, paths and commits recorded above describe earlier states and are preserved as written.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# external-sandbox-quicksand
|
|
2
|
+
|
|
3
|
+
A Python execution server for coding agents that runs commands inside a [Quicksand](https://microsoft.github.io/quicksand/) QEMU virtual machine. It implements the shared [External Sandbox protocol](https://github.com/prime-radiant-inc/external-sandbox/blob/main/PROTOCOL.md), alongside [external-sandbox-v86](https://github.com/prime-radiant-inc/external-sandbox-v86) and [external-sandbox-container](https://github.com/prime-radiant-inc/external-sandbox-container): the same buffered and streaming shell APIs, Codex endpoint, browser terminal, host mounts, and allow-listed HTTP(S) proxy, with a full virtual machine as the sandbox.
|
|
4
|
+
|
|
5
|
+
## Start
|
|
6
|
+
|
|
7
|
+
Requirements: [`uv`](https://docs.astral.sh/uv/) and a host supported by Quicksand. This release is tested on Apple silicon macOS with HVF acceleration; Quicksand publishes no QEMU wheel for Intel Macs. QEMU and the Alpine image arrive as Python wheels; no Homebrew, Docker or separate VM tooling is needed.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
uvx external-sandbox-quicksand --preserve-paths \
|
|
11
|
+
--mount-rw project=/absolute/path/to/project \
|
|
12
|
+
--mount-ro reference=/absolute/path/to/reference
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`uvx` downloads and runs the latest release from PyPI, including about 100 MB of QEMU and Alpine image wheels on first use. To install the command permanently, use `uv tool install external-sandbox-quicksand`. From a source checkout, use `uv run external-sandbox-quicksand` instead.
|
|
16
|
+
|
|
17
|
+
The server listens on `127.0.0.1:8688`, so it can run beside the v86 (`8686`) and container (`8687`) servers. Mounts appear at `/mnt/project` and `/mnt/reference`; `--preserve-paths` also binds them at their original absolute host paths for clients that send host paths. The first mount is the default working directory; without mounts it is `/workspace`. Stop the server with Ctrl-C to shut down and discard the VM. Files in writable mounts persist on the host; all other guest changes are disposable.
|
|
18
|
+
|
|
19
|
+
The VM gets two CPUs and 1 GiB of memory by default (`--cpus`, `--memory`). `--accel tcg` forces software emulation when hardware acceleration is unavailable. Run `uvx external-sandbox-quicksand --help` for every option.
|
|
20
|
+
|
|
21
|
+
## Guest images
|
|
22
|
+
|
|
23
|
+
**Alpine (default).** Quicksand's Alpine 3.23 image lacks Bash and Python, which the protocol and agent need. On first use, the server boots that image once, installs `bash`, `python3`, `git` and `ripgrep` from `https://dl-cdn.alpinelinux.org` through its own allow-listed proxy (only GET/HEAD to that origin), and saves the result as a Quicksand save under `~/.cache/external-sandbox-quicksand/images/`. On an Apple silicon Mac this took about seven seconds and produced a 65 MB save; later starts boot it directly and serve requests in about a second.
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
uvx external-sandbox-quicksand --prepare-image # prepare now, then exit
|
|
27
|
+
uvx external-sandbox-quicksand --packages git,ripgrep,nodejs,npm,uv,jq
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`--packages` replaces the optional package list (`bash` and `python3` are always included) and prepares a separately cached image. The cache key covers the Quicksand Alpine build, architecture and package list, so a Quicksand upgrade prepares a fresh image. Each prepared image records its installed package versions in `external-sandbox-image.json`. Alpine package versions come from the 3.23 branch at preparation time. Set `--cache-dir` or `XDG_CACHE_HOME` to move the cache.
|
|
31
|
+
|
|
32
|
+
**Ubuntu 24.04 (source checkout only).** Quicksand's Ubuntu image already includes Bash and Python 3.12. Its image wheel (about 300 MB) comes from Microsoft's Quicksand package index rather than PyPI, so it is not part of the published package. From a source checkout, the `ubuntu` dependency group installs it:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
uv run --group ubuntu external-sandbox-quicksand --image ubuntu
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`--image` also accepts a Quicksand save directory, provided it has `/bin/bash` and `python3`.
|
|
39
|
+
|
|
40
|
+
## How it works
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
host: external-sandbox-quicksand (aiohttp) guest: Quicksand VM
|
|
44
|
+
/exec, /exec/ws, /codex ── virtio-serial port ───────────▶ guest_agent.py (python3)
|
|
45
|
+
9p fsdev (readonly=on for ro mounts) ─────────────────────▶ /mnt/<name>
|
|
46
|
+
host proxy ◀── bridge ◀── QEMU guestfwd stream ◀── guest-mux ◀── 127.0.0.1:3128 ◀── HTTP(S)_PROXY
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Quicksand boots the VM and its own guest agent installs this server's agent from the Python package. The private agent speaks length-prefixed JSON over a dedicated virtio-serial port, separate from Quicksand's agent channel and unreachable through guest networking. It runs each command as `/bin/bash -c` in its own process group, streams binary output, and performs Codex filesystem operations inside the guest. These modules, the HTTP/WebSocket/Codex adapters, and the proxy engine are shared with `external-sandbox-container`; see [PROVENANCE.md](https://github.com/prime-radiant-inc/external-sandbox-quicksand/blob/main/PROVENANCE.md).
|
|
50
|
+
|
|
51
|
+
Host directories use QEMU virtio-9p mounts. Read-only mounts set QEMU's `readonly=on`, so the host rejects writes regardless of guest privileges. The VM starts with Quicksand's `NetworkMode.NONE`, which removes its default NIC, host agent port forward and SMB relay.
|
|
52
|
+
|
|
53
|
+
## Browser terminal
|
|
54
|
+
|
|
55
|
+
Open `http://127.0.0.1:8688/` to run commands through the streaming WebSocket API, with stdin, EOF, cancel, history and **Copy session**. Each run starts a new Bash process; files persist for the VM's lifetime. The terminal uses pipes, not a PTY. The HTML, CSS and JavaScript are a pinned bundle of [`external-sandbox-ui`](https://github.com/prime-radiant-inc/external-sandbox-ui) 0.3.0; update it with that repository's `scripts/sync.py`, as described in its README.
|
|
56
|
+
|
|
57
|
+
## Controlled network access
|
|
58
|
+
|
|
59
|
+
Without `--proxy-config` the VM has no network interface. With a policy file, it gets exactly one: a QEMU user-mode NIC with `restrict=on` and a single `guestfwd` rule, `10.0.2.101:3128`, connected to a host stream. Save this starter policy as `proxy.json`; it allows only GET and HEAD requests to `https://example.com`:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"allow": [
|
|
64
|
+
{"origin": "https://example.com", "methods": ["GET", "HEAD"]}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
uvx external-sandbox-quicksand --proxy-config proxy.json
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
QEMU's `guestfwd` TCP backend is one persistent byte stream, so a small static Go helper ([`guest-mux`](https://github.com/prime-radiant-inc/external-sandbox-quicksand/blob/main/guest-mux/guest_mux.go), from the Quicksand proxy prototype) listens on guest `127.0.0.1:3128` and multiplexes each connection over that stream. The host [bridge](https://github.com/prime-radiant-inc/external-sandbox-quicksand/blob/main/src/external_sandbox_quicksand/proxy_bridge.py) opens one connection per channel to the embedded host proxy and nowhere else. Commands receive standard proxy variables, `NODE_USE_ENV_PROXY=1`, and a CA bundle containing the proxy's public certificate.
|
|
74
|
+
|
|
75
|
+
The proxy, policy format, management page and API are the same as the container server's and follow the protocol's proxy profile: exact-origin allow rules with optional methods, paths and CIDRs; public addresses only by default; credential placeholders replaced on the host; secret redaction; and live policy edits at `http://127.0.0.1:8688/proxy` that close existing connections. [examples/proxy.json](https://github.com/prime-radiant-inc/external-sandbox-quicksand/blob/main/examples/proxy.json) demonstrates credential substitution and needs `OPENAI_API_KEY` in the server's environment. Literal redaction cannot prevent an allowed upstream from transforming and echoing a credential, so use credential rules only with trusted services and narrow their methods and paths. Removing proxy variables cannot open another route: QEMU drops everything except the guestfwd stream. If the guestfwd stream fails, proxy access fails closed until restart; `/health` reports `proxyTransport`.
|
|
76
|
+
|
|
77
|
+
## Agents
|
|
78
|
+
|
|
79
|
+
Agent integrations are maintained in [external-sandbox](https://github.com/prime-radiant-inc/external-sandbox):
|
|
80
|
+
|
|
81
|
+
- [Claude Code](https://github.com/prime-radiant-inc/external-sandbox/tree/main/claude-code): set `EXTERNAL_SANDBOX_API_URL=http://127.0.0.1:8688` and start this server with `--preserve-paths --mount-rw project=$PWD`.
|
|
82
|
+
- [Codex](https://github.com/prime-radiant-inc/external-sandbox/tree/main/codex): use executor URL `ws://127.0.0.1:8688/codex`.
|
|
83
|
+
- [Pi](https://github.com/prime-radiant-inc/external-sandbox/tree/main/pi): use `--sandbox-url http://127.0.0.1:8688`. The default Alpine image includes the Python and ripgrep its tools need.
|
|
84
|
+
|
|
85
|
+
## Scope
|
|
86
|
+
|
|
87
|
+
- Commands and Codex filesystem operations run in the VM as guest root. The VM is the isolation boundary; guest root cannot change QEMU's mount modes or network restrictions.
|
|
88
|
+
- Mounts deliberately expose host directories. Read-write mounts change host files immediately; host changes are visible in the guest. Guest root can follow symlinks only within the guest view. A pre-existing host hardlink in a writable mount remains editable even if another name for the same file is in a read-only mount; avoid that alias if the file must stay unchanged. This backend does not reproduce v86's hardlink checks.
|
|
89
|
+
- The guest agent and proxy helper are not trusted by the host. The host bounds frame sizes and validates messages; a compromised guest can disrupt its own commands or proxy access. The host does not provision real credentials to the VM, but an allowed upstream can transform and echo one in its response.
|
|
90
|
+
- Quicksand's own guest agent remains in the VM and is used only by the host for setup.
|
|
91
|
+
- Agent processes, model traffic and host-side tools remain on the host; routing shell commands into the VM does not constrain those tools.
|
|
92
|
+
- The execution listener is for trusted local clients, with the same browser token, Origin, Fetch Metadata and Host checks as the other servers. It is not authentication between mutually untrusted host users or a remote multi-user service.
|
|
93
|
+
|
|
94
|
+
## Test
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
uv run pytest -m 'not integration'
|
|
98
|
+
node --test tests/test_terminal_js.mjs
|
|
99
|
+
uv run ruff check .
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Tests marked `integration` boot real VMs and are opt-in:
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
RUN_QUICKSAND_TESTS=1 uv run pytest -m integration
|
|
106
|
+
RUN_QUICKSAND_TESTS=1 SANDBOX_TEST_IMAGE=ubuntu uv run --group ubuntu pytest -m integration
|
|
107
|
+
RUN_QUICKSAND_TESTS=1 RUN_SANDBOX_TOOL_IMAGE_TESTS=1 uv run pytest tests/test_proxy_integration.py
|
|
108
|
+
EXTERNAL_SANDBOX_CLIENT=/absolute/path/to/external-sandbox/claude-code/external_sandbox_exec.py \
|
|
109
|
+
RUN_QUICKSAND_TESTS=1 uv run pytest tests/test_legacy_client.py tests/test_real_clients.py
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The tool-image tests prepare an Alpine image with Node, npm and uv and check they reach a synthetic HTTPS service only through the proxy. The mux bridge tests also compile `guest-mux` for the host when Go is installed. To rebuild the bundled helpers, run `guest-mux/build.sh`; Go 1.27.2 reproduces the committed binaries exactly.
|
|
113
|
+
|
|
114
|
+
See [verification](https://github.com/prime-radiant-inc/external-sandbox-quicksand/blob/main/docs/verification.md) for recorded results, including the shared conformance suite.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Verification
|
|
2
|
+
|
|
3
|
+
Recorded on 9 October 2026 on an Apple M5 Max running macOS 26.4, with Python 3.14.3, Quicksand 0.12.0 (core 0.13.0, QEMU 0.5.12) and HVF acceleration. Every result below used server code from commit `a93aa17`; later commits changed only tests and documentation. All runs used real Quicksand VMs. No fake execution backend or paid model call was involved.
|
|
4
|
+
|
|
5
|
+
## Shared conformance suite
|
|
6
|
+
|
|
7
|
+
The [external-sandbox](https://github.com/prime-radiant-inc/external-sandbox) runner at `98fa5d7` ran against dedicated servers. Each server had writable `/mnt/spec-rw` and read-only `/mnt/spec-ro` mounts, a deny-all initial proxy policy (`{"allow": []}`), and the generated localhost TLS fixture. All five profiles were selected:
|
|
8
|
+
|
|
9
|
+
| Image | Profiles | Result | `conforms` |
|
|
10
|
+
| --- | --- | --- | --- |
|
|
11
|
+
| Prepared Alpine 3.23 (bash, git, python3, ripgrep) | core, browser, mounts, proxy, proxy-tls | **116 passed** | true |
|
|
12
|
+
| Ubuntu 24.04 (`--image ubuntu`) | core, browser, mounts, proxy, proxy-tls | **116 passed** | true |
|
|
13
|
+
|
|
14
|
+
To reproduce, generate the fixture with `uv run --project ../external-sandbox external-sandbox-proxy-fixture work/tls`, then start a dedicated server from a shell that has sourced `work/tls/server-env.sh`:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
uv run external-sandbox-quicksand --port 18788 --proxy-config work/deny-all.json \
|
|
18
|
+
--mount-rw spec-rw=$PWD/work/spec-rw --mount-ro spec-ro=$PWD/work/spec-ro
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Then run the suite from the `external-sandbox` checkout:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
uv run external-sandbox-conformance --url http://127.0.0.1:18788 \
|
|
25
|
+
--profile browser --profile mounts --profile proxy-tls \
|
|
26
|
+
--rw-dir /mnt/spec-rw --ro-dir /mnt/spec-ro \
|
|
27
|
+
--proxy-tls-cert ../external-sandbox-quicksand/work/tls/cert.pem \
|
|
28
|
+
--proxy-tls-key ../external-sandbox-quicksand/work/tls/key.pem -q
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Add `--image ubuntu` and run the server with `uv run --group ubuntu` for the Ubuntu result.
|
|
32
|
+
|
|
33
|
+
## Project tests
|
|
34
|
+
|
|
35
|
+
| Suite | Result |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| Unit and protocol tests (`-m 'not integration'`) | 232 passed; 5 shared-client checks skipped without `EXTERNAL_SANDBOX_CLIENT` |
|
|
38
|
+
| Shared streaming client with `EXTERNAL_SANDBOX_CLIENT` set to `external-sandbox/claude-code/external_sandbox_exec.py` | 5 passed |
|
|
39
|
+
| Mux bridge with the real `guest-mux` helper built for the host | included above; 8 concurrent ~200 KB round trips |
|
|
40
|
+
| Bundled UI JavaScript tests, local assets and the live server's pages | 26 passed, 1 mode-specific skip, in each mode |
|
|
41
|
+
| Real-VM integration, Alpine | 18 passed, 4 tool-image tests skipped |
|
|
42
|
+
| Real-VM integration, Ubuntu | 18 passed, 4 tool-image tests skipped |
|
|
43
|
+
| Proxy integration with the Alpine tool image (Node 24, npm, uv, jq) | 9 passed |
|
|
44
|
+
| Real Codex CLI 0.164.0 against a running server (exec, native `apply_patch` on rw and ro mounts) | 2 passed |
|
|
45
|
+
|
|
46
|
+
The Codex CLI was installed separately at the pinned version 0.164.0. The test uses deterministic loopback model responses.
|
|
47
|
+
|
|
48
|
+
## Agent clients
|
|
49
|
+
|
|
50
|
+
- **Claude Code shell prefix:** the shared streaming client passed the tests above against both a test server and a real VM.
|
|
51
|
+
- **Pi:** the shared extension's integration tests (`external-sandbox/pi` at `71c61d4`, Pi 0.85.1) passed 12 of 12 against the prepared Alpine image, whose guest runs Python 3.12. The server had the example public-site proxy policy and a writable project mount.
|
|
52
|
+
|
|
53
|
+
## Measurements
|
|
54
|
+
|
|
55
|
+
- Preparing the default Alpine image from scratch took about 7 seconds and produced a 65 MB Quicksand save.
|
|
56
|
+
- Starting the server with that cached image, until `/health` answered, took about 1 second.
|
|
57
|
+
- A trivial `POST /exec` round trip took about 11 ms.
|
|
58
|
+
|
|
59
|
+
These are single observations on one machine, not benchmarks.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"allow": [
|
|
3
|
+
{
|
|
4
|
+
"origin": "https://api.openai.com",
|
|
5
|
+
"methods": ["POST"],
|
|
6
|
+
"paths": ["/v1/responses"],
|
|
7
|
+
"credential": {
|
|
8
|
+
"header": "Authorization",
|
|
9
|
+
"placeholder": "Bearer sandbox-demo-placeholder",
|
|
10
|
+
"secretEnv": "OPENAI_API_KEY",
|
|
11
|
+
"prefix": "Bearer "
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"origin": "https://example.com",
|
|
16
|
+
"methods": ["GET", "HEAD"]
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"guestEnv": {
|
|
20
|
+
"OPENAI_API_KEY": "sandbox-demo-placeholder"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Rebuild the bundled guest transport helpers from guest_mux.go.
|
|
3
|
+
# The pinned toolchain reproduces the committed binaries byte for byte.
|
|
4
|
+
set -eu
|
|
5
|
+
here=$(cd "$(dirname "$0")" && pwd)
|
|
6
|
+
out="$here/../src/external_sandbox_quicksand/guest_bin"
|
|
7
|
+
mkdir -p "$out"
|
|
8
|
+
for arch in arm64 amd64; do
|
|
9
|
+
GOTOOLCHAIN=go1.27.2 CGO_ENABLED=0 GOOS=linux GOARCH=$arch \
|
|
10
|
+
go build -trimpath -ldflags '-s -w' -o "$out/guest-mux-linux-$arch" "$here/guest_mux.go"
|
|
11
|
+
done
|
|
12
|
+
shasum -a 256 "$out"/guest-mux-linux-*
|