You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Echo v4.15's CSRF middleware treats Sec-Fetch-Site: same-origin or none as
already-safe and returns before comparing the CSRF token. A non-browser client
that forges that header while holding a session cookie can call CSRF-protected
routes without a token. Echo is already on the latest v4.15.4 and offers no
config knob to force validation, so neutralize the short-circuit in NewCSRF:
for non-skipped requests, strip a same-origin/none Sec-Fetch-Site value before
Echo inspects it so Echo always runs its token-validation path, then restore
the header via defer. same-site and cross-site are left intact, preserving
Echo's explicit cross-site block.
EnsureCSRFToken now ignores Echo's Sec-Fetch-Site sentinel so the SPA is never
handed the sentinel as a usable token.
Remove CSRFCookieRefresh: it re-set the cookie after the handler committed the
response, which is a no-op in production. With the short-circuit neutralized,
Echo's own token path refreshes the cookie's expiry before commit on every
non-skipped request, so the workaround is no longer needed.
Add regression tests covering the bypass across Sec-Fetch-Site values and
unsafe methods, the legitimate token round-trip, the skipped-route exemption,
a mismatched-token rejection, and the sentinel guard.
0 commit comments