--- id: requests-hardened version: "1.3.0" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # requests-hardened — A library that overrides the default behaviors of the requests library, and adds new security features. License: permissive · Maintenance: active · Downloads: 190.4K/mo ## What it is and what it does requests-hardened is a security-focused wrapper around the requests library that applies hardened defaults and adds SSRF protection. It lets you configure global security policies like enforcing request timeouts, disabling redirects, and filtering outbound requests to private IP ranges—preventing server-side request forgery attacks where untrusted user input could be used to probe internal infrastructure. The library works by wrapping requests.Session and intercepting HTTP calls through a Manager and Config object. You set security policies once (timeout, redirect behavior, SSRF filtering rules) and then use the manager to send requests or get sessions, ensuring those policies apply consistently. It supports proxies including SOCKS4/SOCKS5, and the SSRF filter can be tuned to allow or block loopback addresses depending on your threat model. Use it for: - Protect web applications that make HTTP requests based on user input from SSRF attacks by filtering private IP ranges. - Enforce organization-wide HTTP client security policies like mandatory request timeouts and disabled redirects across multiple services. - Build secure API clients that reject redirects and enforce User-Agent headers to prevent header injection or redirect-based attacks. - Combine with proxy configurations for defense-in-depth, filtering tunneled requests while trusting the proxy itself. - Harden microservices that call internal APIs to prevent attackers from pivoting through HTTP requests to localhost or private networks. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Wraps the requests library to enforce security defaults and block SSRF attacks by filtering private and loopback IP addresses. Yes, if you make HTTP requests based on untrusted user input or need to enforce consistent security defaults across your application. The single dependency on requests, active maintenance, permissive license, and zero known vulnerabilities make it a low-risk addition. Install it if SSRF protection or global timeout/redirect policies matter for your threat model; skip it if your requests are fully trusted or you handle these concerns elsewhere. ## Install pip install requests-hardened uv add requests-hardened poetry add requests-hardened ## Installing requests-hardened Before you install: Low install friction with a single runtime dependency on requests. Active maintenance with a recent release 31 days ago and a commit from 2026-08-10. License in practice: BSD-3-Clause permissive license allows commercial and private use with minimal restrictions. Quickstart: pip install requests-hardened from requests_hardened import Config, Manager http_manager = Manager( Config( default_timeout=(2, 10), ip_filter_enable=True, ip_filter_allow_loopback_ips=False ) ) resp = http_manager.send_request("GET", "https://example.com") Requires Python 3.10 or later. For SOCKS4/SOCKS5 proxy support, requires pip install requests[socks]. Verify before relying: - Whether SSRF filtering covers all edge cases in URL parsing or DNS rebinding attacks. - Performance overhead of IP filtering on high-throughput HTTP clients. - Compatibility with requests library versions beyond the tested range. ## Package facts - License: BSD-3-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 190.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags ssrf filter requests, requests security hardening, block private ip addresses http, secure http client defaults, requests library security wrapper, ssrf-protection, http-security, requests-wrapper [View on SkillFed](https://skillfed.io/packages/requests-hardened) · [View on PyPI](https://pypi.org/project/requests-hardened/)