Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

loro-crdt

Latest version: v1.19.0

Overview

Last scanned
23 Nov 2026
Published
23 Nov 2026
npm package Publisher: leon7hao, rem2018
6,313 Stars
211 Forks
11 Versions
913.3K Downloads
Rust Repo language

Scan summary

loro-crdt was last scanned on 23 Nov 2026 at version 1.19.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 11 versions; the latest was published on 23 Nov 2026.
  • Findings: 1 rule fired in version 1.19.0 (4 instances: 4 low). The score describes this version only.
  • Downloads: 913,333 downloads.

Versions

11 versions published
Versions and the rules that fired in each
VersionPublishedStatus
1.19.0 LATEST 23 Nov 2026 1 rule fired
1.18.0 16 Nov 2026 1 rule fired
1.17.1 22 Oct 2026 1 rule fired
1.17.0 22 Oct 2026 Not shown
1.16.4 30 Sep 2026 Not shown

Rules fired in 1.19.0: 1

Findings

4 Low

Findings for v1.19.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

WebAssembly module included

The package includes a WebAssembly (.wasm) module. It cannot be reviewed as source, but it runs sandboxed inside the JavaScript runtime and can access only what the host code gives it. WebAssembly is common in parsers, codecs and cryptography libraries. Shown for awareness.

LOW
Checking access…

🔒 Create a free account to see all 4 findings with descriptions and instance counts

The score describes 1.19.0; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

Loro is a CRDTs(Conflict-free Replicated Data Types) library that makes building local-first and collaborative apps easier. You can now use it in Rust, JS (via WASM), and Swift.

Features

Features Provided by CRDTs

  • P2P Synchronization
  • Automatic Merging
  • Local Availability
  • Scalability
  • Delta Updates

Supported CRDT Algorithms

Advanced Features in Loro

In this example, we demonstrate importing an entire Loro codebase into a Loro-powered version controller, preserving the complete Git DAG history while enabling fast version switching.

Undo and map child identity

UndoManager selects changes made by the bound local peer. When undoing the deletion of a map key that held a container, the child's creation method matters:

  • A regular child created with map.setContainer(key, new LoroMap()) is reconstructed with a new container ID. Existing handles still address the original child. Concurrent edits sent to the original ID remain there and do not appear in the reconstructed child, whether imported before or after undo.
  • A mergeable child created with map.ensureMergeableMap(key) (or another ensureMergeable* method) keeps the same parent/key/type identity when undo restores the key. Retained state and concurrent edits become visible again. The parent must keep its ID: if undo reconstructs a regular ancestor, its mergeable descendants also get different IDs.

For example, A deletes a regular child containing { base: 1 } while B adds remote: 2 to that child's original ID. A's undo restores a new child containing { base: 1 }; B's edit still targets the hidden original child. Both replicas converge to this result. With a mergeable child under the same parent, undo restores the same ID and the visible result is { base: 1, remote: 2 } in either import order. Undo's ID remapping does not redirect imported operations.

Use mergeable children for a stable logical map slot. Reusing the same parent/key/type resurfaces retained state rather than creating an empty entity. Use distinct keys for distinct entity lifetimes. To make entity deletion undoable while keeping its identity and concurrent edits, retain the entity's container and undo a visibility or deleted field instead of deleting its map key.

Debugging the Wasm build

The standard build pipeline (deno run -A ./scripts/build.ts dev|release) now keeps DWARF debugging information through wasm-bindgen and emits two helper files alongside every loro_wasm_bg.wasm artifact:

  • loro_wasm_bg.wasm.map — a v3 source map derived from DWARF so that Chrome, Edge, and Firefox can show original Rust locations when inspecting stack traces.

Load the source map in browser devtools; when devtools fetches the debug companion it can map instructions back to Rust source files and line numbers without inflating the shipped .wasm.

Bundler entries

Bare import { LoroDoc } from "loro-crdt" uses package conditional exports. Browser development builds can resolve the nested browser + development conditions to the bundler entry, while browser production builds can resolve the browser condition to a synchronous browser build that avoids Vite/Rolldown production chunk cycles around .wasm wrappers. A legacy browser string field also points to the browser entry for bundlers that still consult it. Runtimes that need native .wasm module imports can still use the bundler entry, and apps that prefer explicit async initialization can use loro-crdt/web.

Vite and Webpack understand new URL("./loro_wasm_bg.wasm", import.meta.url) and emit the WASM asset automatically. Plain esbuild and plain Rollup do not copy that asset by default. For those tools, either import loro-crdt/base64 to inline the WASM into the JS bundle without top-level await, or keep the default loro-crdt import and copy node_modules/loro-crdt/browser/loro_wasm_bg.wasm next to the emitted JS bundle as a build step.

Next.js Turbopack can use the default browser entry. If a Next.js Webpack build resolves the bundler entry instead of the package browser remap, use loro-crdt/base64.

Example

import { expect, test } from 'vitest';
import { LoroDoc, LoroList } from 'loro-crdt';

test('sync example', () => {
  // Sync two docs with two rounds of exchanges

  // Initialize document A
  const docA = new LoroDoc();
  const listA: LoroList = docA.getList('list');
  listA.insert(0, 'A');
  listA.insert(1, 'B');
  listA.insert(2, 'C');

  // Export all updates from docA
  const bytes: Uint8Array = docA.export({ mode: 'update' });

  // Simulate sending `bytes` across the network to another peer, B

  const docB = new LoroDoc();
  // Peer B imports the updates from A
  docB.import(bytes);

  // B's state matches A's state
  expect(docB.toJSON()).toStrictEqual({
    list: ['A', 'B', 'C'],
  });

  // Get the current version of docB
  const version = docB.oplogVersion();

  // Simulate editing at B: delete item 'B'
  const listB: LoroList = docB.getList('list');
  listB.delete(1, 1);

  // Export the updates from B since the last sync point
  const bytesB: Uint8Array = docB.export({ mode: 'update', from: version });

  // Simulate sending `bytesB` back across the network to A

  // A imports the updates from B
  docA.import(bytesB);

  // A has the same state as B
  expect(docA.toJSON()).toStrictEqual({
    list: ['A', 'C'],
  });
});

Things to know

These come up often when people start using loro-crdt.

Events fire on commit

doc.subscribe and container subscribe callbacks run when a transaction is committed: on doc.commit(), or implicitly on export, import and checkout. An edit you haven't committed sends no event, and subscribeLocalUpdates doesn't include it yet.

Text positions are UTF-16 indexes

LoroText.insert, delete, slice, charAt and text events count UTF-16 code units, the same as JS string indexes. Convert positions that come from UTF-8 or code point offsets first.

One peer ID per session

Each LoroDoc starts with a random peer ID. If you call setPeerId, don't give the same ID to two sessions that can edit at the same time, and don't use a user ID: one user can have several tabs or devices open. Peers that share an ID send updates that look like duplicates, and the docs stop converging.

Concurrent setContainer on one map key keeps one child

setContainer and getOrCreateContainer make a regular child whose ID comes from the operation that created it. When two peers create a child at the same key at the same time, one wins and the other child's content is hidden. If more than one peer can create the child, use ensureMergeableMap, ensureMergeableText or another ensureMergeable* method, and every peer gets the same child.

checkout makes the document read-only

After doc.checkout(frontiers) the document is detached. It shows the old version, edits throw, and imports go into history without changing what you see. doc.checkoutToLatest() (or attach()) brings it back. To restore an old version as new edits, use doc.revertTo(frontiers).

Container handles keep the document alive after doc.free()

Every container object you get from a document (doc.getText(), map.get(), list.insertContainer() and so on) holds a reference to the document. A detached container (new LoroText(), new LoroMap(), ...) does too once you attach it with setContainer or insertContainer, because it keeps its attached copy (see getAttached()). doc.free() only frees the LoroDoc object. The document's memory goes once every handle is gone too, either from its own free() or from the garbage collector finalizing it.

Finalizers run only after the current task yields to the event loop. Code that creates and drops many documents in one synchronous loop (a test suite, a batch job, a request handler that never awaits) keeps all of them in WASM memory until it yields, and WASM memory never shrinks. In loro-dev/loro#1312, 1,000 documents with a 20,000-character text each grew WASM memory by about 44 MB when only doc.free() was called. Freeing the text handle too kept it flat. Free the handles first, or let the loop yield:

const doc = new LoroDoc();
const text = doc.getText("text");
text.insert(0, "hello");
doc.commit();

text.free();
doc.free();

A handle still works after doc.free() while it's alive, since it keeps the document.

Undoing a deleted map key makes a new child container

A child made with setContainer comes back under a new container ID when undo restores its key. One made with ensureMergeable* keeps its ID. See Undo and map child identity.

Blog

Credits

Loro draws inspiration from the innovative work of the following projects and individuals:

  • Diamond-types: The Event Graph Walker (Eg-walker) algorithm from @josephg has been adapted to reduce the computation and space usage of CRDTs.
  • Automerge: Their use of columnar encoding for CRDTs has informed our strategies for efficient data encoding.
  • Yjs: We have incorporated a similar algorithm for effectively merging collaborative editing operations, thanks to their pioneering work.
  • Matthew Weidner: His work on the Fugue algorithm has been invaluable, enhancing our text editing capabilities.
  • Martin Kleppmann: His work on CRDTs has significantly influenced our comprehension of the field.

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm loro-crdt

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Plug and Pray: Your AI Agents Are Taking Orders From Strangers
Research

Plug and Pray: Your AI Agents Are Taking Orders From Strangers

PHP2Shell, Day 5 93.6% of Measurable Instances Still Unpatched (1)
Vulnerability Insights

PHP2Shell, Day 5: The Panic Hasn’t Turned Into Patching

Ethersphere Hijacked With Crypto Stealing Malware (1)
npm

Ethersphere Hijacked With Crypto Stealing Malware Via Github & npm

Frame 2085668439 (1)
Group 1261154229