Proof Portal
litellm
BerriAI117 findings · 107 requirementsLiteLLM Python->Rust migration audit (proof mirroring).
93 withheld (location undisclosed)
validate_environment returns headers with a Bearer Authorization when an API key is provided directly or resolved from the environment
Specification
The requirement exactly as authored — its complete prose text and, where present, the formal FRETish sentence it compiles to.
validate_environment returns headers with a Bearer Authorization when an API key is provided directly or resolved from the environment
when (api_key_provided | env_key_present) the mistral_ocr shall always satisfy auth_header_set
Verification & provenance
How this requirement was checked: the review trail, edit history, and the machine-analysis status terms (each ⓘ explains what it means).
Review
- Status
- approved
- Reviewer
- Buger · lead_engineer
- Reviewed
- Jul 1, 2026, 16:42 UTC
History
- Created
- Jul 1, 2026, 09:53 UTC · Claude Code · AI agent
- Modified
- Aug 1, 2026, 18:27 UTC · Claude Opus 4 8 · AI agent
Hazard review
- scenarioreviewednominalempty_input
Pure key-resolution + header transform: nominal (valid key -> Bearer) and empty_input (absent key from both param and env -> raise) are the real partitions; boundary/edge_case/access_denied/concurrent do not pertain to a stateless single-shot string transform; error_handling and malformed_input suppressed with per-class rationale.
- propertyrevieweddeterminism
Output is a deterministic function of (headers, api_key): the dict-merge order (Authorization first, caller headers spread last) makes merge-order determinism a real property to witness. idempotency/commutativity/monotonicity/atomicity do not model a single header build; totality is bounded by the deliberate raise on absent key (empty_input); invariant_preservation is Go-only.
- structuralreviewednil_safety
Python transform: nil_safety applies because api_key defaults to None and headers arrives from the caller; behavior on None api_key is specified (raise). encoding_safety (no encode/decode round-trip) and overflow_safety (no numeric arithmetic) suppressed with per-class rationale; the C-only pointer/format/memory classes are not applicable to Python.
- domainreviewedsecrets_not_loggedpure_function_property_tested
This requirement is a PURE in-process transform with no network I/O. secrets_not_logged applies (constructs Authorization: Bearer <key> and the module imports verbose_logger). pure_function_property_tested applies (function is declared pure). All six external_call/http_client reliability classes plus auth_required/tls_required_for_secrets suppressed with per-class rationale: they belong on the OCR call path (litellm/ocr/main.py + base LLM httpx handler) that issues the Mistral request, not on this header builder.
Change history
Every recorded revision of this requirement's source file — newest first, each with its commit message and the diff for that change.
Review history
Human and AI-agent approvals of this requirement — the 'why was this approved' lineage, each with the reviewer's justification and the code it cites.
- UnknownApprovedSpec conformanceJul 1, 2026 · 5 months agoREVIEW-8
validate_environment: line 107 fetches the env key when api_key is None; when a key is available (arg or env) it falls through to build headers with 'Authorization: Bearer {api_key}' (line 114). FRETish 'when (api_key_provided | env_key_present) shall satisfy auth_header_set' matches the disjunction gating the header.
Cited code (3)
Obligations
What this requirement must witness to be considered satisfied — the required evidence, and the tests that discharge each one.
6 obligations · 6 discharged
Browse the catalogueOutput identical regardless of collection ordering or runtime conditions.
- nominalrequiredpresentCovered by 2 tests
Behavior when inputs are absent, nil, zero-length, or blank.
- nominalrequiredpresentCovered by 2 tests
Behavior specified when inputs are nil, null, or zero-value.
- negativerequiredpresentCovered by 2 tests
- nominalrequiredpresentCovered by 2 tests
Happy-path behavior with valid inputs.
- nominalrequiredpresentCovered by 4 tests
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.
- nominalrequiredpresentCovered by 2 tests
Authorization headers, session IDs, secrets, and PII never appear in logs.
If validate_environment or its callers emit the resolved api_key (passed directly or read from MISTRAL_API_KEY) into logs, the live Mistral credential leaks to every reader of those logs
- nominalrequiredpresentCovered by 2 tests
- negativerecommendedpresentCovered by 2 tests
Formula evidence
The formal formula behind this requirement, the variables it is written over, and the tests that exercise it (each term is explained inline).
Formula evidence
The formal formula behind this requirement, the variables it is written over, and the tests that exercise it (each term is explained inline).
FRETish formula
when (api_key_provided | env_key_present) the mistral_ocr shall always satisfy auth_header_set
Witnesses· 3 scenarios total
- mistral_gateway_sets_bearer_authorization_from_the_resolved_keyexercises 1 condition scenario
- test_direct_key_overrides_environmentexercises 1 condition scenario
- test_missing_api_key_raises_value_errorexercises 1 condition scenario
MC/DC truth table· 5 rows
Each row assigns the formula's conditions (T/F) and shows the Result— the formula's value for that input row, not a test pass/fail. A row proves a condition when flipping only that condition flips the outcome. The test that covers each row is linked.
mcdc:ignoreNo-actionfalse-result row satisfied by designUncoveredneeds a covering test| # | api_key_provided | auth_header_set | env_key_present | Result | Proves | Covering test |
|---|---|---|---|---|---|---|
| 1 | F | F | F | T | api_key_provided | |
| 2 | F | F | T | F | env_key_present | Exempted · defensive — a resolvable environment key always sets the Bearer header, so this trigger-satisfied-yet-unset state is unreachable in a correct build (reviewed: agent:claude-opus-4-8) |
| 3 | T | F | F | F | api_key_provided | Exempted · defensive — a directly supplied key always sets the Bearer header, so this trigger-satisfied-yet-unset state is unreachable in a correct build (reviewed: agent:claude-opus-4-8) |
| 4 | T | F | T | F | auth_header_set | Exempted · defensive — a supplied key always sets the Bearer header regardless of the environment, so this trigger-satisfied-yet-unset state is unreachable in a correct build (reviewed: agent:claude-opus-4-8) |
| 5 | T | T | T | T | auth_header_set |
Its place
How this requirement connects — what proves it, what it affects, and what it rests on. Authored links only here; automatically derived links come from the audit index.
Loading graph…
Trace evidence
The concrete artifacts linked to this requirement — implementing code, verifying tests, documents, and the findings raised against it.
Impact
Blast radius — authored trace links only (automatically derived links come from the audit index and aren't shown here).
Impact
Blast radius — authored trace links only (automatically derived links come from the audit index and aren't shown here).
If you change this
Files to re-check (2)
- transformation.pylitellm/llms/mistral/ocr/transformation.py
- transformation.rslitellm-rust/crates/core/src/providers/mistral/ocr/transformation.rs
Tests to re-run (2)
- tests.rslitellm-rust/crates/ai-gateway/src/ocr/tests.rs
- test_mistral_ocr_transformation.pytests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py
What this rests on
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.