nowo-tech / outbound-url-guard-bundle
Symfony bundle that blocks SSRF on outbound http(s) URLs: private networks, cloud metadata, and optional DNS pinning.
Package info
github.com/nowo-tech/OutboundUrlGuard
Language:Shell
Type:symfony-bundle
pkg:composer/nowo-tech/outbound-url-guard-bundle
Fund package maintenance!
Requires
- php: >=8.2 <8.6
- symfony/config: ^7.4 || ^8.0
- symfony/dependency-injection: ^7.4 || ^8.0
- symfony/http-kernel: ^7.4 || ^8.0
- symfony/process: ^7.4 || ^8.0
- symfony/yaml: ^7.4 || ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.64
- nowo-tech/phpstan-frankenphp: ^1.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^11.0
- rector/rector: ^2.0
- symfony/phpunit-bridge: ^7.4 || ^8.0
Suggests
- symfony/flex: For automatic recipe installation
- symfony/http-client: To open the pinned URL after the guard accepts it
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-18 18:36:41 UTC
README
⭐ Found this useful? Install it from Packagist and star OutboundUrlGuard.
Symfony bundle that checks an outbound http or https URL before your app opens the connection. It blocks loopback, private, and reserved addresses, plus cloud metadata, and can pin a hostname to the first public DNS answer.
Compatible with Symfony 7.4, 8.0, and 8.1. PHP 8.2+ (Symfony 8.x requires PHP 8.4+).
This bundle is FrankenPHP worker mode friendly.
Features
- Rejects schemes other than
httpandhttps. - Blocks loopback, RFC1918, link-local, unique-local, and other addresses PHP marks private or reserved.
- Blocks cloud metadata even when
allow_privateis true, including decimal, hex, and IPv4-mapped forms. - Optional DNS resolution with an HttpClient
resolvepin (IPv4 preferred) and a configurable socket timeout. - Does not open the HTTP connection. Callers still set TLS, timeouts, and
max_redirects: 0.
Installation
composer require nowo-tech/outbound-url-guard-bundle
Flex registers the bundle from type: symfony-bundle. See Installation.
Requirements
- PHP
>=8.2 <8.6 - Symfony components
^7.4 || ^8.0(symfony/config,symfony/dependency-injection,symfony/http-kernel,symfony/process,symfony/yaml)
Configuration
nowo_outbound_url_guard: allow_private: false resolve_dns: true dns_timeout: 2.0
Full key list: Configuration.
Usage
use Nowo\OutboundUrlGuardBundle\Guard\OutboundUrlGuard; $options = $guard->httpClientOptions($url); $options['max_redirects'] = 0;
Docker service names: $guard->assertSafe('http://mercure/.well-known/mercure', resolveDns: false);
Documentation
- Installation
- Configuration
- Usage
- Contributing
- Code of Conduct
- Changelog
- Upgrading
- Release
- Security
- Engram
- Spec-driven development
- GitHub Spec Kit
Additional documentation
Tests and coverage
- PHPUnit unit and integration tests (
composer test,make test) - PHP: 100%
- TS/JS: N/A
- Python: N/A
make test-coverage prints the PHP Lines percentage and fails when Clover statement coverage is below 99%. make test-coverage-100 requires 100%.
License
MIT. See LICENSE.
Contributing
See Contributing and the Code of Conduct.
Version policy
The 1.x line is supported. Report vulnerabilities privately as described in Security.
