Skip to content

feat: incoming message origin validation for react native - #477

Closed
michaeljsXu wants to merge 6 commits into
mainfrom
07-15-feat_incoming_message_origin_validation_for_react_native
Closed

feat: incoming message origin validation for react native#477
michaeljsXu wants to merge 6 commits into
mainfrom
07-15-feat_incoming_message_origin_validation_for_react_native

Conversation

@michaeljsXu

@michaeljsXu michaeljsXu commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

What changes are you making?

Expose allowedMessageOrigins and a typed onMessageRejected callback through the React Native API. The callback remains in JavaScript while serializable configuration crosses the native bridge, supports replacement and removal, and is cleaned up by teardown().

Both native bridges emit the same {origin, message, reason} payload, and getConfig() round-trips configured origins and the current JavaScript callback.

How to test

From platforms/react-native:

pnpm test modules/@shopify/checkout-kit-react-native/tests/index.test.ts --runInBand
pnpm module typecheck
pnpm module api:dump

@github-actions github-actions Bot added the #gsd:50662 Rebase Checkout Kit on UCP label Jul 15, 2026

michaeljsXu commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_ios branch from 4fc84ea to 3d231ce Compare July 31, 2026 11:43
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_react_native branch 2 times, most recently from a5483f8 to f5614eb Compare July 31, 2026 13:16
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_ios branch 2 times, most recently from f3cbfbc to a23236f Compare July 31, 2026 13:41
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_react_native branch from f5614eb to 3be5ff9 Compare July 31, 2026 13:41
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_ios branch from a23236f to 7a8303d Compare August 3, 2026 11:55
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_react_native branch from 3be5ff9 to 3c1706a Compare August 3, 2026 11:55
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_ios branch from 7a8303d to 194c4cb Compare August 3, 2026 12:12
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_react_native branch from 3c1706a to 336928d Compare August 3, 2026 12:12
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_ios branch from 194c4cb to 9b666d9 Compare August 3, 2026 12:16
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_react_native branch from 336928d to 6032726 Compare August 3, 2026 12:16
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_ios branch from 9b666d9 to a989701 Compare August 3, 2026 14:42
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_react_native branch 2 times, most recently from c05fb85 to eb60315 Compare August 3, 2026 15:40
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_ios branch from a989701 to 3f57e0a Compare August 3, 2026 15:40
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_react_native branch from eb60315 to 1f34aef Compare August 3, 2026 15:43
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_ios branch from 3f57e0a to 11a49d2 Compare August 3, 2026 15:43
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_react_native branch from 1f34aef to 4b6d715 Compare August 4, 2026 11:45
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_ios branch 2 times, most recently from 3c28064 to 2110ba0 Compare August 5, 2026 10:27
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_react_native branch from 4b6d715 to 48ff991 Compare August 5, 2026 10:27
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_ios branch from 2110ba0 to c94b042 Compare August 5, 2026 12:44
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_react_native branch from 48ff991 to 5af0ce4 Compare August 5, 2026 12:44
Base automatically changed from 07-15-feat_incoming_message_origin_validation_for_ios to main August 5, 2026 13:31
@tiagocandido
tiagocandido force-pushed the 07-15-feat_incoming_message_origin_validation_for_react_native branch from 5af0ce4 to 4b14f6c Compare August 12, 2026 10:31
@tiagocandido
tiagocandido marked this pull request as ready for review August 12, 2026 11:57
@tiagocandido
tiagocandido requested a review from a team as a code owner August 12, 2026 11:57
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown

React Native — Coverage Report

Lines Statements Branches Functions
Coverage: 92%
92.06% (325/353) 89.62% (190/212) 100% (85/85)

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown

Package Size

Platform Artifact Base Head Delta
React Native npm tarball 101.6 KiB 103.6 KiB +2.1 KiB
React Native file breakdown
File Base Head Delta
node_modules/@shopify/checkout-kit-protocol/src/generated/Models.ts 85.4 KiB 85.4 KiB 0 B
node_modules/@shopify/checkout-kit-protocol/src/generated/Models.d.ts 53.0 KiB 53.0 KiB 0 B
ios/ShopifyCheckoutKit.swift 13.5 KiB 14.4 KiB +958 B
ios/AcceleratedCheckoutButtons.swift 14.1 KiB 14.1 KiB 0 B
android/src/main/java/com/shopify/reactnative/checkoutkit/ShopifyCheckoutKitModule.java 12.8 KiB 14.0 KiB +1.3 KiB
src/index.ts 12.2 KiB 13.6 KiB +1.4 KiB
lib/commonjs/index.js 12.3 KiB 13.5 KiB +1.2 KiB
src/components/AcceleratedCheckoutButtons.tsx 13.0 KiB 13.0 KiB 0 B
lib/commonjs/components/AcceleratedCheckoutButtons.js 11.4 KiB 11.4 KiB 0 B
lib/module/index.js 10.2 KiB 11.4 KiB +1.2 KiB
lib/commonjs/components/AcceleratedCheckoutButtons.js.map 10.4 KiB 10.4 KiB 0 B
lib/module/components/AcceleratedCheckoutButtons.js 10.2 KiB 10.2 KiB 0 B
src/index.d.ts 9.1 KiB 10.1 KiB +988 B
node_modules/@shopify/checkout-kit-protocol/src/generated/ProtocolNotifications.ts 9.5 KiB 9.5 KiB 0 B
lib/module/components/AcceleratedCheckoutButtons.js.map 9.1 KiB 9.1 KiB 0 B
lib/module/index.js.map 7.9 KiB 8.9 KiB +1.1 KiB
lib/commonjs/index.js.map 7.7 KiB 8.7 KiB +1.1 KiB
src/present-dispatcher.ts 8.0 KiB 8.0 KiB 0 B
node_modules/@shopify/checkout-kit-protocol/src/generated/ProtocolNotifications.d.ts 7.6 KiB 7.6 KiB 0 B
node_modules/@shopify/checkout-kit-protocol/src/generated/ProtocolRenameMap.ts 7.2 KiB 7.2 KiB 0 B
…and 110 smaller files

Measured from the PR base SHA and PR head SHA. The file breakdown shows uncompressed sizes within each package artifact, so individual files do not sum to the compressed artifact total. This comment reports package artifact sizes only; it is not a final app binary-size report.

@bitrise

bitrise Bot commented Aug 12, 2026

Copy link
Copy Markdown

Install this build

Open Tophat, select your target device, then click Install. Links open on the Mac running Tophat.

SDK Install
React Native Install with Tophat

Checkout Kit E2E results

Status Suite Target Platform OS version tag Device
tests/shared/launch-smoke.yaml react-native ios latest iPhone 15
iOS 27 Beta
tests/shared/launch-smoke.yaml react-native android latest Google Pixel 9
Android 17.0

@markmur markmur left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don’t think listener ownership should be encoded as checkout configuration. hasMessageRejectedCallback is bridge implementation state rather than checkout configuration, and coupling the two makes unrelated updates destructive.

The configuration behaviour is a little inconsistent in its current state. Omitting the title, preloading, or allowedMessageOrigins attributes preserve their current native values, while omitting onMessageRejected clears it.

Could we manage the event bridge through a dedicated lifecycle method instead?

RNShopifyCheckoutKit.setMessageRejectedListenerEnabled(true);

@tiagocandido

Copy link
Copy Markdown
Contributor

Closing in favor of #648, which ships the origins passthrough without the rejection callback — we settled on warn-level logging instead of onMessageRejected (removed from the native SDKs in #646/#647 before it shipped in a stable release).

tiagocandido added a commit that referenced this pull request Aug 17, 2026
### What changes are you making?

Expose `allowedMessageOrigins` through the React Native configuration and round-trip it across both native bridges. Rejections are logged as warnings by the native SDKs (#646, #647); there is no JavaScript callback.

Bumps the native SDK pins to `4.0.0-alpha.5` — the first release with warn-level rejection logging and without `onMessageRejected` — and regenerates both Podfile.locks against the published pods.

Replaces #477.

### How to test

From `platforms/react-native`:

```sh
pnpm test modules/@shopify/checkout-kit-react-native/tests/index.test.ts --runInBand
pnpm module typecheck
pnpm module api:dump
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

#gsd:50662 Rebase Checkout Kit on UCP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants