Skip to content

Fix input validation, type safety, and missing config files in apps/me#177

Merged
taterhead247 merged 3 commits intofeat/mefrom
copilot/sub-pr-163
Mar 13, 2026
Merged

Fix input validation, type safety, and missing config files in apps/me#177
taterhead247 merged 3 commits intofeat/mefrom
copilot/sub-pr-163

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 13, 2026

Several bugs in the apps/me API routes allowed malformed requests to slip through or throw unexpectedly, and UserUpsert.meta was typed inconsistently with the actual DB schema.

Validation fixes

Falsy checks (!body.orgId) incorrectly reject 0 as an invalid ID. Replaced with explicit null/undefined + typeof guards in both the roles and positions routes:

// Before — rejects orgId: 0
if (!body.orgId || !body.roleName) { ... }

// After — only rejects missing/non-numeric values
if (body.orgId == null || typeof body.orgId !== "number" || !body.roleName) { ... }

Avatar route type safety

formData.get("file") can return a string. The unsafe as File | null cast would propagate to file.type/file.arrayBuffer() and throw. Replaced with an instanceof File guard returning a 400 on mismatch. Also corrected the error message which still referenced gif after it was removed from ALLOWED_TYPES.

UserUpsert.meta type alignment

meta was typed as string in UserUpsert but used as Record<string, unknown> everywhere else (merging, serializing, DB JSON column). Changed to Record<string, unknown> to match the actual contract.

Missing config files

Added .nvmrc, .firebaserc, and .env.firebase.example under apps/me/ — these were referenced in the README but absent from the repo.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: taterhead247 <26818765+taterhead247@users.noreply.github.com>
Copilot AI changed the title [WIP] Add initial setup for apps/me profile manager Fix input validation, type safety, and missing config files in apps/me Mar 13, 2026
Copilot AI requested a review from taterhead247 March 13, 2026 11:39
@taterhead247 taterhead247 marked this pull request as ready for review March 13, 2026 19:03
@taterhead247 taterhead247 merged commit fb9de4b into feat/me Mar 13, 2026
11 of 12 checks passed
@taterhead247 taterhead247 deleted the copilot/sub-pr-163 branch March 13, 2026 19:08
pstaylor-patrick pushed a commit that referenced this pull request Apr 9, 2026
#177)

* Initial plan

* Fix validation, type safety, and add missing config files in apps/me

Co-authored-by: taterhead247 <26818765+taterhead247@users.noreply.github.com>

* improved test that this sub-pr broke

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: taterhead247 <26818765+taterhead247@users.noreply.github.com>
Co-authored-by: Tackle <damon.vinciguerra@gmail.com>
pstaylor-patrick pushed a commit that referenced this pull request Apr 9, 2026
#177)

* Initial plan

* Fix validation, type safety, and add missing config files in apps/me

Co-authored-by: taterhead247 <26818765+taterhead247@users.noreply.github.com>

* improved test that this sub-pr broke

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: taterhead247 <26818765+taterhead247@users.noreply.github.com>
Co-authored-by: Tackle <damon.vinciguerra@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

2 participants