Skip to content

[PM-40047] Detect blob ciphers via format_version probe#7930

Merged
shane-melton merged 4 commits into
mainfrom
vault/pm-40047/cipher-blob-json-refactor
Jul 14, 2026
Merged

[PM-40047] Detect blob ciphers via format_version probe#7930
shane-melton merged 4 commits into
mainfrom
vault/pm-40047/cipher-blob-json-refactor

Conversation

@shane-melton

Copy link
Copy Markdown
Member

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-40047

📔 Objective

The SDK now stores blob-encrypted cipher payloads as JSON, which starts with { and collides with the leading-byte heuristic previously used to tell blob from legacy field-level CipherData. This replaces that heuristic in Cipher.IsDataBlobEncrypted() with a top-level format_version property probe (via Utf8JsonReader, so large payloads aren't fully materialized), matching the SDK. Tests updated. Paired with the sdk-internal change for PM-40047.

@shane-melton shane-melton added the ai-review Request a Claude code review label Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the replacement of the leading-byte heuristic in Cipher.IsDataBlobEncrypted() with a format_version top-level property probe via Utf8JsonReader, plus the aligned test updates. The new implementation correctly parses only top-level properties, handles malformed JSON via catch (JsonException), and the extracted HasTopLevelProperty helper cleanly separates the probe mechanism from the semantic check. Tests cover legacy, empty, invalid, and blob shapes.

Code Review Details
  • ❓ : Semantics inversion for non-JSON Data — confirm no cipher was persisted in the earlier opaque (non-JSON) blob format, otherwise those rows would now hit an uncaught JsonException during deserialization.
    • src/Core/Vault/Entities/Cipher.cs:40

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.99%. Comparing base (f0f04eb) to head (ef56ef9).
⚠️ Report is 34 commits behind head on main.

Files with missing lines Patch % Lines
src/Core/Vault/Entities/Cipher.cs 89.47% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7930      +/-   ##
==========================================
+ Coverage   61.34%   65.99%   +4.64%     
==========================================
  Files        2244     2249       +5     
  Lines       98673    99074     +401     
  Branches     8912     8961      +49     
==========================================
+ Hits        60531    65382    +4851     
+ Misses      36006    31443    -4563     
- Partials     2136     2249     +113     

☔ 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.

@shane-melton shane-melton changed the title [PM-40047] refactor: detect blob ciphers via format_version probe [PM-40047] Detect blob ciphers via format_version probe Jul 9, 2026
@shane-melton shane-melton added the t:tech-debt Change Type - Tech debt label Jul 9, 2026
Comment thread src/Core/Vault/Entities/Cipher.cs
@shane-melton shane-melton marked this pull request as ready for review July 9, 2026 19:54
@shane-melton shane-melton requested a review from a team as a code owner July 9, 2026 19:54
Comment thread src/Core/Vault/Entities/Cipher.cs
gbubemismith
gbubemismith previously approved these changes Jul 9, 2026
Comment thread src/Core/Vault/Entities/Cipher.cs
@shane-melton shane-melton merged commit 04c886b into main Jul 14, 2026
66 checks passed
@shane-melton shane-melton deleted the vault/pm-40047/cipher-blob-json-refactor branch July 14, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review t:tech-debt Change Type - Tech debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants