Proof Portal

Project overview

litellm

BerriAI117 findings · 107 requirements

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

Back to findings
Known issueKI-ocr-response-coercion-divergence

Python↔Rust divergence risk: malformed OCR response handling (fail-loud vs coerce)

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.

D1 reassessment. The Python transform_ocr_response constructs OCRResponse via pydantic and RAISES a ValidationError on a malformed-but-parseable response (e.g. pages that is not a list). This fail-loud behavior is the correct/safe reference: the caller sees a typed error rather than a silently-degraded/coerced response. The finding is a DIVERGENCE risk, not a Python defect: any parallel implementation (e.g. a Rust OCR port) that silently coerces malformed pages/model instead of failing loudly diverges from this reference behavior and should be brought into line. No litellm code is changed.

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
    Defect in the Rust port itselfPython → 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
Reproducer-confirmed
risk area
Correctness
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.

  • MistralOCRConfig.transform_ocr_response

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.

Known issue reproducedRun status: Passprofileocr-known-issue-reproducer
Reproducer test
Run it yourself
.venv/bin/pytest tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py -k malformed_pages_structure
Covers (2)
Last run Aug 1, 2026, 8:41 PM

Reproduction steps

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

uv run pytest tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py -k malformed_pages_structure

What protects you, and the fix

What limits your exposure today, and the planned remediation.

What protects you now

Rely on Python's fail-loud path as the reference; verify any port matches it.

The fix

Ensure every OCR-response implementation fails loudly on malformed structure (matches Python). AUDIT/divergence finding only.

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.

Tracing blast radius…

Touch this finding and you re-check 1 requirements · 2 code files · 1 tests.

Requirements (1)
Code files (2)
  • transformation.rs
  • transformation.py
Tests (1)
  • test_mistral_ocr_transformation.py

Per-requirement evidence

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

Implementing code (2)
  • litellm-rust/crates/core/src/providers/mistral/ocr/transformation.rs
    MistralOcrConfig.transform_ocr_response
  • litellm/llms/mistral/ocr/transformation.py
    MistralOCRConfig.transform_ocr_response
Tests & evidence (3)
  • docs/requirements/mistral_ocr.md
  • litellm-rust/crates/core/src/providers/mistral/ocr/transformation.rs
  • tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py
Proof obligations (3)
nominal

Happy-path behavior with valid inputs.

  • ✓nominal (required) — litellm-rust/crates/core/src/providers/mistral/ocr/transformation.rs:366, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:229
pure_function_property_tested

A function declared pure (no I/O, no global state, output is f(input) only) shall carry property-based tests that exercise its declared algebraic properties (determinism, totality, commutativity, monotonicity, idempotency — whichever apply); example-based tests alone shall not be sufficient evidence for a pure-function obligation.

  • ✓nominal (required) — litellm-rust/crates/core/src/providers/mistral/ocr/transformation.rs:367, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:227
untrusted_input_bounded

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

  • ✗nominal (required)

Evidence trail

The raw evidence manifests behind this finding — superseded by the resolved reproducer above, kept here for traceability.

  • proof/evidence/ki-ocr-response-coercion-divergence.yaml

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