Skip to content

Revert "fix(backend): add size limits on uploaded file contents to prevent memory exhaustion"#148

Merged
suresh1319 merged 1 commit into
masterfrom
revert-139-fix/issue-121-file-size-limits
Jun 2, 2026
Merged

Revert "fix(backend): add size limits on uploaded file contents to prevent memory exhaustion"#148
suresh1319 merged 1 commit into
masterfrom
revert-139-fix/issue-121-file-size-limits

Conversation

@suresh1319
Copy link
Copy Markdown
Owner

Reverts #139

Copilot AI review requested due to automatic review settings June 2, 2026 06:38
@suresh1319 suresh1319 temporarily deployed to revert-139-fix/issue-121-file-size-limits - Collab-Code-Editorr PR #148 June 2, 2026 06:38 — with Render Destroyed
@suresh1319 suresh1319 merged commit 7477377 into master Jun 2, 2026
1 check passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reverts the previously-added upload size enforcement for batched file uploads, removing both client-side and server-side limits around uploaded file contents.

Changes:

  • Removes client-side per-file content size checks during upload (EditorPage upload handler).
  • Removes server-side validation for per-file and per-room stored content size before persisting uploads (FS_UPLOAD_BATCH handler).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/pages/EditorPage.js Reverts client-side size-guard logic and adjusts upload reading flow for images/binary/text files.
server.js Reverts server-side fileContents size validation prior to mutating room file state.
Comments suppressed due to low confidence (1)

server.js:319

  • FS_UPLOAD_BATCH stores arbitrary fileContents into in-memory room state without any size limits. A client can repeatedly upload <=1MB chunks (or whatever Socket.IO allows) and grow roomState[roomId].fileContents without bound, reintroducing the memory-exhaustion/DoS risk that the reverted change was mitigating. Validate per-file and per-room cumulative size before mutating the file system / contents map, and reject the upload with an ack message when limits are exceeded.
    for (const node of nodes) {
      fs[node.id] = node;
      if (fs[node.parentId]) {
        if (!fs[node.parentId].children) fs[node.parentId].children = [];
        // Avoid adding duplicate child references

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/pages/EditorPage.js
Comment on lines +624 to +627
const fileId = uuid();
// Always add the node so binary files appear in the file tree
nodesToCreate.push({ id: fileId, name: file.name, type: 'file', parentId });

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.

2 participants