Skip to content

Backend runtime hardening rebased#17

Closed
CherryCIC wants to merge 2 commits intomainfrom
codex/backend-runtime-hardening-rebased
Closed

Backend runtime hardening rebased#17
CherryCIC wants to merge 2 commits intomainfrom
codex/backend-runtime-hardening-rebased

Conversation

@CherryCIC
Copy link
Copy Markdown
Contributor

Strengthens cherry’s backend checkout foundations by tightening Stripe and Sendcloud safety, making non-production shipping mock-first, and enforcing clearer order and fulfilment contracts.

This PR fixes Stripe webhook verification, adds raw-body handling, introduces mock versus live shipping providers, supports Sendcloud service-point flows, verifies Sendcloud webhook signatures, rejects stale shipment updates, improves order lookup and validation, and adds focused tests for the new runtime safeguards.

@CherryCIC CherryCIC changed the title Codex/backend runtime hardening rebased Backend runtime hardening rebased Mar 18, 2026
Copy link
Copy Markdown

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

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: 080b098d97

ℹ️ 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 on lines +79 to +83
if (value.deliveryMethod === 'pickup_point') {
if (!value.courier) {
return helpers.error('any.custom', {
message:
'"courier" is required when "deliveryMethod" is "pickup_point"',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require shipping details for pickup_point orders

This branch now accepts deliveryMethod: "pickup_point" as long as courier and pickupPointId are present, but createShipment still rejects any order without order.shipping and immediately dereferences order.shipping.address when it builds the Sendcloud payload in src/modules/shipping/controllers/shippingController.ts. In other words, a client that follows the new checkout contract can create pickup-point orders that can never be fulfilled later via /api/shipping/shipment.

Useful? React with 👍 / 👎.

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.

We'll want to fix this one

Comment on lines +119 to +120
async getParcel(parcelId: number): Promise<SendcloudParcel> {
return createMockParcel(parcelId, 'Mock Carrier');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid resetting shipment status to announced in mock mode

In the new non-production default (src/shared/config/sendcloudConfig.ts resolves to mock outside production), getShipmentStatus still overwrites the stored shipment with shippingProvider.getParcel() on every read. Because this mock implementation always returns an Announced parcel, any shipment that was cancelled locally or advanced by handleSendcloudWebhook will be reverted back to announced the next time /api/shipping/shipment/:orderId is fetched.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

@MattGoodwin0 MattGoodwin0 left a comment

Choose a reason for hiding this comment

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

I'd pick up the codex change and just review the firebase config - if that project is setup then all good.

Comment on lines +79 to +83
if (value.deliveryMethod === 'pickup_point') {
if (!value.courier) {
return helpers.error('any.custom', {
message:
'"courier" is required when "deliveryMethod" is "pickup_point"',
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.

We'll want to fix this one

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.

This will be an issue if cherry-test-project is not configured, I'd probably pull this out if it's not

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.

3 participants