fix: cap POST /download-zip at 50 documents

🟢 open · #111 · willchen96/mike ← bmersereau/mike · opened 13d ago by bmersereau · +1,301-7 across 5 files · ↗ on GitHub

From the PR description

Summary

  • Adds a MAX_ZIP_DOCUMENTS = 50 constant and a 400 guard to POST /single-documents/download-zip
  • Prevents an authenticated user from triggering simultaneous in-memory loading of an unbounded number of large files

Closes #99 Closes #114

Changes

  • backend/src/routes/documents.ts - MAX_ZIP_DOCUMENTS constant + length check returning 400
  • backend/src/lib/__tests__/downloadZipLimit.test.ts - static analysis test verifying the limit exists
  • backend/vitest.config.ts - vitest config scoping tests to src/ (excludes compiled dist/)
  • backend/package.json - "test": "vitest run" script added

Test plan

  • Unit tests added and passing
  • Backend build passes

Our analysis

Cap zip download bundle at 50 documents — read the full analysis →

Think the analysis missed something the PR description covers?

Capture this PR into my fork

Download a Markdown prompt that tells Claude how to port every commit in this PR into your working tree. Run it via claude -p < capture-pull-111.md from inside the repo you want the changes in.

⬇ Download capture-pull-111.md