Skip to content

✨ server: add signup ip to sardine - #1175

Open
aguxez wants to merge 1 commit into
mainfrom
sardine-ip
Open

✨ server: add signup ip to sardine#1175
aguxez wants to merge 1 commit into
mainfrom
sardine-ip

Conversation

@aguxez

@aguxez aguxez commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Send DigitalOcean's do-connecting-ip value to Sardine during signup.
  • Validate IPv4 and IPv6 values at the registration boundary.
  • Omit missing or malformed values and keep issue server: track auth method on sardine #1173 out of scope.

Verification

  • TypeScript passed.
  • ESLint passed.
  • Private harness tests passed.
  • Harness check passed.
  • git diff --check passed.
  • Focused Vitest was blocked by PostgreSQL initialization before test discovery.

Summary by CodeRabbit

  • New Features

    • Registration now reads the connecting IP address and includes valid IPv4 or IPv6 addresses in account device details.
  • Bug Fixes

    • Registration continues normally when the address is missing or invalid, without including a device IP.
  • Tests

    • Expanded WebAuthn signup coverage for IPv4, IPv6, and invalid addresses, with stricter payload validation.

@changeset-bot

changeset-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: cc931c6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 9921b6e6-98a4-4f57-9944-65ac01251ba0

📥 Commits

Reviewing files that changed from the base of the PR and between 2436403 and cc931c6.

📒 Files selected for processing (4)
  • server/api/auth/registration.ts
  • server/test/api/auth.test.ts
  • server/utils/createCredential.ts
  • server/utils/sardine.ts

Walkthrough

Registration validates the do-connecting-ip header and passes valid IPs into Sardine customer data as device.ip. Invalid or missing IPs omit device data. Tests cover IPv4, IPv6, and invalid values.

Changes

Registration IP propagation

Layer / File(s) Summary
IP validation contract
server/utils/sardine.ts
Adds branded IpAddress and IpAddressHeader schemas. Uses IpAddress for Sardine device.ip validation.
Registration IP propagation
server/api/auth/registration.ts, server/utils/createCredential.ts
Validates do-connecting-ip, passes valid values to createCredential, and conditionally adds device.ip to the customer payload.
Registration payload coverage
server/test/api/auth.test.ts
Tests IPv4 and IPv6 propagation, invalid IP omission, and exact customer payload matching.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RegistrationPOST
  participant createCredential
  participant SardineCustomer
  RegistrationPOST->>RegistrationPOST: Validate do-connecting-ip with IpAddressHeader
  RegistrationPOST->>createCredential: Pass validated ip
  createCredential->>SardineCustomer: Include device.ip when ip exists
Loading

Possibly related PRs

  • exactly/exa#674: Modifies createCredential and the registration flow to pass request metadata into Sardine.

Suggested reviewers: nfmelendez, cruzdanilo

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes forwarding signup IP data to Sardine, which is the main change.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sardine-ip
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch sardine-ip

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
1177 1 1176 1
View the top 3 failed test(s) by shortest run time
test/utils/maturity.test.ts > worker > does not duplicate queued reminders on planner retry
Stack Traces | 0.0444s run time
Error: Failed query: insert into "credentials" ("id", "public_key", "factory", "account", "transports", "kyc_id", "panda_id", "bridge_id", "source") values ($1, $2, $3, $4, $5, $6, $7, $8, $9), ($10, $11, $12, $13, $14, $15, $16, $17, $18)
params: maturity-test-0,,0x1234567890123456789012345678901234567890,0x1234567890123456789012345678901234567890,,,,,,maturity-test-1,,0x1234567890123456789012345678901234567891,0x1234567890123456789012345678901234567891,,,,,
 ❯ NodePgPreparedQuery.queryWithCache ../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+pg@8.20.0_better-sqlite3@12.9.0_kysely@0.28.17_pg@8.20..../src/pg-core/session.ts:73:10
 ❯ test/utils/maturity.test.ts:559:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { query: 'insert into "credentials" ("id", "public_key", "factory", "account", "transports", "kyc_id", "panda_id", "bridge_id", "source") values ($1, $2, $3, $4, $5, $6, $7, $8, $9), ($10, $11, $12, $13, $14, $15, $16, $17, $18)', params: [ 'maturity-test-0', '<Uint8Array(0) ...>', '0x1234567890123456789012345678901234567890', '0x1234567890123456789012345678901234567890', null, null, null, null, null, 'maturity-test-1', '<Uint8Array(0) ...>', '0x1234567890123456789012345678901234567891', '0x1234567890123456789012345678901234567891', null, null, null, null, null ] }
Caused by: Caused by: error: duplicate key value violates unique constraint "account_index"
 ❯ ../node_modules/.pnpm/pg-pool@3.13.0_pg@8.20..../node_modules/pg-pool/index.js:45:11
 ❯ ../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+pg@8.20.0_better-sqlite3@12.9.0_kysely@0.28.17_pg@8.20..../drizzle-orm/node-postgres/session.js:113:20
 ❯ NodePgPreparedQuery.queryWithCache ../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+pg@8.20.0_better-sqlite3@12.9.0_kysely@0.28.17_pg@8.20..../drizzle-orm/pg-core/session.js:39:16
 ❯ test/utils/maturity.test.ts:559:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { length: 238, severity: 'ERROR', code: '23505', detail: 'Key (account)=(0x1234567890123456789012345678901234567891) already exists.', hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: 'public', table: 'credentials', dataType: undefined, constraint: 'account_index', file: 'nbtinsert.c', routine: '_bt_check_unique' }
test/api/auth.test.ts > registration > omits an invalid signup ip from Sardine
Stack Traces | 0.0512s run time
AssertionError: expected 500 to be 200 // Object.is equality

- Expected
+ Received

- 200
+ 500

 ❯ test/api/auth.test.ts:807:29
test/utils/maturity.test.ts > worker > processes delayed 24h planner jobs
Stack Traces | 1.76s run time
AssertionError: expected [ Job{ …(22) }, Job{ …(22) } ] to have a length of 1 but got 2

- Expected
+ Received

- 1
+ 2

 ❯ test/utils/maturity.test.ts:1043:40

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@aguxez
aguxez force-pushed the sardine-ip branch 2 times, most recently from 64aa6c1 to 7f48f96 Compare July 28, 2026 11:26

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ee30ca3f-92fc-4cc9-8ad1-02a2f2fdd6f5

📥 Commits

Reviewing files that changed from the base of the PR and between 64aa6c1 and 7f48f96.

📒 Files selected for processing (4)
  • server/api/auth/registration.ts
  • server/test/api/auth.test.ts
  • server/utils/createCredential.ts
  • server/utils/sardine.ts

Comment thread server/test/api/auth.test.ts
@aguxez
aguxez marked this pull request as ready for review July 28, 2026 12:07
@aguxez
aguxez requested a review from nfmelendez as a code owner July 28, 2026 12:07

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f48f96d61

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/api/auth/registration.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 92e2512405

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/api/auth/registration.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0bda1b8099

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/api/auth/registration.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bbaad629d9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/api/auth/registration.ts Outdated
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

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