Skip to content

Internal agent bug fixes 1#1372

Merged
Ryang-21 merged 7 commits intomasterfrom
bug-fixes-1
Apr 3, 2026
Merged

Internal agent bug fixes 1#1372
Ryang-21 merged 7 commits intomasterfrom
bug-fixes-1

Conversation

@Ryang-21
Copy link
Copy Markdown
Contributor

@Ryang-21 Ryang-21 commented Apr 2, 2026

What

This fixes a collective of bugs documented here

  • Fixed SEP-10 verifyChallengeTxSigners authentication bypass with client_domain
  • Fixed wrong bitmask constants for trustline flags in getAssetBalance
  • Fixed stale sequence number after contract state restoration in AssembledTransaction.simulate
  • Fixed async request interceptors not awaited in fetch client
  • Fixed signAndSend temporarily mutating shared options.submit resulting in possible race conditions between concurrent AssembledTransactions

Ryang-21 and others added 5 commits April 2, 2026 10:25
After removing server and clientSigningKey from signersFound, check if
the array is empty and throw InvalidChallengeError. Previously, a
malicious wallet operator controlling a client_domain key could
authenticate as any user by signing only with the clientSigningKey.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace account-level flag constants with trustline-level bit values:
- authorized: bit 0x1 (was coincidentally correct)
- clawback: bit 0x4 (was 0x8, always returned false)
- Replace revocable with authorizedToMaintainLiabilities: bit 0x2

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Clear this.built before re-simulation after restore to prevent
  stale sequence number (tx_bad_seq)
- Add !isSimulationRestore guard to prevent assembling transaction
  with incorrect resource data when restore=false
- Wrap signTransaction callback instead of mutating shared options
  to prevent race condition on submit flag

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rewrite request interceptor loop to use promise chaining (matching
response interceptors) so async interceptors that return Promise<V>
are properly resolved before using the config.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 2, 2026 20:49
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Apr 2, 2026
@Ryang-21 Ryang-21 requested a review from quietbits April 2, 2026 20:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a set of internal correctness and security bugs across WebAuth (SEP-10), Soroban RPC helpers, the fetch-based HTTP client, and contract transaction assembly/signing.

Changes:

  • Harden SEP-10 verifyChallengeTxSigners to prevent a client_domain-only signature from satisfying client signer requirements, and add regression coverage.
  • Fix trustline flag decoding in rpc.Server#getAssetBalance, adjust the public response shape, and add unit coverage for clawback flag decoding.
  • Fix Soroban client behavior around simulation restoration (stale sequence / inappropriate assembly) and avoid shared-options mutation in signAndSend; also ensure async fetch request interceptors are awaited.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/unit/utils.test.ts Adds a regression test ensuring client_domain signatures don’t bypass client-signer verification.
src/webauth/challenge_transaction.ts Enforces that at least one real client signer remains after excluding server and client_domain signer.
src/rpc/server.ts Corrects trustline flag bitmask decoding in getAssetBalance.
src/rpc/api.ts Updates BalanceResponse trustline flag field naming to match semantics.
test/unit/server/soroban/get_classic_entries.test.ts Updates and extends tests to validate correct trustline flag decoding, including clawback.
src/http-client/fetch-client.ts Refactors request interceptor execution to properly await async interceptors before dispatching.
src/contract/assembled_transaction.ts Fixes restoration/simulation flow and prevents signAndSend from mutating shared options (race avoidance).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/rpc/api.ts
authorized: boolean;
clawback: boolean;
revocable?: boolean; // only present for trustlines
authorizedToMaintainLiabilities?: boolean; // only present for trustlines
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

Renaming balanceEntry.revocable to authorizedToMaintainLiabilities is a breaking public API change (and revocable is referenced in the existing changelog entry for rpc.Api.BalanceResponse). If the intent is to correct semantics rather than introduce a new field, consider keeping revocable as a deprecated alias (or updating all public docs/changelog in the same PR) to avoid silently breaking downstream TypeScript consumers.

Suggested change
authorizedToMaintainLiabilities?: boolean; // only present for trustlines
authorizedToMaintainLiabilities?: boolean; // only present for trustlines
/** @deprecated Use authorizedToMaintainLiabilities instead. */
revocable?: boolean; // legacy alias for trustlines

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 2, 2026

Size Change: +34.6 kB (+0.08%)

Total Size: 45.5 MB

📦 View Changed
Filename Size Change
dist/stellar-sdk-minimal.js 6.01 MB +6.65 kB (+0.11%)
dist/stellar-sdk-minimal.min.js 5.12 MB +4.06 kB (+0.08%)
dist/stellar-sdk-no-axios.js 6.01 MB +6.65 kB (+0.11%)
dist/stellar-sdk-no-axios.min.js 5.12 MB +4.06 kB (+0.08%)
dist/stellar-sdk-no-eventsource.js 6.28 MB +4.47 kB (+0.07%)
dist/stellar-sdk-no-eventsource.min.js 5.34 MB +2.15 kB (+0.04%)
dist/stellar-sdk.js 6.28 MB +4.47 kB (+0.07%)
dist/stellar-sdk.min.js 5.34 MB +2.14 kB (+0.04%)

compressed-size-action

@Ryang-21 Ryang-21 merged commit cbb53ed into master Apr 3, 2026
10 checks passed
@Ryang-21 Ryang-21 deleted the bug-fixes-1 branch April 3, 2026 20:06
@github-project-automation github-project-automation Bot moved this from Backlog (Not Ready) to Done in DevX Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants