Skip to content

Fix: require valid admin secret when registering as admin - #1

Open
thuluxx wants to merge 1 commit into
10-Mohan:mainfrom
thuluxx:fix/admin-registration-privilege-escalation
Open

thuluxx wants to merge 1 commit into
10-Mohan:mainfrom
thuluxx:fix/admin-registration-privilege-escalation

Conversation

@thuluxx

@thuluxx thuluxx commented Sep 27, 2026

Copy link
Copy Markdown

The /register route destructured adminSecret from the request body and imported getAdminSecret, but never actually checked them — so any request with role: "admin" was granted admin privileges with no secret required.

This adds the missing check: registering with role: "admin" now requires a correct adminSecret matching getAdminSecret(), and returns 403 otherwise.

Verified manually:

Before the fix: role: "admin" alone → admin token issued
After the fix: no/wrong secret → 403 Invalid admin secret; correct secret → admin token issued as expected

Existing test suite (npm test) still passes.

@vercel

vercel Bot commented Sep 27, 2026

Copy link
Copy Markdown

@thuluxx is attempting to deploy a commit to the 10-mohan's projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

1 participant