Commit cda573b
committed
feat(credentials): guest-side helper + integration tests (Phase 1)
Adds the missing guest-facing surface for the scoped-credentials feature
defined in hyperlight:sandbox/credentials (Phase 1 host plumbing landed in
the earlier WIT/RootImports/CredentialRegistry commits).
Guest helper additions (src/wasm_sandbox/guests/python):
- sandbox_executor.py: credential= kwarg on http_get / http_post / the
shared _http_request helper, plus standalone attach_credential(req, id)
for callers building wasi-http requests by hand.
- hyperlight.py: re-export attach_credential so guest scripts can rom
hyperlight import attach_credential.
Tests (src/wasm_sandbox/tests/credential_integration.rs, 8 cases):
- credential_header_injected_on_get / _on_post -> happy path
- no_credential_means_no_auth_header -> default unchanged
- duplicate_credential_registration_rejected -> registry rejects re-use
- unknown_credential_raises_error -> unknown id surfaces error
- guest_cannot_override_credential_header -> host injection wins
- scope_mismatch_denied -> scope enforcement
- double_attach_rejected -> single-attach invariant
All 8 pass via just wasm test and direct cargo test.
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>1 parent c36cfae commit cda573b
3 files changed
Lines changed: 505 additions & 9 deletions
File tree
- src/wasm_sandbox
- guests/python
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | | - | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
30 | | - | |
31 | | - | |
| 30 | + | |
| 31 | + | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
33 | 38 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
38 | 43 | | |
39 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
40 | 54 | | |
41 | 55 | | |
42 | 56 | | |
| |||
81 | 95 | | |
82 | 96 | | |
83 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
84 | 108 | | |
85 | 109 | | |
86 | 110 | | |
| |||
138 | 162 | | |
139 | 163 | | |
140 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
141 | 182 | | |
142 | 183 | | |
143 | 184 | | |
| |||
152 | 193 | | |
153 | 194 | | |
154 | 195 | | |
155 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
156 | 203 | | |
157 | 204 | | |
158 | 205 | | |
| |||
0 commit comments