Skip to content

[P3] Multi-markdown import path has no aggregate size guard #1155

Closed

Description

@d-oit

Problem

stagePickedNonJsonFiles (src/components/studio/views/import-staging.ts) reads every picked Markdown file into memory with await file.text() and has no aggregate size cap. A folder pick containing thousands of large notes buffers them all before parsing.

Asymmetry

The sibling import paths are guarded:

  • JSON branch (use-export-handlers.ts): checkImportSize(file.size) before FileReader.
  • Zip branch: readVaultZip enforces MAX_VAULT_ZIP_BYTES, MAX_VAULT_ZIP_ENTRIES, MAX_VAULT_UNCOMPRESSED_BYTES.

Acceptance criteria

  • Folder/multi-markdown picks enforce a total-bytes cap consistent with the existing import limits, failing closed with the standard import-failed toast.
  • Covered by a unit test that stages an oversized batch and observes the rejection (test must be seen to fail without the guard — LESSON-041).

Found during post-CI review of PR #1154 (review comment); not a merge blocker.

Activity

  1. d-oit commented on Nov 19, 2026

    @d-oit
    OwnerAuthor

    Implemented in #1178 (committed as 90246d1).

    • Aggregate cap added to the shared Markdown import service: batch total and per-file character limits fail closed before any parse (checkVaultLimits, packages/dks-core/src/markdown.ts), and the staging layer surfaces the rejection as an i18n'd toast (src/components/studio/views/import-staging.ts).
    • Covered by src/lib/import/markdown-import.test.ts (oversized batch/total) and the dks-core suite.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions