Skip to main content

ai-gateway-audit

Tests CodeQL OpenSSF Scorecard Fuzzing: ClusterFuzzLite Python 3.11+ License: MIT

Audit your AI gateway like the tier-0 system it is.

An AI gateway such as LiteLLM holds the API key for every model provider your company uses, and often every prompt and response that passes through it. On October 21, 2026, a compromised LiteLLM release shipped a payload that queried the gateway's credential tables directly (analysis). Most teams still configure their gateway like a developer tool.

ai-gateway-audit reads a gateway's configuration and deployment files, checks them against ten controls, and produces evidence an auditor can use: a reviewer report, a findings sheet, hashed evidence files and OSCAL assessment results. Findings can be accepted only through a reviewed exception with an owner and an expiry date.

pip install git+https://github.com/Mihirajmera/ai-gateway-audit
ai-gateway-audit demo
DEPLOYMENT                    HIGH   MED   LOW   N/A
hardened                         0     0     0     0
insecure                         7     5     3     0

Read the sample report without installing anything.

Why the gateway is tier-0

Every application and agent reaches every model through one process. That process holds the keys, sees the traffic and, often, stores both. Each box below is something an attacker who controls the gateway gets, and each label is the check that covers it.

flowchart TB
    subgraph CALLERS["Callers"]
        direction LR
        APP["Internal apps"]
        AG["AI agents"]
        DEV["Developers"]
    end
    subgraph GW["AI gateway: LiteLLM proxy · one process holds all of this"]
        direction LR
        MK{{"Master key<br/>GWA-02"}}
        CFG["Provider keys in<br/>config.yaml and .env<br/>GWA-01"]
        DB[("Gateway database<br/>stored keys GWA-04<br/>spend logs GWA-03")]
        CB["Logging callbacks<br/>Langfuse, S3<br/>GWA-03"]
        UI["Admin UI and API docs<br/>GWA-05 · GWA-09"]
        IMG["Container image<br/>GWA-07"]
    end
    subgraph PROV["Model providers"]
        direction LR
        OAI["OpenAI"]
        ANT["Anthropic"]
        AZ["Azure, Bedrock, Vertex"]
    end
    ATK["⚠️ A repointed image tag<br/>runs with everything above"]
    CALLERS -->|"requests · size limits GWA-10"| GW
    GW -->|"TLS verified GWA-08 · budgets GWA-06"| PROV
    ATK -.-> IMG

    classDef caller fill:#e0f2fe,stroke:#0284c7,color:#0c4a6e
    classDef crown fill:#fee2e2,stroke:#dc2626,color:#7f1d1d
    classDef gate fill:#fef3c7,stroke:#d97706,color:#78350f
    classDef ext fill:#f3f4f6,stroke:#6b7280,color:#111827
    class APP,AG,DEV caller
    class CFG,DB,CB,IMG,ATK crown
    class MK,UI gate
    class OAI,ANT,AZ ext

How it works

flowchart LR
    subgraph IN["📥 Inputs, per folder"]
        C["config.yaml<br/>LiteLLM settings"]
        D["docker-compose.yml<br/>image, environment, env_file"]
        E[".env files"]
    end
    subgraph CORE["⚙️ ai_gateway_audit"]
        P["Parsers<br/>secrets redacted here"]
        M["Deployment model<br/>one per folder"]
        X["11 checks<br/>GWA-01 … GWA-11"]
        K[("Control catalog<br/>controls.yaml")]
        XC[("Reviewed exceptions<br/>owner + expiry")]
    end
    subgraph OUT["📤 Audit outputs"]
        R["gateway-audit.md<br/>reviewer report + sign-off"]
        S["findings.csv<br/>owner, due date"]
        V["evidence/*.json<br/>SHA-256 hashed"]
        O["OSCAL 1.1.2<br/>assessment results"]
    end
    C & D & E --> P --> M --> X
    K -. "NIST · SOC 2 · OWASP LLM<br/>needs: config or deployment" .-> X
    XC -. "expired exceptions reopen" .-> X
    X --> R & S & V & O

    classDef input fill:#e0f2fe,stroke:#0284c7,color:#0c4a6e
    classDef core fill:#ede9fe,stroke:#7c3aed,color:#3b0764
    classDef data fill:#fef3c7,stroke:#d97706,color:#78350f
    classDef output fill:#dcfce7,stroke:#16a34a,color:#14532d
    class C,D,E input
    class P,M,X core
    class K,XC data
    class R,S,V,O output
  1. Discover. Every folder with a LiteLLM config or a Compose service running a LiteLLM image becomes one deployment. Compose env_file: references are followed.
  2. Redact. Plain-text secrets are replaced with [REDACTED] while parsing, so nothing downstream ever holds them.
  3. Check. Each check declares whether it needs the config or the deployment files. If the files it needs aren't there, it reports NOT ASSESSED.
  4. Apply exceptions. A finding stays open unless a reviewed exception with an approver and an unexpired date covers it.
  5. Export. A report for the reviewer, a CSV for tracking fixes, hashed evidence for the auditor and OSCAL for GRC tools.

What it checks

Check Control Typical failure
GWA-01 Provider credentials are not stored in plain text api_key: sk-... in config.yaml; a password in DATABASE_URL
GWA-02 The proxy requires a master key that is not stored in plain text no master_key at all, so the proxy is unauthenticated; or master_key: sk-1234
GWA-03 Prompts and responses are kept out of logs store_prompts_in_spend_logs: true; Langfuse or S3 callbacks without turn_off_message_logging
GWA-04 Provider keys are not held in the gateway database store_model_in_db: true with no key management system
GWA-05 The admin UI does not accept a shared environment login UI_PASSWORD in Compose; disable_env_credential_login not set
GWA-06 Spend is capped globally and per key no max_budget; keys can be minted without a budget
GWA-07 The gateway image is pinned by digest litellm:main-stable, one of the tags the October 2026 attacker repointed
GWA-08 TLS certificates are verified on calls to providers ssl_verify: false
GWA-09 Interactive API documentation is disabled NO_DOCS / NO_REDOC / NO_OPENAPI not set
GWA-10 Request and upload sizes are limited no max_request_size_mb or allowed_file_extensions
GWA-11 The gateway runs a LiteLLM release with no known high or critical advisory litellm:main-v1.94.0-stable, open to the October 2026 file-read and salt-key escalations (list, updated with each release)

Each check is mapped to NIST SP 800-53, SOC 2 and the OWASP Top 10 for LLM Applications in controls.yaml. The mappings are my judgment; check them against the official crosswalks before relying on them in an audit.

What it can't see. A configuration file can't prove that egress is restricted to model providers, that the admin UI isn't internet-facing, that keys are rotated, or that the database is encrypted. Every report lists these under Needs evidence from outside the configuration, so nobody mistakes a clean scan for a clean gateway.

Not assessed is not passed. If no Compose or .env file is found, the image and API-docs checks are reported as NOT ASSESSED, never as PASS.

Scan your own gateway

Point it at the folder that holds your config.yaml and, ideally, the docker-compose.yml or .env that runs it:

ai-gateway-audit scan deploy/litellm --out audit

Files in the same folder are combined into one deployment. env_file: references in Compose are followed. Folders with no LiteLLM config or LiteLLM image are ignored, so you can scan a whole repository.

Outputs in audit/:

File For
gateway-audit.md The reviewer: control results, every finding with a fix, and a sign-off block
findings.csv Tracking remediation: one row per finding, with owner and due-date columns
evidence/<deployment>.json The auditor: SHA-256 of every file read, the redacted settings, and a hash over both
oscal/assessment-results.json GRC tooling: OSCAL 1.1.2, one finding per NIST 800-53 control

Reviewed exceptions

Some findings are acceptable for a reason. Record the decision instead of suppressing the check:

# exceptions.yaml
exceptions:
  - check: GWA-09
    deployment: litellm          # or "*"
    setting: NO_DOCS             # optional
    decision: risk-accepted      # risk-accepted | not-applicable | deferred
    reason: Internal-only proxy behind the VPN; the platform team uses the docs.
    approved_by: Head of Platform
    expires: 2027-01-31
ai-gateway-audit scan deploy/litellm --exceptions exceptions.yaml

A covered finding shows as EXCEPTION with its approver and expiry. When the date passes, the exception stops applying, the finding reopens and the report lists it under Expired exceptions. Entries without a reason, approver or expiry date are rejected.

In CI

- run: pip install ai-gateway-audit
- run: ai-gateway-audit scan deploy/litellm --exceptions deploy/litellm/exceptions.yaml --fail-on medium

--fail-on exits 1 if any open finding is at or above that severity. --format json prints the results on stdout for other tools.

Design

  • Secrets never reach the output. Plain-text credentials are redacted while parsing, before anything is checked or written; findings name the setting, never the value. Tests check every output file for the example secrets.
  • Read-only, offline. Files are parsed, never executed (yaml.safe_load), and the tool makes no network calls.
  • Reproducible evidence. Set SOURCE_DATE_EPOCH and the same inputs produce byte-identical output, including deterministic OSCAL UUIDs.
  • Supply chain. Hash-locked dependencies, actions pinned to commit SHAs, CodeQL, OpenSSF Scorecard, fuzzing with ClusterFuzzLite, and signed releases with SLSA level 3 provenance.

Roadmap

  • Kong AI Gateway (ai-proxy plugin) and Portkey configurations
  • Kubernetes manifests and Helm values for the LiteLLM chart
  • Reading settings stored in the LiteLLM database (when store_model_in_db is on), through the admin API

MIT licensed. Contributions welcome; see CONTRIBUTING.md.

Metadata

Release files for ai-gateway-audit 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-gateway-audit 0.1.0
File Size Uploaded Provenance Actions
ai_gateway_audit-0.1.0.tar.gz 34.9 kB With provenance Details for ai_gateway_audit-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ai-gateway-audit 0.1.0
File Interpreter ABI Platform Actions
ai_gateway_audit-0.1.0-py3-none-any.whl Python 3 none any Details for ai_gateway_audit-0.1.0-py3-none-any.whl

Total release size: 65.4 kB

Release files / ai_gateway_audit-0.1.0.tar.gz

Download URL ai_gateway_audit-0.1.0.tar.gz
Size 34.9 kB
Tags Source
SHA-256 checksum
How to use checksums
35654f4c3b1913ea3388f8baa4b9e83bc0b0d51c65604814a9b5ce9558211b75
BLAKE2b-256 checksum
How to use checksums
b0db204d957ac23887afe85a91c2cda35303d6d349dc36f935c57be15f2fcf81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / ai_gateway_audit-0.1.0-py3-none-any.whl

Download URL ai_gateway_audit-0.1.0-py3-none-any.whl
Size 30.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d8bf767bded5bb01063c568e2e5c7d8f12a63b9b0d9c34ae97ef06aa0696ef7
BLAKE2b-256 checksum
How to use checksums
2bc19dcb939dab02f14698590cc50ac52d6522a384476f5e2f8bf27e35a2b70e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for ai-gateway-audit 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ai_gateway_audit-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page