Repository navigation
Commit f8a7987
Add secrets management and secret delivery to sandboxes (#139)
* Add secrets management and secret delivery to sandboxes
Adds client.secrets (sync and async) for the API-key routes: public key,
list, create, get, update, add_version, delete and delete_version. Values
are encrypted client-side as a compact JWE (RSA-OAEP-256 + A256GCM) bound
to the secret's encryption context, after checking the key's policy and
RFC 7638 key ID. Secrets resolve by ID or exact name.
Sandbox image launches accept `secrets` for the startup command, and
exec/processes.start accept `secrets`, starting through the control API
and waiting through the runtime. Sandboxes and snapshots expose
contains_secrets. Control API errors honour the server's `retryable` flag
and a machine code sent as `error`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NhbFMc29f5JN5JxCciajJV
* Fix secret process deadlines and ambiguous outcome handling
* Reconcile secrets with the hx CLI and current server
- Treat only 8-4-4-4-12 keys as secret IDs, so UUID-like names fall back
to the name search instead of failing on the server's 400.
- A sandbox create with secrets whose outcome is unknown raises a
non-retryable secret_process_outcome_unknown: a sandbox may be running
its startup command with the secrets.
- Normalize the server's SECRET_PROCESS_OUTCOME_UNKNOWN to the documented
code, keeping the server body in details.
- Add the sandbox and secret context to control error messages, as the
CLI does.
- Without a server retryable flag, SECRETS_NOT_CONFIGURED and other codes
retrying can't fix are not retryable.
- Reject use_shell with secrets, accept processId in start responses, and
check secret names, env names, versions and list bounds locally.
- Document SECRETS_ADMIN_REQUIRED, SECRETS_FEATURE_DISABLED,
SECRETS_NOT_CONFIGURED and SECRET_STARTUP_UNSUPPORTED.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Drop the sync client's socket-level wait deadlines
Interrupting an in-flight HTTPX request needed a timer thread that shut
down sockets through trace hooks, with special cases for shared HTTP/2
connections, TLS stream swaps and trickled responses, plus deadline-aware
copies of the token refresh and control request paths.
The sync secret process wait now checks its limit between requests and
caps each request's HTTP timeouts at the time left, like the async
client's transport. A trickled response or a token refresh can overrun
the limit; the README points to the async client for a strict one. The
control request path is back to master's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Harden secret validation and ambiguous sandbox outcomes
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: nikhil <nshahi1998@gmail.com>1 parent 4427393 commit f8a7987
28 files changed
Lines changed: 3978 additions & 61 deletions
File tree
- hyperbrowser
- client
- managers
- async_manager
- sandboxes
- sandboxes
- sync_manager
- sandboxes
- models
- transport
- types
- tests
- typecheck
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 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 | + | |
264 | 362 | | |
265 | 363 | | |
266 | 364 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
| |||
72 | 79 | | |
73 | 80 | | |
74 | 81 | | |
| 82 | + | |
75 | 83 | | |
76 | 84 | | |
77 | 85 | | |
| |||
143 | 151 | | |
144 | 152 | | |
145 | 153 | | |
146 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
147 | 159 | | |
148 | 160 | | |
149 | 161 | | |
| |||
318 | 330 | | |
319 | 331 | | |
320 | 332 | | |
| 333 | + | |
321 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
322 | 343 | | |
323 | 344 | | |
324 | 345 | | |
| |||
327 | 348 | | |
328 | 349 | | |
329 | 350 | | |
| 351 | + | |
330 | 352 | | |
331 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
332 | 357 | | |
333 | 358 | | |
334 | 359 | | |
| |||
1127 | 1152 | | |
1128 | 1153 | | |
1129 | 1154 | | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
1130 | 1175 | | |
1131 | 1176 | | |
1132 | 1177 | | |
1133 | 1178 | | |
1134 | | - | |
1135 | | - | |
1136 | | - | |
1137 | | - | |
1138 | | - | |
1139 | | - | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
1140 | 1193 | | |
1141 | 1194 | | |
1142 | 1195 | | |
| |||
0 commit comments