feat: 1Password Rust SDK — initial implementation#1
Merged
Conversation
Port of the Go SDK (v0.4.1-beta.1) to idiomatic Rust with WASM core and desktop app integration support.
13 tasks covering project scaffolding, types, core abstraction, WASM runtime, client builder, all 7 API surfaces, desktop app integration, examples, and CI.
Implements the Core trait using the Extism SDK with the embedded 9MB WASM binary. Registers required host functions (random_fill, unix_time_milliseconds, utc_offset_seconds) in their respective namespaces and configures allowed 1Password hosts.
- Use op_sdk_ipc_send_message/op_sdk_ipc_free_response symbols (not init_client/invoke) - Send payload as base64 string matching Go's json.Marshal([]byte) behavior - Receive response payload as byte array matching Rust serde serialization - Use 7-digit build version format (0040101) matching Go SDK's version-build
…handling - Handle mutex poisoning in ExtismCore instead of unwrap() panics - Fix memory leak in SharedLibCore when out_buf is non-null but out_len is 0 - Fix error double-processing in client_invoke (preserve error type info) - Redact sa_token in ClientConfig Debug impl - Validate that at least one auth method is configured in builder
… Debug - Cache shared ExtismCore via LazyLock for standalone Secrets operations (avoids recompiling 9.5MB WASM on every call) - Add DesktopSessionExpired retry in client_invoke (re-inits client, retries once) - Use AtomicU64 for InnerClient.id to support retry without &mut self - Redact sensitive fields in Debug impls for ItemField, ResolvedReference, and GeneratePasswordResponse to prevent secret leakage via logging
…ries cargo-deny v2 changed the advisories config format — `unmaintained` now takes a scope value, not a severity. Also adds missing license entries (LLVM-exception, MPL-2.0, CDLA-Permissive-2.0), upgrades rustls-webpki to 0.103.13, and ignores wasmtime advisories pinned by extism.
fix: harden core invocation boundaries and error handling
Daily Cargo dependency checks to catch advisories early, grouped minor/patch version bumps to reduce noise, and GitHub Actions ecosystem monitoring to mitigate CI supply-chain risk.
Harden Dependabot config for security product
Collaborator
Author
|
@BugBot review |
… lookup Address Bugbot findings: - AtomicU64 for client_id now uses Release/Acquire ordering so concurrent threads observe the updated id after session retry re-initialization. - Windows library path lookup uses USERPROFILE instead of HOME via compile-time cfg, fixing broken path resolution on Windows.
…size check The Go shared library encodes response payloads as base64 strings (Go's json.Marshal of []byte), not JSON integer arrays. Add a custom serde deserializer using base64::STANDARD to match the wire format. Remove redundant MESSAGE_LIMIT check in ExtismCore::invoke() since CoreWrapper::invoke() already validates payload size for all backends.
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
… permissions Examples now print secret length instead of the secret value itself. CI workflow gets explicit `contents: read` permissions block.
Concurrent threads hitting DesktopSessionExpired could each call init_client independently, racing on set_client_id and orphaning the loser's client ID. A retry_lock mutex now serializes the re-initialization path. Also removes the unnecessary params.clone() on every invoke — params are moved into the config and only consumed on retry.
…nfig The double map_err chain first typed transport errors via unmarshal_core_error then immediately wrapped them into a generic Config string, destroying the type information callers need for error-specific handling like rate limit backoff.
Only used within core.rs — no need for pub(crate) export.
Prevents leaking the old client ID in the WASM core when re-initializing after DesktopSessionExpired. Also changes deny.toml unmaintained scope from "workspace" to "all" for clarity in a single-crate project.
…r on error Retry now compares stale_id to current_id under the lock — if another thread already refreshed, reuse the new ID instead of releasing it. SharedLibCore now frees the library-allocated output buffer before returning early on FFI error codes, preventing a memory leak.
Pre-core errors (Serialization, Config) now bypass unmarshal_core_error entirely via a match guard, ensuring they're never misidentified as core errors or passed through unnecessary JSON parsing.
error_from_return_code returns Result<(), _> — use ? to propagate the error instead of returning it directly from a Result<Vec<u8>, _> function.
Desktop-only consumers can now compile with --no-default-features --features desktop, skipping the entire extism/wasmtime dependency tree. CI updated to clippy-check the desktop-only path.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8ee1880. Configure here.
Only used in core_extism.rs host functions which are gated on the wasm feature. Desktop-only builds no longer pull in chrono.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Port of the 1Password Go SDK to idiomatic Rust with full API parity.
core.wasmbinary used by Go/Python/JS SDKsExtismCore(WASM, default) andSharedLibCore(desktop app integration vialibloading, feature-gated)serdetagged enums (replacing Go's manual marshal/unmarshal)Security hardening (post-initial review)
unmarshal_core_errorhandles both Plugin (WASM) and SharedLib (desktop) error payloads; transport-only guard prevents non-core errors from being misidentifiedrandom_fillWASM host function rejects negative lengths; UTF-8 strictness on core responses (no silent lossy conversion)account_nameunconditionally skipped from core config;sa_tokenomitted when empty; SharedLib response payload correctly base64-decoded (matching Go wire format)permissions: contents: readon CI, CodeQL enabledNot at parity (flagged)
Test plan
cargo fmt --check— cleancargo clippy --all-features -- -D warnings— cleancargo test— 25 tests passingcargo deny check— advisories ok, bans ok, licenses ok, sources okcargo build --all-featurescompilesNote
High Risk
Large initial drop that introduces new runtime backends (Extism WASM + unsafe desktop shared-library FFI), core invocation/retry logic, and a full set of typed API bindings; failures could impact security-sensitive secret handling and session management. Also adds dependency/CI automation and advisory ignores that affect supply-chain posture.
Overview
Adds an initial
onepassword-sdkRust crate (edition 2024) that wraps the 1Passwordcore.wasmvia an Extism-basedCorebackend (featurewasm, default) and a feature-gated desktop backend via unsafelibloadingFFI.Implements the public client surface (
ClientBuilder,client_invokewith retry onDesktopSessionExpired) and typed APIs for Secrets/Items (incl. Files & Shares)/Vaults/Groups/Environments, backed by a large set ofserdedomain types and improved core error unmarshalling/UTF-8 handling.Adds repo automation and guardrails: CI workflow (fmt/clippy/tests +
cargo-deny), Dependabot config, an upstream Extism watch workflow,deny.tomladvisory/license/source policy (with temporary Wasmtime ignores), and scaffolding/docs/examples.Reviewed by Cursor Bugbot for commit 61e3eae. Bugbot is set up for automated code reviews on this repo. Configure here.