fix: block referral farming via disposable accounts (Closes #636)#638
Merged
indresh404 merged 2 commits intoJul 22, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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 this fixes
Closes #636
The referral system credited +100 points the moment any new user signed up with a referral code, with no check on whether the new account was a real, distinct person. This let a user create disposable GitHub accounts and farm their own referral link indefinitely.
Changes
refereeIsLegitimate()— requires the referee's own account to be ≥30 days old (measured from their GitHub account creation date) and have at least 1 public repo or follower, before any referral point credit is allowed.githubCreatedAt,githubPublicRepos,githubFollowers, and a derivedgithubAccountAgeAtSignupDaysat signup, so the rule above has something to check.get()a document written earlier in the same transaction.Testing
I don't have deploy access to the project's live Firebase instance, so I wasn't able to test this against the real database — the logic has been reasoned through carefully but hasn't been runtime-verified. Would appreciate a maintainer test before merge.
Note
A more robust fix (server-side validation via a Cloud Function, potentially with signup-IP correlation) was considered but the project doesn't currently have any Cloud Functions or admin backend infrastructure set up, so this PR uses a rules-only approach that needed no new infrastructure.