Files
devvm/testdata/script/proxy.txtar
T
w3cjandClaude Opus 5.5 f4508dfb61 feat(proxy): the network policy proxy as devvm _proxy
The network policy proxy moves into the binary as internal/proxy
(standard library only), run by the hidden devvm _proxy with its own
flags. Main returns errors instead of exiting, writes only to the
streams devvm hands it (the event log and data on stdout, its log
lines on stderr), and returns when the VM's hostagent is gone. The
connect mode is gone: devvm _qemu connect does that. Logins copied
as they are are warned about through ui.

Its tests come along, with a short run, fuzz targets for policy rules,
request targets and ClientHellos, a testscript, and the network page
of the docs for the proxy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 10:12:26 -06:00

50 lines
1.6 KiB
Plaintext

# devvm _proxy: the network policy proxy, hidden. --help lists its flags.
exec devvm _proxy --help
stdout '-auth-file'
stdout '-listen'
! stderr .
exec devvm --help
! stdout _proxy
# The proxy refuses to run without the VM's password, or with an empty one.
env DEVVM_MESSAGES=names
! exec devvm _proxy -listen 127.0.0.1:0
stderr '^devvm: proxy_failed reason=-auth-file is required$'
! exec devvm _proxy --auth-file empty
stderr '^devvm: proxy_failed reason=empty is empty$'
! exec devvm _proxy -nope
stderr '^devvm: proxy_failed reason=flag provided but not defined: -nope$'
# -init-ca writes the CA and keeps it on the next run.
exec devvm _proxy -init-ca ca
exists ca/ca.pem ca/ca.key
grep 'BEGIN CERTIFICATE' ca/ca.pem
cp ca/ca.pem first.pem
exec devvm _proxy -init-ca ca
cmp ca/ca.pem first.pem
# -redact: secret-named values replaced, their paths on stderr.
stdin settings.json
exec devvm _proxy -redact json
stdout '"apiKey": "devvm-redacted"'
stdout '"baseURL": "https://x"'
! stdout dummy-key
stderr '^provider.options.apiKey$'
# -login -login-vm: the VM's copy holds placeholders, and what it copies as
# it is is warned about.
exec devvm _proxy -login codex -login-file auth.json -login-vm
stdout '"OPENAI_API_KEY": "sk-devvm-proxy-managed-codex"'
stdout '"extra": "x"'
! stdout sk-real
stderr '^devvm: codex_login_kept keys=extra$'
exec devvm _proxy -login codex -login-file auth.json -login-bindings -login-hosts
stdout '^api.openai.com:443$'
-- empty --
-- settings.json --
{"provider": {"options": {"apiKey": "dummy-key", "baseURL": "https://x"}}}
-- auth.json --
{"OPENAI_API_KEY": "sk-real", "extra": "x"}