Repository navigation
Commit 709d98b
authored
Add vault item fill parameters and safe operation outcomes (#251)
## Summary
- Extend `vaults items invoke <vault> <key> <operation>` with `--params`
for fill. Validate exact property names, duplicate keys, required
browser/page inputs, field bindings, expiration formats, billing fields,
and timeout bounds without echoing inputs. The positional operation
supplies `type`; parameters cannot override it.
- Keep authorize parameterless and preserve `authorize --open`. Re-fetch
advertised availability, retain recovery-required guards and project
scoping, and disable retries for both requests.
- Render fill's value-free result separately from item responses.
Completed exits 0; failed/unknown exit 1 after printing the result,
including intact JSON on stdout. Reuse the root command's silent-error
convention. Sanitize request/response failures and warn that browser
writes may have occurred.
- Update help, operation hints, and README examples. No checkout
submission, alias fallback, or extra prompts.
## SDK approach
Upgrade the Go SDK from v0.101.0 to released v0.102.0. Both authorize
and fill use typed `PerformOperation` requests and its
operation-response union, with `WithMaxRetries(0)`. Fill bindings use
the SDK's stored-field/expiration union constructors. No generic
`Client.Post` compatibility path remains. Keep strict CLI input
validation and display-safe response projections so unknown response
properties cannot expose values or selectors; authorize item responses
retain the existing output/open behavior.
Requires an API that advertises fill; older APIs remain gated by
`available_operations`. Browser session IDs are sent unchanged, never
resolved as names. No SDK or API release/merge is part of this change.
## Validation
- `make test` — passes (`go vet ./...` and full `go test ./...`).
- `go test -race ./cmd -run 'TestVault' -count=1` — passes.
- `make build` — passes.
- Command-level and real CLI subprocess tests cover
malformed/incompatible params, operation type protection, 1/32-field
boundaries, all stored bindings and expiration formats, authorization
compatibility, availability/recovery guards, scoped authenticated
serialization, output redaction, response union validation, exit codes,
HTTP errors, dropped/truncated connections, and no retries.
- The automated HTTP tests use synthetic fixtures and local mock
servers. Separate production verification is recorded below.
- Full diff reviewed for scope, secret-safe output, dependency changes,
and generated-file changes. Only the Go SDK dependency and its checksums
changed; no unrelated dependencies or generated files changed.
## Production verification
Tested commit `b157880` with SDK v0.102.0 against the production API
using a new disposable vault, an explicitly connected Link wallet, and a
user-approved card with a $1 spending limit. This was a fill-only test,
not a purchase.
The headless browser used controlled HTML fulfilled by Playwright, with
a cross-origin iframe, password inputs, restrictive CSP, no third-party
page scripts, and no form or submit controls. No merchant checkout was
submitted. Assertions returned booleans only; card and billing values
were not returned, logged, or screenshotted.
| Scenario | Observed result |
| --- | --- |
| Vault/wallet creation, connection, card creation and authorization |
Card reached ready and advertised fill |
| Fill unavailable on the pending wallet | Exit 1, empty stdout |
| Number, expiration MM/YY, and CVC inside cross-origin iframe |
Completed; exit 0; exactly three filled outcomes in JSON; boolean
format/population checks passed |
| exp_month, exp_year, expiration MM/YYYY, billing_name, billing_line1,
billing_city, billing_state, billing_postal_code, billing_country |
Completed; exit 0; nine value-free rows in normal output; format
consistency and population checks passed |
| Target removed by an input event after the first write | Failed; exit
1; intact JSON containing filled, failed/target_changed, not_attempted;
empty stderr |
| Partial-failure browser assertions | First write retained, second
target absent, third field untouched; no retry or fallback performed |
| Item events | Exactly two completed fill events and one failed fill
event |
| Cleanup | Disposable browser, vault, wallet, and card deleted |
Limitations: this verifies production orchestration and browser writes
on a controlled page, not merchant acceptance or payment settlement.
Unknown outcomes/transport failures remain covered by mocked tests
rather than deliberately induced against a live approved credential.
Optional billing_line2 was not requested in production.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **High Risk**
> Touches payment credential orchestration and browser field writes with
partial-failure semantics; mistakes could leave checkout partially
filled or mishandle sensitive flows despite redaction guards.
>
> **Overview**
> Adds **`fill`** to `kernel vaults items invoke` so ready Link cards
can write vaulted checkout fields into an attached browser via
**`--params`** JSON (`browser_id`, exact `page_url`, CSS field bindings,
optional `timeout_ms`). **`authorize`** stays parameterless with
**`--open`** only; the positional operation sets `type` and cannot be
overridden in params.
>
> **Invoke** now routes through SDK **v0.102.0** typed
`PerformOperation` unions: authorize returns a filtered item; fill
returns a **value-free** per-field result with exit **0** on `completed`
and nonzero on `failed`/`unknown` while still printing JSON on stdout.
Strict client-side param validation, display-safe result filtering,
sanitized transport/API errors, and no retries or alias fallback.
README, cobra help, and `items get` hints document the flow; broad tests
cover validation, redaction, authorize compatibility, and CLI subprocess
outcomes.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
b157880. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 10ebf4a commit 709d98b
10 files changed
Lines changed: 794 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
294 | | - | |
| 294 | + | |
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
432 | | - | |
433 | | - | |
| 432 | + | |
| 433 | + | |
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
| |||
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
480 | 481 | | |
481 | 482 | | |
482 | 483 | | |
483 | 484 | | |
484 | | - | |
485 | | - | |
| 485 | + | |
486 | 486 | | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
491 | 537 | | |
492 | 538 | | |
493 | 539 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
201 | 203 | | |
202 | 204 | | |
203 | 205 | | |
204 | | - | |
| 206 | + | |
205 | 207 | | |
206 | 208 | | |
207 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
208 | 213 | | |
209 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
210 | 218 | | |
211 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
212 | 223 | | |
213 | 224 | | |
214 | | - | |
| 225 | + | |
215 | 226 | | |
216 | 227 | | |
217 | 228 | | |
| |||
220 | 231 | | |
221 | 232 | | |
222 | 233 | | |
223 | | - | |
| 234 | + | |
224 | 235 | | |
225 | 236 | | |
226 | 237 | | |
| |||
229 | 240 | | |
230 | 241 | | |
231 | 242 | | |
232 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
233 | 249 | | |
234 | 250 | | |
235 | 251 | | |
236 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
237 | 260 | | |
238 | 261 | | |
239 | 262 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
135 | | - | |
136 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
137 | 157 | | |
138 | 158 | | |
139 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
140 | 165 | | |
141 | | - | |
| 166 | + | |
| 167 | + | |
142 | 168 | | |
143 | 169 | | |
144 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 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 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
0 commit comments