Skip to content

Missing timeout: TypeScript SDK router — fetch() for compareMarketPrices #223

@realfishsam

Description

@realfishsam

Location

sdks/typescript/pmxt/router.ts:296

Code

const url = `${this.config.basePath}/api/${this.exchangeName}/compareMarketPrices`;
const response = await fetch(url, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
    body: JSON.stringify({ args: [query], credentials: this.getCredentials() }),
});

Risk

compareMarketPrices is a cross-venue router call that may fan out to multiple venue APIs on the server side. With no timeout on the client fetch, if the server is slow or the underlying venue calls hang, the SDK caller is blocked indefinitely.

Affected Methods

  • Router.compareMarketPrices() — and any other router methods using the same fetch pattern

Suggested Fix

const response = await fetch(url, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
    body: JSON.stringify({ args: [query], credentials: this.getCredentials() }),
    signal: AbortSignal.timeout(30_000),
});

Found by automated missing timeout audit

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions