Skip to content

Add customer-protected secrets and vault unwrap - #150

Merged
AHarmlessPyro merged 4 commits into
mainfrom
cursor/customer-protected-secrets-64ea
Nov 9, 2026
Merged

AHarmlessPyro merged 4 commits into
mainfrom
cursor/customer-protected-secrets-64ea

Conversation

@AHarmlessPyro

@AHarmlessPyro AHarmlessPyro commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds SDK support for customer-protected secrets (browserctrl#1539), matching the Node SDK. The SDK wraps each secret version locally with the customer's own key and unwraps it locally when it's used. It also adds the new wrapped-vault operations and the updated session vault shape.

Changes

  • hyperbrowser.create_customer_key() and the CustomerKey protocol:
    • RSA-OAEP-256, ECDH-ES and ECDH-ES+A256KW with A256GCM, for RSA ≥ 2048, EC P-256/384/521 and X25519/X448 keys.
    • The kid is the RFC 7638 thumbprint by default.
    • Keys can come from cryptography key objects, PEM/DER or JWK dicts.
    • With the async client, a KMS key's wrap/unwrap may be coroutines.
  • secrets.create({"customer_key" | "protection"}) and add_version(…, customer_key=…).
  • New secret methods:
    • get_wrapped_version and unwrap, which returns a pinned SecretReference with unwrapped.
    • rewrap(from_key=, to_key=) and replace_version_wrapping.
  • New vault methods: vaults.get_wrapped and vaults.unwrap, which returns a VaultReference for sandboxes and processes.
  • All of the above are in both the sync and async clients.
  • Unwrapped references are accepted by:
    • sandbox and process secrets
    • vault
    • one_password.token
    • the 1Password fill token
  • Secret.protection, SecretVersion.outer_kid and retires_at, and SessionDetail.vaults.
  • TypedDicts, Pydantic models and the mypy/Pyright fixtures under tests/typecheck/.
  • README section, error codes, and version 1.15.0.

Validation

  • ruff check .
  • pytest tests --ignore=tests/sandbox/e2e: 1060 passed, including the mypy and Pyright contract tests.
  • New tests/test_customer_secrets.py covers:
    • key types
    • sync and async managers
    • request payloads
    • the interop fixture shared with the Node SDK
  • Manual cross-checks:
    • Envelopes wrapped here unwrap with the Node SDK and jwcrypto.
    • The server's envelope validator accepts them.
Open in Web Open in Cursor 

Note

Medium Risk
Introduces client-side JWE wrapping/unwrapping and new secret lifecycle APIs, which are security-sensitive, though behavior for default platform-protected secrets stays unchanged and tests cover interop and payloads.

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

cursoragent and others added 4 commits November 9, 2026 19:53
Co-authored-by: Ninad Sinha <AHarmlessPyro@users.noreply.github.com>
…rences

Co-authored-by: Ninad Sinha <AHarmlessPyro@users.noreply.github.com>
Co-authored-by: Ninad Sinha <AHarmlessPyro@users.noreply.github.com>
Co-authored-by: Ninad Sinha <AHarmlessPyro@users.noreply.github.com>
@AHarmlessPyro

Copy link
Copy Markdown
Contributor Author

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@AHarmlessPyro
AHarmlessPyro added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit b7b9ccb Nov 9, 2026
13 checks passed
@AHarmlessPyro
AHarmlessPyro deleted the cursor/customer-protected-secrets-64ea branch November 9, 2026 22:17
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.

3 participants