Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

mpp pay always fails against mppx >= 0.15 servers: "MPP challenge changed after approval" (per-challenge nonce in opaque is not excluded from the comparison)

オープン
#486 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@staubman-stripe がすでに取り組んでいます。

2026年10月27日 から。

  • #490 @staubman-stripe による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
node.js, typescript
領域
cli, payments

調査の方向性

Start in comparableChallenge in link-cli, which the issue identifies as neutralizing id and expires before the approved challenge is compared with a fresh probe. Read the challenge serialization and approval comparison flow, including payPinnedChallengeWithSpt and runMppPayFullFlow. Reproduce with an mppx 0.15 server and verify the same approved payment succeeds when only issuance metadata differs.

索引モデルが issue の本文から書いたものです。

説明

Summary

Against a seller using mppx 0.15.0 (Stripe SPT charge), link-cli mpp pay can never complete a payment. After the spend request is approved, link-cli re-probes the endpoint and compares the fresh 402 challenge to the approved one. mppx adds fresh random issuance metadata (_mppx_nonce) to every challenge's opaque field by design, so the comparison always fails:

Error: MPP challenge changed after approval; refusing to use the approved payment credential

The amount, currency, realm, method, intent, request, and description are identical between the two challenges. Only id, expires, and the nonce in opaque differ.

Versions
  • @stripe/link-cli 0.30.0
  • mppx 0.15.0 (server: Mppx from mppx/server/core with stripe.spt(...) from mppx/stripe/server/spt)
  • Node.js 20 and 24, Stripe test mode, --test
Steps to reproduce
  1. Run an MPP endpoint with mppx 0.15.0 and a Stripe SPT charge, for example mppx.charge({ amount: '0.75', currency: 'usd', decimals: 2 })(request).
  2. link-cli mpp pay <url> --method POST --data '<json>' --test --context "<100+ chars>"
  3. Approve the spend request in Link.
  4. Run the returned _next.pay_argv (mpp pay <url> --spend-request-id <id> --approved-challenge '<challenge>' ...).
  5. It fails with the error above. The interactive (TTY) flow fails the same way, because runMppPayFullFlow also ends in payPinnedChallengeWithSpt(probe, spt, approvedChallenge).
Cause

comparableChallenge in link-cli only neutralizes id and expires:

function comparableChallenge(challenge) {
  return Challenge2.serialize({ ...challenge, id: "approval-comparison", expires: void 0 });
}

mppx adds a fresh nonce to every issued challenge (server/internal/challengeMeta.js):

/** Reserved metadata key for HMAC-bound, per-issuance challenge randomness. */
const nonceKey = '_mppx_nonce';
export function withNonce(meta) { return { ...meta, [nonceKey]: Secp256k1.randomPrivateKey() }; }

/** Removes issuance-only metadata when comparing stable route requirements. */
export function routeMeta(meta) { const { [nonceKey]: _, ...rest } = meta ?? {}; ... }

withNonce is applied in server/Mppx.js when challenges are created, so two challenges for the same route are never byte-identical. mppx's own routeMeta() shows the intended comparison: strip _mppx_nonce.

Suggested fix

In comparableChallenge, also drop issuance-only metadata from opaque, specifically the _mppx_nonce key, mirroring mppx's routeMeta(). Alternatively, compare only the fields the shopper actually approved (realm, method, intent, decoded request: amount, currency, network ID, external ID).

Workaround

The approved token itself is valid. Retrieving it with spend-request retrieve <id> --include shared_payment_token and paying a fresh challenge with the mppx client (stripe.charge({ createToken: () => spt })) succeeds. The SPT's own limits (amount, network ID, expiry) still apply.

主要言語
TypeScript
スター
873
フォーク
147
平均マージ
23時間 53分
マージ済み PR(30日)
76

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

stripe/link-cli のほかの issue

stripe/link-cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。