Proof Portal

Project overview

litellm

BerriAI117 findings · 107 requirements

LiteLLM Python->Rust migration audit (proof mirroring).

Back to findings
Known issueKI-ocr-retry

OCR call path has no explicit retry/backoff policy

OpenOpenLow

Low-severity issue, currently open.

How well is this finding proven?

  1. 1.Reported / candidate

    Complete

  2. 2.Reproducer written

    Complete

    View reproducer
  3. 3.Reproduces (recorded run)

    Not yet established

    View evidence
  4. 4.Independently re-run

    Not yet established

  5. 5.Meets quality standard

    Not assessed

  6. 6.Validated for submission

    Not assessed

Recorded runs show whether the issue reproduces. Independent re-runs are shown separately. A later review does not fill in a missing earlier step.

Description

The issue as recorded.

The direct OCR call path issues a single client.post with no explicit retry/backoff policy: no declared retry count, no exponential backoff/jitter, no idempotency-aware retry on transient failures (timeout/reset/5xx). Router-level retries are not wired into the OCR handler path, so transient upstream blips surface directly as failures.

Affected requirements

The requirement(s) this issue violates — click through to the spec.

Port parity

How this finding relates to the port: whether the behaviour diverges, isn't ported yet, was fixed, or matches across both implementations.

  • Mistral OCR: Python -> RustMIR-001
    Inherited on Rust (present on both sides)Python → Rust
    View in Mirrors

Severity, explained

Why this is rated the way it is — and the scoring signals behind the rating (each ⓘ explains the term).

LowRated severity — the impact if this issue is exploited or hit.
why this rating
Risk-rated
risk area
Availability
Security classification
Not a security surface
CVE surface
None

Where it is

The code the issue lives in — peek the affected function inline to see it in context.

  • BaseLLMHTTPHandler.ocr / async_ocr (single client.post)

Reproducer and evidence

The recorded reproducer and its evidence-run outcome. Inspect the test and source, or run the command to check the behavior yourself.

Recorded
Reproducer test
from // Reproduces: marker
Run it yourself
uv run pytest tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py::TestOcrKnownIssueReproducers::test_transient_failure_is_not_retried

Reproduction steps

Technical steps for your engineers to confirm the issue by hand.

  1. Code observation (no runtime reproducer): 1) open litellm/llms/custom_httpx/llm_http_handler.py; 2) in BaseLLMHTTPHandler.ocr and async_ocr observe exactly one client.post/async post call with no retry loop, no backoff, and no idempotency-aware retry; 3) any exception routes straight to _handle_error and out. Residual gap: the OCR handler itself has no retry policy (Router-level retry/fallback via async_function_with_fallbacks is opt-in and out of this module).
uv run pytest tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py::TestOcrKnownIssueReproducers::test_transient_failure_is_not_retried

What protects you, and the fix

What limits your exposure today, and the planned remediation.

What protects you now

Callers/Router can wrap OCR with their own retry policy.

The fix

Define an explicit retry policy (retry count + backoff/jitter, idempotency-aware) or document a deliberate no-retry policy.

Blast radius

If you touch this issue, what else may need re-checking — the requirements it affects and the code and tests that hang off them. Historical view: authored trace links only — automatically derived links aren't reconstructible for past runs.

No authoredcode links reach these requirements in this historical reconstruction. Automatically derived code links aren't reconstructible for past runs, so implementing code may have existed without an authored trace.

Tracing blast radius…

Per-requirement evidence

For each requirement this finding touches: the implementing code, verifying tests, and proof obligations that discharge it.

Tests & evidence (3)
  • docs/requirements/mistral_ocr.md
  • litellm-rust/crates/ai-gateway/src/ocr/tests.rs
  • tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py
Proof obligations (18)
cert_chain_validated

Certificate verification shall validate the full chain to a configured trust root, not just the leaf.

  • ✓nominal (required) — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:730
  • ✓negative — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:849
cert_validation_strict

HTTP clients shall verify TLS certificates, hostnames, and chains; InsecureSkipVerify and equivalent shall not be enabled in production.

  • ✓nominal (required) — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:729
  • ✓negative — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:848
empty_input

Behavior when inputs are absent, nil, zero-length, or blank.

  • ✓nominal (required) — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:832
error_handling

Behavior when operations fail or dependencies are unavailable.

  • ✓negative (required) — litellm-rust/crates/ai-gateway/src/ocr/tests.rs:364, litellm-rust/crates/ai-gateway/src/ocr/tests.rs:858, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:690
  • ✓nominal (required) — litellm-rust/crates/ai-gateway/src/ocr/tests.rs:284, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:524
external_call_concurrency_bounded

Outbound concurrency to each external dependency shall be capped (semaphore / bulkhead / circuit breaker) so that one stalled dependency cannot exhaust caller capacity.

  • ✗nominal (required)
external_call_failure_observable

External-call failures (timeout, unreachable, refused, TLS error) shall map to typed errors that the caller surfaces; silent retries / black-hole drops are forbidden without explicit policy.

  • ✓nominal (required) — litellm-rust/crates/ai-gateway/src/ocr/tests.rs:363, litellm-rust/crates/ai-gateway/src/ocr/tests.rs:857, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:689, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:710
external_call_timeout_bounded

Every cross-process call shall declare connect, read, and total deadlines; no external call is defaulted to "no timeout."

  • ✓nominal (required) — litellm-rust/crates/ai-gateway/src/ocr/tests.rs:802, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:668
malformed_input

Behavior when inputs are syntactically or structurally invalid.

  • ✓negative (required) — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:809
  • ✓nominal (required) — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:525
nil_safety

Behavior specified when inputs are nil, null, or zero-value.

  • ✓negative (required) — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:811
  • ✓nominal (required) — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:810
nominal

Happy-path behavior with valid inputs.

  • ✓nominal (required) — litellm-rust/crates/ai-gateway/src/ocr/tests.rs:283, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:523
redirect_policy_explicit

HTTP clients shall declare their redirect-following policy (max hops, scheme/host invariants, header propagation).

  • ✓nominal (required) — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:746
request_timeout_bounded

HTTP clients shall enforce per-request timeouts (dial, TLS handshake, read header, read body) and shall not block indefinitely.

  • ✓nominal (required) — litellm-rust/crates/ai-gateway/src/ocr/tests.rs:801, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:669
retry_policy_explicit

HTTP clients shall declare an explicit retry policy (which methods, which errors, max attempts, backoff schedule, jitter).

  • ✗nominal (required)
secrets_not_logged

Authorization headers, session IDs, secrets, and PII never appear in logs.

  • ✓nominal (required) — litellm-rust/crates/ai-gateway/src/ocr/tests.rs:894, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:772
  • ✓negative — litellm-rust/crates/ai-gateway/src/ocr/tests.rs:895, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:773
ssrf_protection

HTTP clients with user-influenced URLs shall enforce an allowlist of reachable destinations and reject internal-network targets.

  • ✗nominal (required)
tls_required_for_secrets

Endpoints handling secrets shall reject plaintext HTTP.

  • ✓nominal (required) — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:731, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:755
untrusted_input_bounded

Deserialization of untrusted input shall enforce schema, type, and size bounds before any object construction.

  • ✓nominal (required) — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:526
upstream_budget_coordinated

Spec shall enumerate the upstream timeout chain (load balancer, ingress, peer service, client-side proxy) and prove that the caller's total call budget is strictly less than the minimum upstream timeout.

  • ✗nominal (required)
Tests & evidence (3)
  • docs/requirements/mistral_ocr.md
  • litellm-rust/crates/ai-gateway/src/ocr/tests.rs
  • tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py
Proof obligations (12)
cert_validation_strict

HTTP clients shall verify TLS certificates, hostnames, and chains; InsecureSkipVerify and equivalent shall not be enabled in production.

  • ✓nominal (required) — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:729, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:732
  • ✓negative — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:848, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:850
error_handling

Behavior when operations fail or dependencies are unavailable.

  • ✓negative (required) — litellm-rust/crates/ai-gateway/src/ocr/tests.rs:364, litellm-rust/crates/ai-gateway/src/ocr/tests.rs:858, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:690, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:350, litellm-rust/crates/core/src/providers/mistral/ocr/transformation.rs:446, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:475, litellm-rust/crates/ai-gateway/src/ocr/tests.rs:366, litellm-rust/crates/ai-gateway/src/ocr/tests.rs:860, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:692
  • ✓nominal (required) — litellm-rust/crates/ai-gateway/src/ocr/tests.rs:284, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:524, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:230, litellm-rust/crates/core/src/providers/mistral/ocr/transformation.rs:428, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:434, litellm-rust/crates/ai-gateway/src/ocr/tests.rs:287, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:558
external_call_concurrency_bounded

Outbound concurrency to each external dependency shall be capped (semaphore / bulkhead / circuit breaker) so that one stalled dependency cannot exhaust caller capacity.

  • ✗nominal (required)
external_call_failure_observable

External-call failures (timeout, unreachable, refused, TLS error) shall map to typed errors that the caller surfaces; silent retries / black-hole drops are forbidden without explicit policy.

  • ✓nominal (required) — litellm-rust/crates/ai-gateway/src/ocr/tests.rs:363, litellm-rust/crates/ai-gateway/src/ocr/tests.rs:857, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:689, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:710, litellm-rust/crates/ai-gateway/src/ocr/tests.rs:365, litellm-rust/crates/ai-gateway/src/ocr/tests.rs:859, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:691, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:711
external_call_timeout_bounded

Every cross-process call shall declare connect, read, and total deadlines; no external call is defaulted to "no timeout."

  • ✓nominal (required) — litellm-rust/crates/ai-gateway/src/ocr/tests.rs:802, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:668, litellm-rust/crates/ai-gateway/src/ocr/tests.rs:803, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:670
malformed_input

Behavior when inputs are syntactically or structurally invalid.

  • ✓negative (required) — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:809, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:351, litellm-rust/crates/core/src/providers/mistral/ocr/transformation.rs:337, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:321, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:812
  • ✓nominal (required) — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:525, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:231, litellm-rust/crates/core/src/providers/mistral/ocr/transformation.rs:304, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:190, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:559
nominal

Happy-path behavior with valid inputs.

  • ✓nominal (required) — litellm-rust/crates/ai-gateway/src/ocr/tests.rs:283, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:523, litellm-rust/crates/core/src/providers/mistral/ocr/transformation.rs:219, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:59, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:92, litellm-rust/crates/core/src/providers/mistral/ocr/transformation.rs:366, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:229, litellm-rust/crates/core/src/providers/mistral/ocr/transformation.rs:424, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:433, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:450, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:460, litellm-rust/crates/core/src/providers/mistral/ocr/transformation.rs:400, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:378, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:384, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:396, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:404, litellm-rust/crates/core/src/providers/mistral/ocr/transformation.rs:302, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:189, litellm-rust/crates/core/src/providers/mistral/ocr/transformation.rs:193, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:310, litellm-rust/crates/ai-gateway/src/ocr/tests.rs:286, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:557
redirect_policy_explicit

HTTP clients shall declare their redirect-following policy (max hops, scheme/host invariants, header propagation).

  • ✓nominal (required) — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:746, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:747
retry_policy_explicit

HTTP clients shall declare an explicit retry policy (which methods, which errors, max attempts, backoff schedule, jitter).

  • ✗nominal (required)
ssrf_protection

HTTP clients with user-influenced URLs shall enforce an allowlist of reachable destinations and reject internal-network targets.

  • ✗nominal (required)
tls_required_for_secrets

Endpoints handling secrets shall reject plaintext HTTP.

  • ✓nominal (required) — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:731, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:755, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:733, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:756
  • ✓negative — tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:851
upstream_budget_coordinated

Spec shall enumerate the upstream timeout chain (load balancer, ingress, peer service, client-side proxy) and prove that the caller's total call budget is strictly less than the minimum upstream timeout.

  • ✗nominal (required)

Change history

Every recorded revision of this finding's source file — when it was added, edited, or re-classified, with the diff for each change.

Discussions

Discuss this with the proof team. Nothing changes in your audit automatically — you open a request and a staff member records any outcome inside the thread.

Sign in to discuss this with the proof team.Sign in