Skip to content

fix: prevent mentees from self-approving via profileStatus (#727) - #760

Open
yingliu-data wants to merge 1 commit into
mainfrom
fix/727-mentee-self-approval
Open

fix: prevent mentees from self-approving via profileStatus (#727)#760
yingliu-data wants to merge 1 commit into
mainfrom
fix/727-mentee-self-approval

Conversation

@yingliu-data

Copy link
Copy Markdown

Summary

Fixes #727 — a mentee could set their own profileStatus (e.g. ACTIVE) through the public registration endpoint, bypassing the admin approval queue.

Mentee.profileStatus was deserialized from the request body. This PR marks it read-only for deserialization, mirroring the existing protection already present on MentorDto.profileStatus:

@JsonProperty(access = JsonProperty.Access.READ_ONLY)
private ProfileStatus profileStatus;

Jackson now ignores any client-supplied profileStatus, so the field arrives as null, and the mentee repository already defaults nullPENDING on insert and preserves the existing server-side status on update. No other changes are required.

Impact

  • New registrations are always created as PENDING and appear in the admin approval queue (GET /mentees/pending), regardless of what the client sends.
  • A previously REJECTED mentee can no longer reactivate themselves by resubmitting with "profileStatus": "ACTIVE" — the server-side status is preserved.

Verification

Tested locally end-to-end against a Postgres-backed instance:

Scenario Before After
Register with "profileStatus":"ACTIVE" stored as ACTIVE (self-approved) stored as PENDING
REJECTED mentee resubmits with ACTIVE flips back to ACTIVE stays REJECTED

Notes

Mark Mentee.profileStatus as read-only for deserialization so a client
cannot set or change their approval status through the public mentee
registration payload. Status is now managed server-side (defaults to
PENDING on creation, changed only via the admin approval flow),
mirroring the existing protection on MentorDto.

Closes #727
@vercel

vercel Bot commented Jul 4, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
platform-admin Ignored Ignored Jul 4, 2026 10:55am

@sonarqubecloud

sonarqubecloud Bot commented Jul 4, 2026

Copy link
Copy Markdown

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: Mentee can self-approve via profileStatus in public registration payload

1 participant