Repository navigation
fix(sdk): prevent expired AuthFetch requests from dispatching after approval - #1043
Closed
BraydenLangley wants to merge 9 commits into
Closed
BraydenLangley wants to merge 9 commits into
BraydenLangley wants to merge 9 commits into
Conversation
AuthFetch starts its 30 second response timer and then awaits
Peer.toPeer, which can wait on wallet prompts (the handshake, then the
request signature). If the timer fired while a prompt was open, the
caller was rejected with "Timed out waiting for authenticated
response.", but approving the prompt afterwards still sent the request.
A side-effecting request (an issuance, a payment) could then succeed on
the server after the caller had handled it as failed.
Peer.toPeer takes an optional third argument, { signal, onSend }.
Once the signal is aborted, the message is never handed to the
transport: it is checked before the signature prompt and again with no
await between the check and transport.send. AuthFetch aborts it when
its deadline passes. onSend lets AuthFetch tell a request that was
never sent from one already handed to the transport; the latter now
rejects with "Timed out waiting for authenticated response. The request
was sent; its outcome is unknown." The old message stays a prefix.
Existing two-argument toPeer callers are unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
BraydenLangley
marked this pull request as ready for review
October 12, 2026 21:40
BraydenLangley
requested review from
sirdeggen,
tonesnotes and
ty-everett
as code owners
October 12, 2026 21:40
ty-everett
approved these changes
Oct 12, 2026
BraydenLangley
marked this pull request as draft
October 12, 2026 22:16
|
BraydenLangley
marked this pull request as ready for review
October 12, 2026 23:10
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.



Program and scope
Supersedes #721 and retains Mitch Burcham’s original commits. Fixes the reported late-dispatch bug: AuthFetch could reject at its existing 30-second deadline while awaiting wallet approval, then send the application request after the user approved. A side-effecting write could therefore succeed after the application had treated it as failed.
AuthFetch now aborts the pending application send when its existing deadline expires.
Peer.toPeerchecks that signal after asynchronous preparation and immediately before transport handoff. Existing main guards continue preventing certificate-queue dispatch and session recovery after expiry.Only
Peer.toPeerandAuthFetch.fetchchange at runtime. Existing timeout values and timer placement are preserved, including time spent approving wallet operations; dispatch does not restart the timer. There is no prompt detection, ten-minute allowance, transport refactor, new timeout setting, or caller cancellation support inAuthFetch.fetch.Exact source head:
da7e043ebbbb04d21446b3f9a2d0ab16bac867f7. Base main:86072f1f5b264ff7423257291f413678fdf2e663.Impact
@bsv/sdk, 3.3.0 minor candidate for the additive optional thirdPeer.toPeerargument{ signal, onSend }.Timed out waiting for authenticated response.and addrequestDispatched. False means the application request was never handed to the transport; true means its server-side outcome is unknown. Reconcile possibly dispatched writes before retrying.A per-message signal prevents application dispatch before handoff. It does not dismiss a wallet prompt, cancel an existing handshake, or recall an in-flight send. Expiring one request does not cancel other requests sharing the peer.
onSendis a synchronous dispatch observer, not confirmation of delivery.Verification
pnpm test:mutation --target sdk-auth-http: 89.36% (241 killed, 53 timeout, 35 survived), zero invalid and zero uncovered mutations; 300 property cases with seed 3242026. Source-bound report and execution digest retained.Security and dependencies
Release and operations
The existing maintainer approval is attached to the previous head
18693e8dd53080b3ac16842674b0a5cf177edf28. The narrowed headda7e043ebbbb04d21446b3f9a2d0ab16bac867f7is ready for fresh review before merge.