microsoft / microsoft/FluidFramework
Serialized snapshot blob maps corrupt arbitrary binary summary blobs
Nobody has claimed this yet.
- 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:
- Create a summary containing
SummaryType.Blobwith bytes such asUint8Array([0x00, 0x7f, 0x80, 0xc3, 0x28, 0xff]). - Serialize it through detached-container state or capture it as a structural blob in frozen full-container state.
- JSON round-trip and rehydrate the state.
- Read the blob and compare it byte-for-byte with the original payload.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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