microsoft / microsoft/FluidFramework

Serialized snapshot blob maps corrupt arbitrary binary summary blobs

Open
#28,030 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
4.9k
Forks
586
Avg merge
1d 15h
Merged PRs (30d)
146

Description

Describe the bug

Container-loader serialized-state paths assume structural snapshot blobs are UTF-8 text. SummaryType.Blob, however, accepts raw Uint8Array content. Arbitrary binary bytes can therefore be corrupted when a summary is converted to a snapshot, serialized through a string-valued blob map, and later rehydrated.

Affected paths include detached-container serialization/rehydration and frozen full-container capture of structural snapshot blobs. Converting invalid UTF-8 bytes to a JavaScript string replaces bytes with U+FFFD; encoding that string later cannot recover the original payload.

This surfaced while reviewing PR #27880. That feature should retain its local base64 workaround rather than expanding scope into the generic loader serialization format.

To Reproduce

Steps to reproduce the behavior:

  1. Create a summary containing SummaryType.Blob with bytes such as Uint8Array([0x00, 0x7f, 0x80, 0xc3, 0x28, 0xff]).
  2. Serialize it through detached-container state or capture it as a structural blob in frozen full-container state.
  3. JSON round-trip and rehydrate the state.
  4. Read the blob and compare it byte-for-byte with the original payload.
  5. Observe replacement-byte sequences where invalid UTF-8 bytes were present.
Expected behavior

Serialized snapshot formats should preserve arbitrary blob bytes. Binary encoding should be explicit at the JSON boundary (for example, a versioned base64 encoding marker), with backward-compatible decoding for existing marker-less UTF-8 states. Paths whose contracts guarantee textual content may continue using UTF-8 explicitly.

Logs

N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the byte-for-byte failure with the listed Uint8Array through detached-container serialization and frozen full-container capture, then inspect the loader serialization and rehydration paths. Verify JSON round-tripping for structural snapshot blobs and preserve backward-compatible decoding of existing marker-less UTF-8 states. Done means arbitrary binary bytes survive both affected paths unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.