Fix input validation and meta type alignment in apps/me API routes#178
Closed
Fix input validation and meta type alignment in apps/me API routes#178
Conversation
Open
Co-authored-by: taterhead247 <26818765+taterhead247@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add initial setup for F3 Me profile manager app
Fix input validation and meta type alignment in apps/me API routes
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Falsy checks on numeric IDs silently rejected
0as invalid, andformData.get("file")was cast without a type guard.UserUpsert.metawas typed asstringdespite the DB column being a JSON type.Changes
roles/route.ts&positions/route.ts: Replace!body.orgId/!body.positionIdfalsy checks with explicit== null+typeof === "number"guards:avatar/route.ts: Replace unsafeas File | nullcast with aninstanceof Fileruntime guard — a string value fromformData.get()now returns a 400 before any file methods are called. Also corrects the stale error message that listedgifas an allowed type.types.ts: ChangeUserUpsert.metafromstringtoRecord<string, unknown>to match the DB JSON column (json().$type<UserMeta>()) and eliminate the type mismatch throughout the app.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.