OpenBB-finance/OpenBB · error · OpenBBError

Invalid URL provided for download. Must be from federalreser

Error message

Invalid URL provided for download. Must be from federalreserve.gov -> {url}

What it means

Raised by the federal_reserve router's document-download endpoint when a provided URL is not HTTPS or its hostname is not exactly www.federalreserve.gov / federalreserve.gov. This is a deliberate SSRF guard: the endpoint fetches and base64-encodes remote documents, so it whitelists a single origin.

Source

Thrown at openbb_platform/providers/federal_reserve/openbb_federal_reserve/router.py:61

    """
    # pylint: disable=import-outside-toplevel
    import base64  # noqa
    from io import BytesIO
    from urllib.parse import urlparse
    from openbb_core.provider.utils.helpers import make_request

    urls = params.get("url", [])
    results: list = []

    for url in urls:
        parsed_url = urlparse(url)
        hostname = parsed_url.hostname or ""

        if parsed_url.scheme != "https" or hostname not in {
            "www.federalreserve.gov",
            "federalreserve.gov",
        }:
            raise OpenBBError(
                "Invalid URL provided for download. Must be from federalreserve.gov -> "
                + url
            )

        is_pdf = url.lower().endswith(".pdf")

        if (
            not is_pdf
            and not url.lower().endswith(".htm")
            and not url.lower().endswith(".html")
        ):
            raise OpenBBError(
                "Unsupported document format. File must be PDF or HTM type -> " + url
            )

        try:
            response = make_request(url)
            response.raise_for_status()

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Use the exact origin: https://www.federalreserve.gov/... (note urlparse hostname is case-insensitive here, but scheme must be lowercase https).
  2. Ensure the URL string starts with 'https://' and contains no leading whitespace.
  3. For documents on other domains, download them directly instead of via this router.

Example fix

// before
obb.federal_reserve.download(url=['http://federalreserve.gov/pub/pdf'])
// after
obb.federal_reserve.download(url=['https://www.federalreserve.gov/pub/pdf'])
Defensive patterns

Strategy: validation

Validate before calling

from urllib.parse import urlparse
assert urlparse(url).scheme == 'https' and urlparse(url).hostname in {'www.federalreserve.gov', 'federalreserve.gov'}, url

Type guard

def is_fed_gov_url(url: str) -> bool:
    p = urlparse(url.strip())
    return p.scheme == 'https' and (p.hostname or '').lower() in {'www.federalreserve.gov', 'federalreserve.gov'}

Prevention

When it happens

Trigger: Passing url=['http://www.federalreserve.gov/...'] (http scheme), a www-less or different domain (e.g. federalreserve.gov.cdn.example.com), a URL with uppercase scheme/hostname parsing quirks, or a non-federalreserve.gov link such as a NY Fed document.

Common situations: Users pasting links from search results that point at mirror or archive domains; omitting the https:// scheme; trying to fetch fomcdocs from other sites through this router.

Related errors


AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14). Data as JSON: /api/errors/3977ee7b6d60759c. Report an issue: GitHub.