Skip to content

Add vault item fill parameters and safe operation outcomes - #251

Merged
hiroTamada merged 2 commits into
mainfrom
hypeship/vault-fill-params
Sep 14, 2026
Merged

Add vault item fill parameters and safe operation outcomes#251
hiroTamada merged 2 commits into
mainfrom
hypeship/vault-fill-params

Conversation

@hiroTamada

@hiroTamada hiroTamada commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

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.


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.

Reviewed by Cursor Bugbot for commit b157880. Bugbot is set up for automated code reviews on this repo. Configure here.

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedgolang/​github.com/​kernel/​kernel-go-sdk@​v0.101.0 ⏵ v0.102.073 +1100100100100

View full report

@hiroTamada
hiroTamada marked this pull request as ready for review September 14, 2026 13:26
@hiroTamada
hiroTamada requested a review from rgarcia September 14, 2026 13:27

@rgarcia rgarcia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed incrementally — the card-fill implementation, safety behavior, tests, documentation, and SDK upgrade look good.

@hiroTamada
hiroTamada merged commit 709d98b into main Sep 14, 2026
7 checks passed
@hiroTamada
hiroTamada deleted the hypeship/vault-fill-params branch September 14, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants