Repository navigation
Commit e7c662c
committed
feat(server)!: per-sandbox JWT identity over Bearer (wire break)
Switches every sandbox-to-gateway gRPC call from "path-based mTLS-only
trust" to "Authorization: Bearer <gateway-minted-JWT>" presented by the
sandbox supervisor. Closes the trust-boundary half of issue #1354; the
per-handler sandbox_id equality check follows in PR 4.
Sandbox side:
- crates/openshell-sandbox/src/grpc_client.rs gains an AuthInterceptor
that injects the Bearer header on every outbound RPC. The token is
resolved at startup from one of three sources, in order:
1. OPENSHELL_SANDBOX_TOKEN (env, test harnesses)
2. OPENSHELL_SANDBOX_TOKEN_FILE (Docker/Podman/VM drivers)
3. OPENSHELL_K8S_SA_TOKEN_FILE (K8s driver — projected SA token
exchanged for a gateway JWT via IssueSandboxToken)
Gateway side:
- handle_create_sandbox mints a gateway JWT and passes it through the
compute layer to DriverSandboxSpec.sandbox_token. K8s sandboxes ignore
the field; Docker and Podman drivers inject it as OPENSHELL_SANDBOX_TOKEN
in the container env.
- Removes the path-based SANDBOX_METHODS / DUAL_AUTH_METHODS branches and
the x-openshell-auth-source metadata marker. The AuthGrpcRouter chain
is now uniform: K8s SA -> SandboxJwt -> OIDC, all extension-based.
- Removes LegacySandboxMarkerAuthenticator and the SandboxIdentitySource::
LegacyMarker variant. Handlers read Principal::Sandbox directly from
request extensions.
Kubernetes driver:
- Sandbox pods gain a projected ServiceAccount token volume mounted at
/var/run/secrets/openshell/token (audience openshell-gateway, 1h TTL,
kubelet auto-rotates).
- Each pod is annotated with openshell.io/sandbox-id; the gateway resolves
the SA token claim's pod uid back to a sandbox id via this annotation.
- Helm Role grants the gateway pods:get in the sandbox namespace. No
ClusterRoleBinding to system:auth-delegator — the gateway validates SA
tokens against the apiserver's anonymous JWKS endpoint instead of via
TokenReview, so no cluster-scoped privilege is required.
The full JWKS verifier + pod-annotation lookup lands in the follow-up
that brings the K8s helm-dev demo end-to-end; PR 3 exercises the wire
break with Docker/Podman as the working drivers.
Signed-off-by: Taylor Mutch <[email protected]>1 parent 5465846 commit e7c662c
16 files changed
Lines changed: 384 additions & 415 deletions
File tree
- crates
- openshell-driver-docker/src
- openshell-driver-kubernetes/src
- openshell-driver-podman/src
- openshell-sandbox/src
- openshell-server/src
- auth
- compute
- grpc
- deploy/helm/openshell/templates
- proto
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
982 | 982 | | |
983 | 983 | | |
984 | 984 | | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
985 | 998 | | |
986 | 999 | | |
987 | 1000 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1147 | 1147 | | |
1148 | 1148 | | |
1149 | 1149 | | |
1150 | | - | |
1151 | | - | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
1152 | 1172 | | |
1153 | 1173 | | |
1154 | 1174 | | |
| |||
1235 | 1255 | | |
1236 | 1256 | | |
1237 | 1257 | | |
1238 | | - | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
1239 | 1262 | | |
1240 | | - | |
1241 | | - | |
1242 | | - | |
1243 | | - | |
1244 | | - | |
1245 | | - | |
1246 | | - | |
1247 | | - | |
1248 | | - | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
1249 | 1278 | | |
1250 | 1279 | | |
1251 | 1280 | | |
| |||
1257 | 1286 | | |
1258 | 1287 | | |
1259 | 1288 | | |
| 1289 | + | |
1260 | 1290 | | |
1261 | | - | |
1262 | | - | |
1263 | | - | |
1264 | | - | |
1265 | | - | |
1266 | | - | |
1267 | | - | |
1268 | | - | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
1269 | 1314 | | |
1270 | 1315 | | |
1271 | 1316 | | |
| |||
1444 | 1489 | | |
1445 | 1490 | | |
1446 | 1491 | | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
1447 | 1500 | | |
1448 | 1501 | | |
1449 | 1502 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
302 | 313 | | |
303 | 314 | | |
304 | 315 | | |
| |||
0 commit comments