Skip to content

docs(crypto): clarify encryptable contract - #1286

Merged
quexten merged 3 commits into
mainfrom
cipher-full-view-part-1
Jul 23, 2026
Merged

docs(crypto): clarify encryptable contract#1286
quexten merged 3 commits into
mainfrom
cipher-full-view-part-1

Conversation

@quexten

@quexten quexten commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Encryptables currently have mis-usages, which lead to easy bugs. For example, encrypt(decrypt(encrypt(K1), K1), K2) may lead to an item partially being encrypted by K1, and partially by K2. The next decrypt will fail. This is entirely unexpceted and a footgun. This PR adds clarification on the intent (contract) of the traits, and tags usages that are violating the contract.

@quexten quexten changed the title cipher full view part 1 docs(crypto): clarify encryptable contract Jul 21, 2026
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

🔍 SDK Breaking Change Detection

SDK Version: cipher-full-view-part-1 (7238134)

⚠️ If breaking changes are detected, a corresponding pull request addressing them must be ready for merge in the affected client repository.

Client Status Details
typescript ✅ No breaking changes detected Compilation passed with new SDK version - View Details
android ✅ No breaking changes detected Compilation passed with new SDK version - View Details

Breaking change detection uses the build of the SDK from this branch, including any incompatibities pre-existing on or merged into this branch. Check the workflow logs to confirm.
Results update as workflows complete.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.74%. Comparing base (e504886) to head (7238134).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1286   +/-   ##
=======================================
  Coverage   85.74%   85.74%           
=======================================
  Files         483      483           
  Lines       68364    68364           
=======================================
  Hits        58622    58622           
  Misses       9742     9742           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@quexten
quexten force-pushed the cipher-full-view-part-1 branch from 7238134 to 5d8de7a Compare July 22, 2026 11:38
Copilot AI review requested due to automatic review settings July 22, 2026 11:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 22, 2026 11:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@quexten
quexten marked this pull request as ready for review July 22, 2026 11:47
@quexten
quexten requested review from a team as code owners July 22, 2026 11:47
@quexten
quexten requested review from eligrubb, nick-livefront and nikwithak and removed request for nick-livefront July 22, 2026 11:47
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

This is a documentation-only change to bitwarden-crypto and bitwarden-vault. It adds a round-trip contract to the CompositeEncryptable, PrimitiveEncryptable, and Decryptable traits, then annotates the existing AttachmentView, CipherView, and LoginView implementations that violate that contract by passing key-bound ciphertext (key, fido2_credentials) through unchanged. I verified each annotation against the surrounding code — the described pass-through behavior, field types, and the reencrypt_fido2_credentials escape hatch all match reality. No executable code changes are present, so there is no runtime behavior or security impact.

Code Review Details

No blocking findings.

Minor note (not blocking): crates/bitwarden-crypto/src/traits/decryptable.rs:8 contains a typo — "MUST succed" should be "MUST succeed".

@eligrubb eligrubb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Love it!

@quexten
quexten merged commit a9b0e18 into main Jul 23, 2026
73 checks passed
@quexten
quexten deleted the cipher-full-view-part-1 branch July 23, 2026 16:15
bw-ghapp Bot added a commit to bitwarden/sdk-swift that referenced this pull request Jul 23, 2026
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.

4 participants