BerriAI/litellm · error · ValueError

oidc/file path is outside the allowed credential directories

Error message

oidc/file path is outside the allowed credential directories. Set LITELLM_OIDC_ALLOWED_CREDENTIAL_DIRS to extend the allowlist.

What it means

Security allowlist check in _resolve_oidc_file_path: the realpath of the requested credential file does not fall under any directory in _get_oidc_allowed_credential_dirs() (defaults or LITELLM_OIDC_ALLOWED_CREDENTIAL_DIRS override). Guards against path traversal outside sanctioned credential dirs.

Source

Thrown at litellm/secret_managers/main.py:90

    Resolve ``requested_path`` and verify it falls within one of the allowed
    credential directories. Raises ``ValueError`` otherwise.
    """
    if not os.path.isabs(requested_path):
        raise ValueError(
            "oidc/file path must be absolute. Use the format "
            "'oidc/file//var/run/secrets/<name>' (note the leading slash "
            "after 'oidc/file/')."
        )
    resolved: Final = os.path.realpath(requested_path)
    for allowed in _get_oidc_allowed_credential_dirs():
        try:
            if os.path.commonpath([resolved, allowed]) == allowed:
                return resolved
        except ValueError:
            # commonpath raises when paths are on different drives (Windows);
            # treat as not-matching and continue.
            continue
    raise ValueError(
        "oidc/file path is outside the allowed credential directories. "
        "Set LITELLM_OIDC_ALLOWED_CREDENTIAL_DIRS to extend the allowlist."
    )


def _get_oidc_http_handler(timeout: httpx.Timeout | None = None) -> HTTPHandler:
    """
    Factory function to create HTTPHandler for OIDC requests.
    This function can be mocked in tests.

    Args:
        timeout: Optional timeout for HTTP requests. Defaults to 600.0 seconds with 5.0 connect timeout.

    Returns:
        HTTPHandler instance configured for OIDC requests.
    """
    if timeout is None:
        timeout = httpx.Timeout(timeout=600.0, connect=5.0)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Point the oidc/file path at a file inside an allowed directory.
  2. Set LITELLM_OIDC_ALLOWED_CREDENTIAL_DIRS to include the directory holding your token file.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/secret_managers/main.py:90 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/bae942b4ced10e6e. Report an issue: GitHub.