Skip to content

[TEST] Golden-vector interop test for the JS connect-widget crypto - #94

Merged
ScottieR merged 1 commit into
masterfrom
test/web-connections-js-interop
Aug 31, 2026
Merged

ScottieR merged 1 commit into
masterfrom
test/web-connections-js-interop

Conversation

@ScottieR

Copy link
Copy Markdown
Owner

Locks the Rust decrypt path against a ciphertext produced by canopy-admin's src/connect-widget/main.ts, so a protocol drift between the two repos (curve, HKDF info string, AEAD choice, byte layout) fails loudly.

That drift is otherwise silent: the browser keeps encrypting, this install just stops being able to decrypt.

The golden vector

Generated by importing the real encryptToInstance under Node (the module only calls main() when a DOM exists), against a throwaway recipient keypair created for the vector alone. It has never been a real instance key and decrypts only a dummy string.

  • WEB_CONNECTIONS.md — how to regenerate, and why the recipient key must never be a real one
  • .gitleaks.toml — allowlists the vector's literal, scoped to that exact value. Verified a different secret in the same file is still caught.

Verification

cargo test --lib web_connections → 6 passed. The JS half (connect-widget.test.js, canopy-admin) is wired into its npm test script in a companion PR.

Rescued from an uncommitted change that sat in a local worktree for five days; rebased onto current master.

🤖 Generated with Claude Code

Locks the Rust decrypt path against a ciphertext produced by
canopy-admin's src/connect-widget/main.ts, so a protocol drift between
the two repos (curve, HKDF info string, AEAD choice, byte layout) fails
loudly. That drift is otherwise silent: the browser keeps encrypting,
this install just stops being able to decrypt.

The vector was generated by importing the real encryptToInstance under
Node, against a throwaway recipient keypair made for the vector alone —
it has never been a real instance key and decrypts only a dummy string.

- WEB_CONNECTIONS.md: how to regenerate the vector, and why the
  recipient key must never be a real one
- .gitleaks.toml: allowlist the vector's literal, scoped to that exact
  value so any other secret in the file is still caught

Rescued from an uncommitted change that had sat in a local worktree for
five days; rebased onto current master.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ScottieR

Copy link
Copy Markdown
Owner Author

verify is red here for a reason that isn't this PR's contents: CI's gitleaks never reads the repo's .gitleaks.toml, because gitleaks-action only honours a repo config when GITLEAKS_CONFIG names it. The allowlist entry added here works for the local pre-commit hook and is ignored by CI.

Fixed in #97 — this goes green once that merges. Nothing to change here.

(That config has carried the Privacy transaction fixture allowlist since Aug 10 without ever taking effect in CI either; this PR just happens to be the first whose finding lands on a changed line.)

@ScottieR
ScottieR merged commit 5b8bfce into master Aug 31, 2026
5 of 7 checks passed
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.

1 participant