Repository navigation
fix(affiliate): scope signed login and consume nonces once - #70
Draft
0xApotheosis wants to merge 1 commit into
Draft
0xApotheosis wants to merge 1 commit into
0xApotheosis wants to merge 1 commit into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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 |
This branch has not been deployed
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.
Description
Accept affiliate login signatures only for the configured dashboard origin, expected statement and Arbitrum chain. Store challenges in PostgreSQL and consume them atomically so a nonce cannot be redeemed twice across service replicas.
Issue and verify JWTs with a dedicated issuer, audience and algorithm. Existing unscoped tokens no longer authorize affiliate changes.
What this affects
Affiliate dashboard wallet sign-in and protected affiliate-settings changes in swap-service. It is the affiliate administrator's signed login, not a new login requirement for ordinary ShapeShift users or device notification profiles. Existing affiliate sessions must sign in again.
Risk
High: changes affiliate login and requires a database migration. Existing sessions will need to sign in again. The policy intentionally matches the current dashboard message and chain 42161.
Deployment and QA environment
Pre-merge: Engineering deploys swap-service from this PR to an isolated Railway microservices QA environment, applies the
siwe_noncesPostgreSQL migration, and configuresSIWE_ALLOWED_ORIGINSfor the exact test dashboard origin. Replicas must share the same test database. The current Railway project has develop/production environments, not a verified per-PR preview.Build a test affiliate dashboard with
VITE_API_URLpointing at that swap-service and post its URL. Dashboard preview hosting was not verified, so this PR does not assume an automatic preview exists. The existing dashboard UI is sufficient; no dashboard code change is required. Prepare a registered test affiliate account and safe original/replacement settings for Operations.Release: Apply the migration and configure the production dashboard origin before deploying swap-service. Repeat the sign-in/settings smoke test against the intended production dashboard after deployment. Explain the required re-login to affiliate operators. There is no native app or main trading-app release dependency.
QA handoff: Environment inventory was checked on 9 October 2026. Before Operations starts, Engineering posts the exact app/install links, deployed commit/build numbers, test fixtures and readiness confirmation in this PR. Operations records the browser/device, steps passed/failed and screenshots of failures. Environment preparation and tests described here are a plan, not a claim that deployment or live QA has already happened.
Testing
Engineering
Validated locally: 11 signature/policy/replay/JWT tests, TypeScript, changed-source lint and Prisma schema validation passed.
With Node 22 and Yarn 4:
The tests use real signatures with mocked nonce persistence. Run the following against a disposable PostgreSQL database and two service replicas.
Integration/security checks — Engineering
The checks below require service configuration, API tools or backend observation. Engineering owns them; the click-through Operations checklist follows. Any environment setup mentioned here must follow the deployment plan above.
SIWE_ALLOWED_ORIGINSto the exact dashboard origin. Sign in from that dashboard and confirm the authenticated account can load and update its own affiliate settings using test values.Operations
Open: Engineering's test affiliate dashboard, using the supplied registered test wallet and settings values.
Pass: A valid affiliate can sign in and manage its own test settings; an old session cannot silently keep authorization. Engineering covers forged signatures, other origins/chains and concurrent nonce replay.