Skip to content

IDOR: GET /api/users/{user_id} leaks any user's email to any authenticated user #25

Closed

Description

@nazarli-shabnam

Summary

Any authenticated user can fetch any other user's profile — including their email address and verification status — by guessing or observing their UUID. There is no check that the requester shares a workspace with the target user, or that the target is even discoverable to them.

Details

  • File: api/app/app/modules/users/router.py
  • Lines: 36–47
@router.get("/{user_id}", response_model=UserResponse)
def get_user(
    user_id: UUID,
    db: Session = Depends(get_db),
    current_user: User = Depends(get_current_user),
) -> UserResponse:
    user = get_user_by_id(db, user_id)
    if not user:
        raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="User not found")
    return to_user_response(user)

The only authorization check is get_current_user (i.e. "is logged in as someone"). There is no comparison against current_user.id, and no check that user_id shares a workspace with current_user.

UserResponse (api/app/app/modules/users/schemas.py:22-33) includes:

class UserResponse(BaseModel):
    id: UUID
    email: str
    username: str
    ...
    email_verified: bool = False

So the response leaks the target's email address and whether it's verified.

Impact

Any authenticated user (including a newly self-registered one) can enumerate other users' email addresses given only their UUIDs — which are visible in board owner fields, comment authors, workspace member lists, etc. This is a straightforward PII-harvesting vector and a step toward more targeted attacks (e.g. combined with the OAuth account-linking issue).

Fix

  • Add an authorization check: only allow returning full UserResponse (with email) when user_id == current_user.id.
  • For other users, either:
    • Require that current_user shares at least one workspace with user_id, and/or
    • Return a reduced public profile shape without email/email_verified (e.g. id, username, display_name, avatar_url only).

Acceptance criteria

  • GET /api/users/{user_id} no longer returns another user's email/email_verified unless the requester shares a workspace with them (or a reduced public shape is used for cross-workspace lookups)
  • Regression test: user A (no shared workspace with user B) cannot retrieve user B's email via this endpoint

Activity

  1. SankeerthNara commented on Jul 10, 2026

    @SankeerthNara
    Contributor

    Could you assign this to me

  2. nazarli-shabnam commented on Jul 10, 2026

    @nazarli-shabnam
    MemberAuthor

    Good luck working on the issue @SankeerthNara !

  3. added 2 commits that reference this issue on Jul 10, 2026
    b724b6f
    d6e3f1d
  4. added a commit that references this issue on Jul 10, 2026
    012352d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

APIVulnerabilitybug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions