Skip to content

fix(validation): cap documents-with-memories limit and bulk-delete containerTags - #1584

Open
Sravanjangam wants to merge 1 commit into
supermemoryai:mainfrom
Sravanjangam:fix/validation-limit-caps
Open

fix(validation): cap documents-with-memories limit and bulk-delete containerTags#1584
Sravanjangam wants to merge 1 commit into
supermemoryai:mainfrom
Sravanjangam:fix/validation-limit-caps

Conversation

@Sravanjangam

@Sravanjangam Sravanjangam commented Aug 22, 2026

Copy link
Copy Markdown

Hi supermemory team 👋 Thanks for building such a great product! While running a security & quality audit of the repo we hit this issue and put together a small, tested fix — details below.

Problem

Two schemas in packages/validation missed bounds their whole schema family applies:

  1. DocumentsWithMemoriesQuerySchema.limit had no .max() while sibling query schemas cap at 100 → unbounded row-join amplification on documents-with-memories queries.
  2. BulkDeleteMemoriesSchema.containerTags accepted unlimited entries of unlimited length while the parallel ids field was capped .max(100) → destructive fan-out asymmetry.

Part of #1578 (finding M9).

Solution

Align with the family's existing convention (.max(100)) rather than inventing new limits — minimal diff, consistent developer experience.

Changes

  • packages/validation/src/api.tsDocumentsWithMemoriesQuerySchema.limit gains .max(100)
  • same file → BulkDeleteMemoriesSchema.containerTags gains .max(100) items, each ≤256 chars

Verification

Fresh from the committed branch: bun test api.test.ts29 pass; bunx tsc --noEmit → exit 0; Biome clean.


Happy to iterate on any of this — feedback and reworks very welcome! 🙏

Environment

  • macOS 26.1 (arm64) · bun 1.4.0 · node v26.7.0
  • vitest 3.2.4 (workspace-pinned) · Biome lint clean
  • Branch fix/validation-limit-caps — all gates re-run fresh at commit f13df7a14530

…containerTags

- DocumentsWithMemoriesQuerySchema.limit gains .max(100), matching the
  cap style of every sibling list schema (SearchRequest <= 100,
  ListMemories <= 1100). The omission was unguarded: each row expands
  joined memory entries, so an arbitrary limit was a memory/CPU/cost
  amplifier. Cap test added, mirroring the existing ListMemories cap
  test.
- BulkDeleteMemoriesSchema.containerTags now caps at 100 tags of <=256
  chars, aligning the most destructive operation in the schema with the
  hard .max(100) already applied to its ids array.
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