Skip to content

Conversation

@wangsijie
Copy link
Contributor

resolved #7944

Summary

Add client IP address to passwordless connector message payload.

The SendMessageData type now includes an optional ip field that contains the client IP address of the user who triggered the message. This can be used by HTTP email/SMS connectors for rate limiting, fraud detection, or logging purposes.

Testing

Local tested & integration tests.

Checklist

  • .changeset
  • unit tests
  • integration tests
  • necessary TSDoc comments

Copilot AI review requested due to automatic review settings December 11, 2025 07:54
@github-actions github-actions bot added the feature Cool stuff label Dec 11, 2025
@github-actions
Copy link

github-actions bot commented Dec 11, 2025

COMPARE TO master

Total Size Diff 📈 +5.1 KB

Diff by File
Name Diff
.changeset/warm-lizards-swim.md 📈 +438 Bytes
packages/connectors/connector-http-email/src/index.test.ts 📈 +1.38 KB
packages/connectors/connector-http-email/src/index.ts 📈 +33 Bytes
packages/connectors/connector-http-sms/src/index.test.ts 📈 +1.37 KB
packages/connectors/connector-http-sms/src/index.ts 📈 +33 Bytes
packages/core/src/libraries/organization-invitation.ts 📈 +121 Bytes
packages/core/src/libraries/passcode.test.ts 📈 +1011 Bytes
packages/core/src/libraries/passcode.ts 📈 +183 Bytes
packages/core/src/routes-me/verification-code.ts 📈 +28 Bytes
packages/core/src/routes/connector/config-testing.test.ts 📈 +68 Bytes
packages/core/src/routes/connector/config-testing.ts 📈 +30 Bytes
packages/core/src/routes/interaction/additional.ts 📈 +30 Bytes
packages/core/src/routes/interaction/utils/verification-code-validation.ts 📈 +97 Bytes
packages/core/src/routes/organization-invitation/index.ts 📈 +70 Bytes
packages/core/src/routes/verification-code.ts 📈 +24 Bytes
packages/toolkit/connector-kit/src/types/passwordless.ts 📈 +243 Bytes

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds client IP address support to the passwordless connector message payload to enable rate limiting, fraud detection, and logging capabilities for HTTP email/SMS connectors.

Key Changes:

  • Added optional ip field to SendMessageData type with proper documentation
  • Updated all verification code and organization invitation flows to propagate client IP
  • Added comprehensive test coverage for IP propagation in both libraries and connectors

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/toolkit/connector-kit/src/types/passwordless.ts Adds optional ip field to SendMessageData type and its Zod validator with TSDoc
packages/core/src/routes/verification-code.ts Passes ctx.request.ip to sendPasscode for management API verification codes
packages/core/src/routes/organization-invitation/index.ts Propagates IP to organization invitation insert and sendEmail methods
packages/core/src/routes/interaction/utils/verification-code-validation.ts Updates verification code validation to accept and pass IP to sendPasscode
packages/core/src/routes/interaction/additional.ts Extracts and passes client IP from request context to verification code sender
packages/core/src/routes/connector/config-testing.ts Includes IP in connector configuration test messages
packages/core/src/routes-me/verification-code.ts Passes IP to sendPasscode for authenticated user verification codes
packages/core/src/libraries/passcode.ts Extracts IP from context payload and conditionally includes it in sendMessage call
packages/core/src/libraries/passcode.test.ts Adds test cases verifying IP is correctly included when provided and omitted when not
packages/core/src/libraries/organization-invitation.ts Updates insert and sendEmail methods to accept and propagate IP parameter
packages/connectors/connector-http-sms/src/index.ts Extracts IP from message data and conditionally includes it in HTTP request payload
packages/connectors/connector-http-sms/src/index.test.ts Tests IP inclusion in requests when provided and omission when not provided
packages/connectors/connector-http-email/src/index.ts Extracts IP from message data and conditionally includes it in HTTP request payload
packages/connectors/connector-http-email/src/index.test.ts Tests IP inclusion in requests when provided and omission when not provided
.changeset/warm-lizards-swim.md Documents the feature addition for the changelog

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@wangsijie wangsijie force-pushed the wangsijie-send-message-ip branch from 842fb13 to 4ed9d71 Compare December 11, 2025 13:57
@github-actions github-actions bot added size/m and removed size/m labels Dec 11, 2025
to,
type,
payload,
...(ip && { ip }),
Copy link
Member

Choose a reason for hiding this comment

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

nit: Should we put it in the message payload?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

payload contains data that are used in the template, but ip is not, so I think it is better to be in top-level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

feature request: Include client IP address in HTTP SMS connector payload

3 participants