enumag/csrf-route-bundle
enumag/csrf-route-bundle (GenedysCsrfRouteBundle) secures Symfony 3 routes against CSRF attacks without forms. Add a csrf_token option to any route; the bundle's router appends a token query parameter and a controller listener validates it on incoming requests.
VerifyCsrfToken protects form-driven POST/PUT/DELETE out of the box, but many real products still ship state-changing actions as GET links (logout, delete, archive, toggle, "mark all read", one-click unsubscribe) or as XHR calls that bypass the token in a refactor. This package's core idea — per-route opt-in CSRF protection that does not require a form — is a valid roadmap item called "harden non-form mutation paths," and it is worth scheduling whether or not this repo is ever installed.ServiceProvider, no config/ publish target, no facade, and no Laravel middleware, so it cannot be composer required into a Laravel app without a port. The realistic estimate for a native equivalent (a route-group middleware, a token issuance helper using csrf_token(), hash_equals comparison, and a 401/419 response) is 1–2 engineer-days plus tests. The package's real contribution is a proven API shape — per-route annotation/option, token attached at URL-generation time, validated before the controller — which de-risks that estimate. Buy the pattern, build the code.<a href> links; internal tools where "it's behind SSO" is the only current control; HTML endpoints that aren't form-driven; migrating a form-based flow to fetch/XHR without losing the token guarantee; logout via GET.Consider it — as reference material, not a dependency — only if:
options: { csrf_token: true }) to align an internal design doc before writing middleware.Look elsewhere — decisively — if:
VerifyCsrfToken middleware, the @csrf Blade directive, csrf_token() for programmatic URLs, X-XSRF-TOKEN for Axios/XHR, and Sanctum for the SPA/API case. For non-form routes the work is a middleware/route-group configuration decision, not a package decision. This framework mismatch is the single most important line in this assessment.symfony/security-csrf plus a small route/kernel listener.SameSite cookies with explicit origin checks.enumag/csrf-route-bundle, README installs genedys/csrf-route-bundle. Combine that with 0 stars, 0 dependents, README-only maturity, and no releases/issues/CVE feed — the MIT license is fine, the stewardship is not. That mismatch is exactly what flags in a lockfile review.One-line rule: relevant as design input for a Laravel middleware; never as a dependency.
To executives (30 seconds): We found a small open-source project that solves a real, narrow security problem — protecting state-changing routes that aren't form submissions, a common blind spot in older web apps. The project itself is not safe to depend on: it targets an end-of-life framework version, has zero users, and has no active maintainer. My recommendation is to adopt the idea, not the code. We can implement the equivalent in our own Laravel stack in a day or two, fully owned by us — cheaper than the risk of inheriting an abandoned dependency. Small upfront cost, meaningful reduction in a class of vulnerability an auditor or pen-test would otherwise find.
To engineering leads: The value here is the pattern, not the package. It shows a per-route opt-in surface (annotation/route option), token attached at URL-generation time, validation in a listener before the controller runs, plus configurable field name, intention, and covered HTTP methods. Two takeaways: (1) that API shape is a good template; (2) "no form" is not "no CSRF exposure." Do not add the Composer dependency — it's a Symfony 3 bundle, Symfony 3 is EOL, the repo name doesn't match the install target, and there are no dependents to shake out bugs. Instead please scope native work in Laravel: a route-group middleware extending our CSRF handling, a helper for generating protected URLs, hash_equals comparison, a 419 response contract, and a test matrix covering link-triggered destructive GETs, XHR deletes, and the logout path. Estimate 1–2 days plus tests. Definition of done: every state-changing route in the inventory is behind the middleware or explicitly documented as exempt.
To security/compliance: This is a validated gap with an unvalidated fix. It supports the control narrative "all state-changing requests require a token, including non-form routes," which is defensible to an auditor. The shipped implementation must be ours, with a documented token lifetime, rotation on privilege change, and an exemption list that is reviewed rather than implicit. Please confirm whether scope is HTML routes only or also the XHR/SPA surface — the latter changes the header strategy (X-XSRF-TOKEN / SameSite + origin checks) and the test plan.
Bottom line for the decision log: Reject as a dependency — framework mismatch (Symfony 3 bundle in a Laravel codebase), EOL platform, no stewardship, package-identity mismatch. Accept as a design input for a native Laravel middleware. Owner: platform team. Timeline: next hardening sprint. Success metric: zero state-changing routes without token enforcement or a documented exemption.
How can I help you explore Laravel packages today?