mpp pay fails again against mppx >= 0.22: "MPP challenge changed after approval" (nonce renamed to _mpp_nonce)

Đang mở Phù hợp với người mới
#594 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
cli, payments

Hướng nghiên cứu

Issue đề cập đến comparableChallenge trong dist/cli.js và mô tả lỗi so sánh cùng cách xử lý dự kiến cho cả hai khóa nonce. Trước tiên, hãy tìm hàm đó và kiểm tra mã nguồn của repository cùng các bài kiểm tra liên quan đến việc so sánh challenge. Công việc hoàn tất khi các challenge chỉ khác nhau ở _mpp_nonce hoặc _mppx_nonce được so sánh là tương đương, còn các metadata khác như _mppx_scope vẫn có ý nghĩa.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

Follow-up to #486 / #490. mppx 0.22 renamed its per-issuance challenge nonce from _mppx_nonce to _mpp_nonce, so link-cli mpp pay again fails against every mppx ≥ 0.22 server after the spend request is approved:

{"code":"UNKNOWN","message":"MPP challenge changed after approval; refusing to use the approved payment credential"}

comparableChallenge (dist/cli.js in 1.7.0) only strips _mppx_nonce:

if (... && "_mppx_nonce" in meta2 && typeof meta2._mppx_nonce === "string" && ...) {
  const { _mppx_nonce, ...comparableMeta } = meta2;

A challenge from mppx 0.22.3 has an opaque like:

{"_mpp_nonce":"MQsWICM7nLh-Ux109mBnFg","_mppx_scope":"POST /v1/orders","reference":"11ffbbece2e30dd84678c64b48be062a"}

so the nonce stays in the comparison and two challenges for the same request never match.

Versions
  • @stripe/link-cli 1.7.0 (1.6.0 behaves the same)
  • mppx 0.22.3 server (stripe.spt(...) charge), Stripe test mode, --test
Steps to reproduce
  1. Serve an MPP endpoint with mppx ≥ 0.22 and a Stripe SPT charge.
  2. link-cli mpp pay <url> --method POST --data '<json>' --test --context "<…>"
  3. Approve the spend request in Link (it reaches approved).
  4. Run the returned _next.pay_argv. It fails with the error above.
Suggested fix

Drop both keys before comparing: _mpp_nonce, and _mppx_nonce for older servers. mppx does the same thing itself (internal/challengeMeta.js: nonceKey = '_mpp_nonce', plus legacyNonceKey = '_mppx_nonce', which it still ignores when comparing route metadata). Other _mppx_* keys such as _mppx_scope stay the same across issuances, so they're fine to keep in the comparison.

Ngôn ngữ chính
TypeScript
Star
918
Fork
184
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
42

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của stripe/link-cli

Tất cả issue của stripe/link-cli

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.