feat(swap-service): unified affiliate registration#42
Conversation
Aligns with the dashboard/public-api validation: lowercase a-z and digits only, 3-32 characters, no hyphens or mixed case. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds ShapeShift brand terms (shapeshift, shape, fox, shapeshiftdao) and internal/technical reserved names (root, system, support, dev, staging, prod, www, login, etc.) to prevent collision and impersonation. Existing entries preserved. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…lper Drops the account-impersonation entries (login/signin/support/etc.) that don't match the actual threat model — partner codes aren't shown as a trust signal anywhere user-facing. Keeps brand short forms and dev/protocol names. Adds an isReservedPartnerCode helper with a substring match list seeded with "shapeshift" to block codes like "myshapeshift" or "shapeshift-airdrop". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 1 minute and 50 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Narrows the exact-match list to envs (dev/develop/staging? prod/production/release/qa? trimmed by user), brand short forms, and a few system terms. Substring list keeps "shapeshift". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
96d48fc to
3b751b0
Compare
Description
POST /v1/affiliatenow requirespartnerCodeandbpsand enforcesRESERVED_PARTNER_CODES(previously bypassable via this endpoint).POST /v1/affiliate/claim-coderoute andAffiliateService.claimPartnerCodeare deleted. The matching dashboard/gateway changes ship in a separate web PR that must merge before this one (deploy order matters so the gateway never proxies to a 404).PARTNER_CODE_REGEXtightened to/^[a-z0-9]{3,32}$/— lowercase letters/digits only, no hyphens or mixed case.isReservedPartnerCodehelper supports exact-match against a focused brand + env list and substring match forshapeshift(catchesmyshapeshift,shapeshift-airdrop, etc.).AffiliateService.createAffiliate(happy path, duplicate wallet, reserved code, taken code).partner_code IS NULLare left as-is; no backfill, no admin claim path.Testing
yarn workspace @shapeshift/swap-service testpasses (4 new affiliate.service tests).POST /v1/affiliate/claim-codereturns 404.POST /v1/affiliatemissingpartnerCodeorbpsreturns 400 with class-validator messages.admin,myshapeshift) returns 400 with"This partner code is reserved"."Partner code already taken"."Affiliate already registered".partner_code IS NULLare unaffected.