[Bug] signup.ts: uploadCommunityLogo is a simulated stub that converts files to data URLs with no size or type validation, sending multi-megabyte base64 strings in the signup payload

Open Beginner friendly
#130 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
typescript

Research direction

Start in src/features/Auth/v1/utils/signup.ts at uploadCommunityLogo, then trace where its returned value enters the signup payload for /api/v1/auth/signup-community. Confirm the existing FileReader flow and the intended image types and size limit from the issue. Done means oversized or unsupported files are rejected before FileReader runs, while accepted images continue through the signup flow.

Written by the indexing model from the issue text.

Description

Bug Summary

uploadCommunityLogo in src/features/Auth/v1/utils/signup.ts is explicitly marked as a simulation that encodes any uploaded file as a base64 data: URL and returns it as the logo value:

export async function uploadCommunityLogo(file: File): Promise<string> {
  // SIMULATION: If you need to switch to a real API, change this implementation
  return new Promise((resolve) => {
    const reader = new FileReader();
    reader.onload = () => resolve(reader.result as string);
    reader.readAsDataURL(file);   // no size check, no type check
  });
}

This data URL is then included in the signup form payload sent to /api/v1/auth/signup-community. Two issues:

  1. No file size limit: A user can select a 50 MB PNG. FileReader.readAsDataURL() succeeds, producing a ~67 MB base64 string (base64 overhead). This string is then embedded in the JSON request body sent to the API. The backend must parse a ~67 MB request body per signup attempt.

  2. No file type validation: Any file (executables, PDFs, ZIP archives) can be passed to this function. readAsDataURL() encodes anything. The resulting string may later be rendered in an <img src={...}> tag, which silently fails for non-image types rather than warning the user.

The comment acknowledges this is a simulation ("Replace with real FormData upload"), but the stub ships with no guards in the meantime.

Expected Behavior

uploadCommunityLogo should validate that:

  • file.size is within a reasonable limit (for example, 2 MB).
  • file.type is one of ["image/jpeg", "image/png", "image/webp"].

Both checks should throw an error before FileReader is invoked.

Actual Behavior

Any file of any size and type is encoded and included in the signup payload.

Affected File

src/features/Auth/v1/utils/signup.ts, uploadCommunityLogo function.


@NexGenStudioDev I would like to work on this issue. Could you please assign/ it to me? Contributing under NSoC '26.

Dominant language
TypeScript
Stars
7
Forks
17
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NexGenStudioDev/CommDesk

All issues in NexGenStudioDev/CommDesk

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.