Skip to content

Preserve external Buffer view bounds - #16

Merged
vrtmrz merged 2 commits into
mainfrom
fix-external-buffer-view
Jul 12, 2026
Merged

Preserve external Buffer view bounds#16
vrtmrz merged 2 commits into
mainfrom
fix-external-buffer-view

Conversation

@vrtmrz

@vrtmrz vrtmrz commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • preserve a Node Buffer's byte offset and length when reading through ExternalVaultFilesystem;
  • isolate storage identifiers and the DiffZip-owned accessor context from the plug-in factory graph;
  • name and document that context as internal rather than presenting it as a platform-neutral storage contract;
  • move platform path normalisation to the concrete accessors; and
  • directly test _readBinary() with an offset Node Buffer returned by fake fsPromises.

Root cause

The external filesystem adapter passed buffer.buffer to the OW exact-view converter. Accessing the backing buffer first discarded the Buffer's visible range and could expose unrelated bytes from its allocation pool when the runtime returned an offset view.

The defect and fix are reproduced deterministically by injecting an offset Buffer into the actual ExternalVaultFilesystem._readBinary() method. No specific user incident or production data corruption has been confirmed.

The storage accessor also depended on the factory module and concrete plug-in type, which pulled the complete plug-in and Svelte graph into an adapter-level test. The smaller structural context makes the adapter directly testable without changing its runtime policy. It remains a DiffZip-internal composition shape, not a proposed neutral filesystem API.

Impact

Fixed a potential issue where external filesystem reads could include bytes outside a Node Buffer's visible range when the runtime returned an offset view. The exact visible bytes are now returned. Root selection and external-backup path behaviour are unchanged.

Validation

  • 61 Deno tests passed;
  • 11 UI tests passed;
  • TypeScript and production build;
  • ESLint; and
  • real-Obsidian E2E typecheck.

@vrtmrz
vrtmrz marked this pull request as ready for review July 12, 2026 12:04
@vrtmrz
vrtmrz merged commit 9c24e74 into main Jul 12, 2026
1 check passed
@vrtmrz
vrtmrz deleted the fix-external-buffer-view branch July 14, 2026 17:28
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.

1 participant