jeffersongoncalves/laravel-ssrf-guard
A Laravel package that helps protect your app from Server-Side Request Forgery (SSRF) by validating outbound URLs and blocking requests to private, loopback, and reserved network ranges. Useful for guarding HTTP clients and any user-supplied URLs.
laravel-ssrf-guard defends outbound HTTP calls against Server-Side Request Forgery — the class of bug where an attacker tricks your server into fetching internal addresses (127.0.0.1, 169.254.169.254 for cloud metadata, 10.0.0.0/8, etc.).
composer require jeffersongoncalves/laravel-ssrf-guardphp artisan vendor:publish --tag=ssrf-guard-config) and skim config/ssrf-guard.php — this is where the blocklist/allowlist, allowed schemes, and redirect policy live.Http::get() / GuzzleHttp\Client.The first real-world use case is almost always "user supplies a URL, server fetches it" — webhook registration, image/avatar import from a URL, RSS feed ingestion, PDF/screenshot generation, or SSRF-prone "preview this link" features. Reach for this package the moment a URL comes from a request payload rather than from your own config.
Http client-level hook so every outbound request goes through the guard, not just the ones where someone remembered to call it. If the package exposes this, wire it in a ServiceProvider::boot() behind a config flag.Http client follows redirects by default. Ensure each hop is re-validated, or disable redirect-following and handle them yourself.ssrf-guard.php, not scattered across controllers.evil.com can resolve to 127.0.0.1. Resolve first, check the IP, and ideally pin the connection to that IP.http://169.254.169.254/. Each hop must be checked.2130706433), octal (0177.0.0.1), IPv6-mapped (::ffff:127.0.0.1), and DNS tricks can bypass naive string checks. Normalize before comparing.169.254.0.0/16 (link-local / cloud metadata), 0.0.0.0/8, 100.64.0.0/10 (CGNAT), fc00::/7, ::1, and the IPv4-mapped IPv6 range.http://127.0.0.1, http://[::1], http://localhost, metadata IPs, and a fake-DNS redirect.v1.0.1...v1.1.0 and check the CHANGELOG before upgrading, particularly for changes to default CIDR coverage or redirect behavior, since silent loosening of those defaults is the security-relevant failure mode.Caveat: the v1.1.0 release body is only a changelog link, so the exact API surface (facade name, rule class, macro name, config keys) should be confirmed against the package's README before copying any snippet.
How can I help you explore Laravel packages today?