Repository navigation
Conversation
…ption (SAP-5180)
Adyen secured fields encrypt the typed card in Adyen's iframes, so the
placeholder never appears in the payment request and cannot be relayed.
The interceptor now holds a JSON request carrying
paymentMethod.encryptedCardNumber (merchant /payments or Adyen
/sessions/{id}/payments), asks POST /v1/transactions/{id}/payment/adyen/encrypt
for the authorized card's own encrypted fields, swaps the four encrypted*
fields and continues the request. Client key: secured-field iframe URL,
else page config.
Gated by the backend: its adyen_encryption_not_enabled answer, a relay
without adyenEncrypt, or disableAdyenEncryption fail the payment closed
(adyen_not_enabled); the stand-in ciphertext is never sent. fillCard takes
the handle as `adyen` and types nothing on Adyen secured fields unless the
backend returned fields (used once for the payment).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d Adyen stand-in (SAP-5180)
- isAdyenNotEnabled compares case-insensitively: the backend sends
409 {"code":"ADYEN_ENCRYPTION_NOT_ENABLED"}, which surfaced as
adyen_encrypt. Contract test feeds that body verbatim through
httpPaymentRelay -> attachInterceptor -> fillCard.
- fillCard types Adyen's plain consumer test card for the card's brand
(visa 4111.., mastercard 5555 4444.., amex 3700..) into secured fields
instead of the placeholder number, whose random BIN can name a variant
Adyen refuses for the real card (109 Invalid variant). Missing or other
brand: blocked adyen_card_brand, backend not asked.
- prepareAdyen: a later answer drops earlier prepared fields, an older
call finishing last cannot restore them, and after detach it reports
adyen_not_enabled.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s budget its siblings have (SAP-5180) CI test (22.x) on 4f5cbfd hit Jest's 5s default on this Chromium test. Like the other tests in the suite, it now closes the shop's keep-alive sockets before close(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…M source names the same one (SAP-5180) The DOM fallback returned the first key it found, so a stale #clientKey or script literal could pick the key while a different one was also on the page. It now collects keys from every secured-field iframe src, #clientKey, data-client-key and each inline clientKey literal, and returns one only when they agree. An undecodable iframe key is skipped instead of failing the whole read. Keys may contain lower-case letters, as Adyen documents. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…yen's frames host (SAP-5180) A page with idle Adyen secured-field iframes and a visible native or other provider's card form got the brand's test card in that form, which the interceptor does not replace. The stand-in now goes only into number fields inside an Adyen secured-field frame; any other number field gets the card's own number. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and in-flight success (SAP-5180) A not-enabled answer from the backend now clears prepared fields for every client key and page origin, and bumps a denial count. A prepareAdyen whose success lands after any denial answers not enabled and stores nothing, so fillCard types nothing on a superseded prepare. Regressions: cross-key denial drops cached fields; superseded prepare answers disabled; fillCard racing a newer denial types nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (SAP-5180)
…twork requests (SAP-5180)
The interceptor records keys from https requests to exactly the
checkoutshopper test host or a live host (live, -us, -au, -apse, -in):
clientKey query, /securedfields/{key}/, /clientKeys/{key}, x-client-key.
It reads them from Network.requestWillBeSent, paused requests and
frame target URLs. test_ only from -test, live_ only from a live host.
Two distinct keys give none. The DOM fallback is deleted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…key before releasing a payment (SAP-5180) - Key bodies may be any letters and digits again; the env-to-host rule stays. - After re-encryption, a payment is released only if the attach still holds exactly the key it encrypted to; a second key seen meanwhile fails it closed with adyen_client_key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er a newer not-enabled answer (SAP-5180) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ent keys (SAP-5180) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ient key (SAP-5180) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…5180) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…en (SAP-5180) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… into ewan/sap-5180-browser-pay-adyen-result
…whose session detached (SAP-5180) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…(SAP-5180) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…5281)
After RedirectShopper, IdentifyShopper or ChallengeShopper, watch the
same origin's /payments/details (or /sessions/{id}/paymentDetails) answer
and report its resultCode through the existing result endpoint. The page's
request goes on unchanged; the SDK never drives the challenge.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…event (SAP-5180) The two result-report warnings called the caller's logger unguarded, so a throwing or rejecting logger skipped the adyen_result event and left an unhandled rejection. Route them through the same guard as logStepFailure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
detach() can close CDP while Fetch.getResponseBody is pending; the failed read then became an `unknown` report sent after detach() had returned. Skip the report once the interceptor is closed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…completion (SAP-5180) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…result' into ewan/sap-5281-adyen-3ds # Conflicts: # packages/browser-pay/README.md
…answer (SAP-5281) An Adyen error or non-JSON details answer is reported as `unknown`, which the backend refuses; dropping the origin then left a retried, final details call unreported. Only a final code ends the watch now. README: the final code is posted once per payment, an action code may come first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-5180) An answer already paused at the response stage was dropped when detach() started while its body was read or its continue acknowledgement was in transit, although the page received it. detach() now waits for those answers to reach the page and be reported before it disables Fetch, so the read is never cut short and the result is never lost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…281-adyen-3ds # Conflicts: # packages/browser-pay/README.md # packages/browser-pay/src/interceptor.ts
…nswer (SAP-5281) The watch for the page's details call was set only after the answer's Fetch.continueRequest returned. A details call that paused before that acknowledgement was continued without interceptResponse and its final result was never reported. Read the code and arm the watch first, then hand the answer to the page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t (SAP-5281)
The 3-D Secure watch was keyed by origin alone, so a details call from
another tab on that origin, or from another Adyen session on Adyen's
shared host, was reported for the held payment and could clear the watch
before the real result came. Key the watch by the tab's page session and
the checkout: the origin, plus the session id for /sessions/{id} calls.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…(SAP-5180) A second detach() returned at once while the first still waited on the Adyen result report, so a second Ctrl+C could close the browser first. Every call now shares one shutdown. A tab attached during that shutdown is resumed and released instead of waiting behind the report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Action not completed
|
…the ciphertexts (SAP-5348) One scan answers whether the relay can swap every ciphertext byte for byte: unescaping the body must leave each raw ciphertext whole and reveal no other. That replaces the hidden-hash set and closes the cases review found: - an escape after a ciphertext that extends it (\u0041, %41, %2E); - JSON escapes before a ciphertext (\n, \u0020) whose letters joined the run, now tokens of their own, so the ciphertext stays raw; - nesting deeper than eight layers: inspection runs to 32 and a body still encoded after that is refused, never sent on; - raw ciphertexts are masked in one pass, not one body scan per token. A body is an Adyen Pay candidate when it carries an observed ciphertext, or a ciphertext beside any of the four secured-field names. A field name alone, such as a validation message, no longer is. Synthetic stateData now carries a checkoutAttemptId, riskData and a dotted userAgent. The changeset names the relay prerequisite.
Contributor
Author
|
/devin review |
Contributor
Author
|
@coderabbitai review |
Contributor
Action not completed
|
…y encoded form values (SAP-5348) A Pay candidate is a body with an observed ciphertext, or one that gives any of the four secured fields a value as a JSON member or form field. A mention in text, such as a validation message, still continues; a non-JWE value is caught again, as the README promises. A percent escape of a percent escape (%2522) is one token, so a ciphertext after a doubly encoded quote stays raw and swappable.
…date too (SAP-5348)
…nd a JWE with an empty key (SAP-5348) Interrogate round 4: a form value with + for spaces, a bracketed form field and a multipart part named for a secured field were not Pay candidates, so a Pay with unobserved ciphertexts went on to the merchant. A direct-encryption JWE (empty encrypted key) was not a ciphertext, so an extra one rode along with the four observed.
…es the text changed (SAP-5348) Interrogate round 5. SECURED_FIELD now reads a secured name only as a key: a JSON member (bracketed or dotted too), a form field, or a multipart Content-Disposition name. A validation message that names a field, or holds name=, is not a Pay, and the scan is linear. A relayed body whose bytes were not UTF-8 is refused (unreadable_body) rather than relayed with replacement characters.
…ltipart header starts a line (SAP-5348) Interrogate round 4: a quoted name in a message is not a key; a bare form key counts as an empty field; the multipart header scan is linear.
…clock budget (SAP-5348)
ratataque
marked this pull request as ready for review
November 26, 2026 23:41
…escan blank lines for a secured field (SAP-5348) A replacement character the page really sent no longer reads as lost bytes: the entries' bytes come before Chrome's decoded postData, and only a decoding that changed them is refused. A secured-field key at a line start skips spaces on that line only, so a run of blank lines is scanned once.
…e; steadier growth tests (SAP-5348)
…and Unicode line separators (SAP-5348)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Browser Pay now recognises an Adyen secured-fields Pay in any body format, not only JSON with a top-level
paymentMethod.encryptedCardNumber. It finds the placeholder ciphertexts by hash wherever they sit in the raw body and sends the body to the relay byte for byte.paymentMethod.encrypted*EncryptedCardNumber, …datafield (JSON or urlencoded transport)dwfrm_adyPaydata_adyenStateData(also multipart)dwfrm_billing_creditCardFields_adyenStateDatadwfrm_billing_adyenPaymentFields_adyenStateDataThese formats were read from the merchants' page JS during live probes on 2026-11-24. Pay was never clicked on a real merchant, so they are inferred, not captured.
Why
The probes reached six Adyen Web card checkouts. Only one (Holland & Barrett) sends the shape Browser Pay recognised, so the other five would go on unrelayed and be declined. The goal is an Adyen checkout that works on the biggest Adyen merchants.
How to review
All the logic is in
detect.ts:BODY_TOKENSsplits the raw body into base64url-and-dot runs, with each percent or JSON escape as its own token. A ciphertext's bytes are the same in JSON, in JSON inside a string, in form encoding and in multipart, so each one is a raw token in every format above.compactJweTokenskeeps the runs that are five segments whose first segment decodes to a JWE header namingalgandenc. Hostnames, versions and ids are never taken for ciphertexts.scanBodyanswers one question: can the relay swap every ciphertext in place? Unescaping the body (JSON and percent escapes, layer by layer, up to 32 layers) must leave each raw ciphertext whole and reveal no other ciphertext, including in what is left once the raw copies are masked.adyenPayCandidate: the body carries an observed ciphertext, or a ciphertext next to one of the four secured-field names. A body still encoded after 32 layers counts as a candidate too, so it is refused rather than sent on.interceptor.tsdecide()keeps the gate order:unsupported_encrypted_checkout,adyen_client_key,destination_not_allowed. After those, the body must hold exactly the four observed ciphertexts, raw and swappable, elseadyen_placeholder_unobserved.Tests:
test/adyen-bodies.tsbuilds the synthetic bodies (shaped like stateData, with a checkoutAttemptId, riskData, a userAgent and a five-label returnUrl).interceptor.adyen.test.tsruns the relay and refusal matrix, anddetect.test.tscovers the escape cases.Visual change map, 11 scenes (review-only, not in the tree):
Risk & rollout
checkAdyenRequest,swappedBody) still JSON-parses the body and swaps at the top-levelpaymentMethodpointers. Until it swaps by hash on the raw body, every format except top-level JSON is refused there withcard_fields_invalid. That fails closed: no card data leaves, and the page request fails instead of going on with placeholder ciphertexts. A companion Sapiom branch that does this exists locally (ewan/sap-5180-adyen-any-format-relay). It isn't pushed: this follow-up is SDK-only. Before it ships it needs two more fixes:checkoutAttemptId(uuid + epoch ms + hex) sometimes holds a Luhn-valid digit run.safeWarn(Proof F2);hideCVC(I85U; no probed merchant needs it);@sapiom/browser-pay.Verification
packages/browser-pay:npx jest --maxWorkers=3, 12 suites, 373/373 passed, including the real-Chromium suites.tsc --noEmit,eslintandprettier --checkare clean.paymentMethod.brandto the vaulted card's brand, by design.)checkoutAttemptIdfalse positive above.Env vars used for the TEST run:
ADYEN_API_KEY,ADYEN_CLIENT_KEY,ADYEN_MERCHANT_ACCOUNTfrom~/.config/sapiom-dev/local.env, and Basis Theory TEST via~/.config/sapiom-dev/run.SAP-5348
Summary by CodeRabbit