Skip to content

Fix: Restrict /api/users/search to admin role to prevent PII leak - #457

Open
builtbykabir wants to merge 1 commit into
LarytheLord:mainfrom
builtbykabir:449-data-leak
Open

Fix: Restrict /api/users/search to admin role to prevent PII leak#457
builtbykabir wants to merge 1 commit into
LarytheLord:mainfrom
builtbykabir:449-data-leak

Conversation

@builtbykabir

Copy link
Copy Markdown
Collaborator

Critical PII Data Leak in User Search (#449)

Closes #449

Changes Made

  1. Role-Based Access Lock:
    • Modified the GET route in app/api/users/search/route.ts to strictly require the admin role.
    • Previously, the endpoint allowed both adventurer and admin roles, which inadvertently exposed unmasked user emails to any authenticated adventurer on the platform.
  2. Preserved Administrative Functionality:
    • Instead of deleting the route entirely, the search functionality remains intact for future administrative features (e.g., moderation tools, user lookup panels, or support workflows).

Testing Notes

  • Adventurer Access: Verified that attempting to query /api/users/search as a standard logged-in adventurer (or company) immediately returns a 401 Unauthorized response.
  • Admin Access: Verified that authenticated administrators can still successfully query the endpoint and retrieve the expected JSON array of users.

@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@builtbykabir is attempting to deploy a commit to the larythelord's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

bug: Data Leak in User Search

1 participant