omi icon indicating copy to clipboard operation
omi copied to clipboard

Frankfurter conversion crashes on non-finite string amounts

Open Zhepyrx opened this issue 2 months ago • 1 comments

At f42089f53c8010dd971b3702ece05a231c9c0c66, the Frankfurter tool accepts string amounts but _parse_amount compares a Decimal with zero before checking whether it is finite. Posting {"amount":"NaN","from_currency":"USD","to_currencies":["EUR"]} to /tools/convert_currency raises decimal.InvalidOperation and returns HTTP 500 instead of the normal ChatToolResponse.error. "sNaN" has the same result; "Infinity" passes validation and reaches the provider.

Reproduced offline through the actual FastAPI application with TestClient, the component's pinned dependencies, Python 3.13, and an AsyncMock currency provider. No live currency service, credentials, or user data were used. With a successful synthetic provider response, Infinity also crashes during formatting. In the same nine-case test set, unchanged code has 3 failures / 6 passes; a local candidate adding amount.is_finite() before comparison has 9 passes. The tests cover NaN, sNaN, both infinities, two valid amounts, zero, negative, and malformed input, including no provider calls for rejected input.

The candidate keeps finite positive conversions unchanged and uses the existing ValueError-to-tool-error path. This is a bounded request-validation bug, not a claim of a production outage or security exploit. Source: amount parser.

@josancamon19 — following the contribution guide's invitation to propose paid work, would you approve US$25 via the documented private PayPal process for this fix with regression coverage? This work is Codex-assisted on behalf of @Zhepyrx. The patch and focused tests are prepared locally; repository preflight and CI integration are still to be completed before a PR. Please confirm whether this scope is wanted and bounty-eligible.

Zhepyrx avatar Sep 08 '26 19:09 Zhepyrx

/claim #13189

Submitted fix and regression test suite in PR #13319.

CreamPle avatar Sep 09 '26 13:09 CreamPle