Proof Portal

Project overview

litellm

BerriAI117 findings · 107 requirements

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

93 withheld (location undisclosed)

All requirements
RequirementSW-REQ-260701-EM9FSoftwareApproved

validate_environment returns headers with a Bearer Authorization when an API key is provided directly or resolved from the environment

This requirement changed after its last recorded review, so approval is stale. Automated checks pass and 7/7 obligations are satisfied.
PriorityshallTypeguaranteeCategoryfunctionalComponentmistral_ocrAssuranceEFindingsnone open

Specification

The requirement exactly as authored — its complete prose text and, where present, the formal FRETish sentence it compiles to.

Description

validate_environment returns headers with a Bearer Authorization when an API key is provided directly or resolved from the environment

FRETish formula
when (api_key_provided | env_key_present) the mistral_ocr shall always satisfy auth_header_set
View full formal model

Verification & provenance

How this requirement was checked: the review trail, edit history, and the machine-analysis status terms (each ⓘ explains what it means).

Assurance levelE
Formalizationvalid
Strategyfretish

Review

Status
approved
Reviewer
Buger · lead_engineer
Reviewed
Jul 1, 2026, 16:42 UTC
“Owner-authorized review: FRETish matches implementation behavior, review gate PASS, obligation evidence complete, code + requirement MC/DC 100%, witnessing tests green”

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

Reviewed Jul 2, 2026, 05:51 UTCby agent:claude-codecatalog v1.3.0
  • 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.

  1. 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 catalogue
Discharged

Output identical regardless of collection ordering or runtime conditions.

Discharging evidence1/1 required witnessed
  • nominalrequiredpresent
    Covered by 2 tests
Discharged

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

Discharging evidence1/1 required witnessed
  • nominalrequiredpresent
    Covered by 2 tests
Discharged

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

Discharging evidence2/2 required witnessed
  • negativerequiredpresent
    Covered by 2 tests
  • nominalrequiredpresent
    Covered by 2 tests
Discharged

Happy-path behavior with valid inputs.

Discharging evidence1/1 required witnessed
  • nominalrequiredpresent
    Covered by 4 tests
Discharged

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.

Discharging evidence1/1 required witnessed
  • nominalrequiredpresent
    Covered by 2 tests
Discharged

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

If it were violatedHigh

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

Discharging evidence1/1 required witnessed
  • nominalrequiredpresent
    Covered by 2 tests
  • negativerecommendedpresent
    Covered 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).

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_key
    exercises 1 condition scenario
  • test_direct_key_overrides_environment
    exercises 1 condition scenario
  • test_missing_api_key_raises_value_error
    exercises 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.

Covereda test exercises this rowExempteda reviewed mcdc:ignoreNo-actionfalse-result row satisfied by designUncoveredneeds a covering test
#api_key_providedauth_header_setenv_key_presentResultProvesCovering test
1FFFTapi_key_provided
2FFTFenv_key_presentExempted · 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)
3TFFFapi_key_providedExempted · 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)
4TFTFauth_header_setExempted · 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)
5TTTTauth_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).

If you change this

Requirements
0
Files
2
Tests
2
At-risk contracts
0

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.

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