Fix unauthenticated community auto-join impersonation - #60
Draft
cursor[bot] wants to merge 1 commit into
Draft
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Unauthenticated POSTs could overwrite another user's communityMembers doc (name, email, photo) and grant Founder karma by spoofing FOUNDER_EMAIL in the body. Require a matching Bearer token and derive founder status from the verified token, not client-supplied email. Co-authored-by: Andy Oliver Rozario <andyrozario7@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
POST /api/community/members/auto-joincan no longer create or overwritecommunityMembers/{userId}using a body-supplied uid, name, email, or photo.FOUNDER_EMAIL.Why this change is safe
Root cause: the route used Firebase Admin with no
verifyUserRequest.GET /api/community/membersalready returns memberuserIds, so an attacker can overwrite another member's display identity or mint a Founder row by postingemail: <FOUNDER_EMAIL>.This is not a duplicate of open #24–#48 / #53 / #56–#59 (billing, report caches, Stage B, Seer empty-question billing, on-demand persist).
Verification
pnpm exec eslinton touched files (0 errors; pre-existing warnings only)pnpm test— 70 suites / 385 tests passed, including newtests/integration/community-auto-join-auth.test.tspnpm run securitypassed (audit + security lint)Playwright smoke is unchanged: this is an API ownership fix plus a Bearer header on an existing community fetch. E2E in CI still covers unauthenticated landing/tools smoke only.
Regression prevention
New tests lock in: missing token → 401 (no write); mismatched
userId→ 403 (no overwrite); spoofed founder email on own uid → no Founder karma grant; matching token still updates the member.Release checklist (solo-friendly)
CI / Lint + JestCI / Playwright smokemain.