ctors/pledge-symfony-routing
pledge() and unveil() syscalls to enforce strict process capabilities and filesystem access controls. This is not a general-purpose Laravel/PHP solution but rather a security-hardening layer for Symfony applications running on OpenBSD.#[Route]). Laravel compatibility is indirect—it would require a bridge layer (e.g., a custom middleware or route service provider) to translate Laravel’s routing to Symfony’s attribute system.pledge in php.ini or FPM pools).ext/pledge is OpenBSD-only (no Linux/macOS/Windows support). Even if Laravel were compatible, the underlying syscalls are unavailable outside OpenBSD.pm.max_requests = 1 to prevent process reuse, which may impact performance in high-throughput environments.pledge()/unveil() failures are binary (success/failure) with minimal error context. Debugging misconfigured routes could be painful.Route::get(), closures, or controller methods without attributes) cannot natively use these annotations. Workarounds (e.g., middleware) would add overhead.pledge() calls per request may increase context-switching if not optimized (e.g., shared pledges across routes).pledge() in php.ini sufficient?pm.max_requests = 1 may require horizontal scaling (more FPM workers) to maintain throughput.pledge() is unavailable?Pledge/Unveil annotations.pledge()/unveil() before execution.ext/pledge enabled. No polyfill for other systems.composer require ctors/pledge-symfony-routing).#[Pledge]/#[Unveil] to controllers/actions.pm.max_requests = 1).pledge()-compliant routes (e.g., restrict inet for DB calls).// app/Providers/RouteServiceProvider.php
public function boot()
{
Route::get('/example', function () {
// ...
})->middleware(PledgeMiddleware::class);
}
pledge()/unveil().HttpKernel as a micro-framework within Laravel (advanced, high coupling).pecl-pledge (e.g., PHP 8.2 in the example). Version alignment needed between PHP, Symfony/Laravel, and pecl-pledge.pledge()/unveil() are OpenBSD-exclusive.pecl-pledge on OpenBSD.pm.max_requests = 1).pledge() failures (e.g., unveil() to a restricted path should return 403).pm.max_requests = 1 to ensure no process leaks.inet pledge).pledge()/unveil() failures (e.g., via Symfony’s error handler).Pledge/Unveil are applied to Laravel routes.pecl-pledge updates may require PHP/FPM restarts.pledge() syscall is stable but niche—few community resources for troubleshooting.pledge() failures are binary—tools like strace or OpenBSD’s pledge -v may help.pledge() violations (e.g., "Route blocked: missing inet pledge").misclug).pm.max_requests = 1 prevents process reuse, increasing memory usage. May require:
pledge() calls (e.g., reuse pledges across similar routes).rwc unveil) may need shared storage (e.g., NFS with unveil permissions).inet pledge for TCP DB connections may limit connection pooling (e.g., MariaDB’s unix_socket is pledge-free).| Failure Scenario | Impact | Mitigation |
|---|---|---|
unveil() to restricted path |
403/500 errors | Validate paths in tests; use chmod/chown to align permissions. |
Missing pledge() syscall |
Silent failure (OpenBSD-only) | Feature flag for non-OpenBSD; graceful degradation. |
pm.max_requests = 1 memory leaks |
How can I help you explore Laravel packages today?