Proof Portal

Project overview

litellm

BerriAI117 findings · 107 requirements

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

Back to findings
Known issueKI-ocr-no-numeric-validation

OCR transform forwards numeric parameters without in-module range validation

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 transform module forwards numeric OCR parameters (image_limit, image_min_size, pages entries, and the effective timeout) to the provider without validating their natural domains (image_limit/image_min_size/page indices are non-negative counts; timeout is strictly positive). map_ocr_params only allowlist-filters by KEY; it does not check or clamp VALUES. There is no requirement constraining these ranges because the module does not enforce them, so modeling them as constrained variables would orphan. Recorded as a domain-documentation finding instead: the valid numeric domains exist in the Mistral API contract but are not validated in-module.

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
    Matches across bothPython → 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
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.map_ocr_params / transform_ocr_request

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_out_of_domain_numeric_params_forwarded_unchanged

Reproduction steps

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

  1. Code observation (no runtime reproducer): 1) open litellm/llms/mistral/ocr/transformation.py; 2) in map_ocr_params observe the only guard is key-membership (if param in supported_params) with no check or clamp of parameter VALUES; 3) in transform_ocr_request observe numeric params are copied into the body via data.update(optional_params) unchanged. Conclusion: numeric OCR parameters are forwarded without in-module range validation.
uv run pytest tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py::TestOcrKnownIssueReproducers::test_out_of_domain_numeric_params_forwarded_unchanged

What protects you, and the fix

What limits your exposure today, and the planned remediation.

What protects you now

The provider rejects out-of-domain values; callers pass well-formed parameters.

The fix

Optionally add range validation/clamping for numeric OCR params before forwarding. AUDIT observation only; transformation.py is not modified.

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 · 3 code files · 1 tests.

Requirements (1)
Code files (3)
  • transformation.rs
  • transformation.py
  • transformation.rs
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/ocr/transformation.rs
    map_ocr_params
  • litellm/llms/mistral/ocr/transformation.py
    MistralOCRConfig.map_ocr_params
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 (5)
determinism

Output identical regardless of collection ordering or runtime conditions.

  • ✓nominal (required) — litellm-rust/crates/core/src/providers/mistral/ocr/transformation.rs:236, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:143, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:910
empty_input

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

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

Happy-path behavior with valid inputs.

  • ✓nominal (required) — 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
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:220, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:142, tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py:889
totality

Every reachable input combination is covered by a requirement.

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

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