Skip to content

Prevent client-controlled privileged role on registration#629

Open
sathwikhbhat wants to merge 1 commit into
viru0909-dev:mainfrom
sathwikhbhat:fix/auth-restrict-client-role
Open

Prevent client-controlled privileged role on registration#629
sathwikhbhat wants to merge 1 commit into
viru0909-dev:mainfrom
sathwikhbhat:fix/auth-restrict-client-role

Conversation

@sathwikhbhat
Copy link
Copy Markdown

Pull Request

Description

Fix a privilege escalation issue in public registration by preventing clients from choosing privileged backend roles. The register endpoint now treats incoming roles as untrusted and defaults public signups to LITIGANT rather than allowing ADMIN, TECH_ADMIN, or other elevated roles.

Closes #628

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copilot AI review requested due to automatic review settings May 25, 2026 12:06
@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 2026

@sathwikhbhat is attempting to deploy a commit to the CodeBlooded's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR tightens role handling during user registration by sanitizing/overriding client-supplied roles and simplifying the role passed into authService.register().

Changes:

  • Added server-side override logic to default role to LITIGANT when missing or invalid.
  • Removed the inline req.getRole() != null ? ... : ... defaulting when calling authService.register().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nyaysetu Ready Ready Preview, Comment May 26, 2026 5:03am

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.

[SECURITY]: /register accepts client-controlled role (creates admin accounts)

2 participants