Commit 2288078
committed
fix(security): phase 1 hardening — sudo allowlist, token expiry, gateway secret
Addresses three ship-blocking findings from the feat/autopilot security audit:
#1 [CRITICAL] Sandbox passwordless sudo narrowed to package managers only
- Replace `NOPASSWD: ALL` with a scoped Cmnd_Alias covering apt-get, apt,
dpkg, pip, uv, npm, bun. Validate via `visudo -c` at image build.
- Claude can still `sudo apt-get install` mid-session (95% case); arbitrary
privilege escalation inside the container is blocked.
- Operators must rebuild the sandbox image for the change to take effect.
#2 [CRITICAL] Deployment tokens now expire
- Workspace session token: 6h TTL (was: never).
- Autopilot run token: 2h TTL (was: never).
- Wildcard permissions retained for now — the memory/workspace handlers
gate on admin Permission, not deployment-token permissions, so real
scoping requires new permission variants. Tracked for Phase 2.
#3 [HIGH] Preview gateway shared secret is now required + auto-managed
- `temps serve` generates `\$TEMPS_DATA_DIR/preview_gateway.secret` on
first boot (32 random bytes, hex, 0600) and exports it as
`PREVIEW_GATEWAY_SHARED_SECRET` so the Pingora proxy injects it on
every forwarded preview request.
- `preview_gateway::spawn_reconcile` passes the secret into the
container env on create.
- `temps-preview-gateway` binary now refuses to start without the secret.
- Blocks cross-sandbox/cross-tenant direct hits to 127.0.0.1:8090 that
would otherwise bypass the preview-password wall.1 parent 7b2fc18 commit 2288078
File tree
8 files changed
+168
-18
lines changed- crates
- temps-agents
- src
- sandbox
- services
- temps-cli/src/commands/serve
- temps-preview-gateway/src
- temps-workspace/src/services
8 files changed
+168
-18
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
42 | 117 | | |
43 | 118 | | |
44 | 119 | | |
| |||
58 | 133 | | |
59 | 134 | | |
60 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
61 | 140 | | |
62 | 141 | | |
63 | 142 | | |
| |||
67 | 146 | | |
68 | 147 | | |
69 | 148 | | |
| 149 | + | |
70 | 150 | | |
71 | 151 | | |
72 | 152 | | |
| |||
91 | 171 | | |
92 | 172 | | |
93 | 173 | | |
| 174 | + | |
94 | 175 | | |
95 | 176 | | |
96 | 177 | | |
| |||
321 | 402 | | |
322 | 403 | | |
323 | 404 | | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
330 | 420 | | |
331 | 421 | | |
332 | 422 | | |
| |||
365 | 455 | | |
366 | 456 | | |
367 | 457 | | |
| 458 | + | |
368 | 459 | | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
369 | 477 | | |
370 | 478 | | |
371 | 479 | | |
| 480 | + | |
372 | 481 | | |
373 | 482 | | |
374 | 483 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
156 | 161 | | |
157 | 162 | | |
158 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
199 | 205 | | |
200 | 206 | | |
201 | 207 | | |
202 | 208 | | |
203 | 209 | | |
204 | | - | |
| 210 | + | |
205 | 211 | | |
206 | 212 | | |
207 | 213 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
239 | 248 | | |
240 | 249 | | |
241 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
104 | 108 | | |
105 | 109 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
114 | 120 | | |
115 | 121 | | |
116 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1516 | 1516 | | |
1517 | 1517 | | |
1518 | 1518 | | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
1519 | 1530 | | |
1520 | 1531 | | |
1521 | 1532 | | |
1522 | 1533 | | |
1523 | 1534 | | |
1524 | | - | |
| 1535 | + | |
1525 | 1536 | | |
1526 | 1537 | | |
1527 | 1538 | | |
| |||
0 commit comments