Fix failing Cypress E2E suite: login redirect (cookie_secure) and CI PHP 8.4 bump#3757
Open
Vondry wants to merge 2 commits into
Open
Fix failing Cypress E2E suite: login redirect (cookie_secure) and CI PHP 8.4 bump#3757Vondry wants to merge 2 commits into
Vondry wants to merge 2 commits into
Conversation
Setting cookie_secure: true forces the session-domain constraint (used by HttpUtils::createRedirectResponse since the open-redirect fix) to require HTTPS targets. On plain-HTTP installs the saved target path is an http:// URL, so the post-login redirect fails the https-only regexp and falls back to '/', landing users on the homepage instead of /bolt/. This broke every Cypress login test. 'auto' sets the Secure flag only on HTTPS requests (Symfony's recommended default), restoring same-host HTTP redirects while keeping open-redirect protection intact on HTTPS.
composer.lock resolves dependencies that require PHP >= 8.4 (doctrine/instantiator ^8.4, symfony/type-info >= 8.4.1, and serializer packages using PHP 8.3+ typed class constants). The Cypress job pinned PHP 8.2, so those packages fatal at parse time on serializer-backed routes (api-platform content endpoints and frontend content rendering), which showed up as intermittent 502 Bad Gateway in the e2e run. Bump the job to 8.4 so the runtime matches the locked deps.
Vondry
force-pushed
the
fix/login-redirect-cookie-secure
branch
from
July 23, 2026 13:45
1f46cc3 to
46cb956
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This MR fixes two independent issues that caused the Cypress end-to-end suite to fail in CI. The changes are unrelated and can be reviewed independently:
/instead of/bolt/after login.Two files change:
config/packages/framework.yaml—cookie_secure: true→cookie_secure: 'auto'.github/workflows/cypress_tests.yaml—PHP_VERSION: 8.2→PHP_VERSION: 8.4Part 1 — Fix login redirect timeouts (
cookie_secure)Problem
Every login-based test failed with:
Authentication succeeded, but users were redirected to the homepage instead of the Bolt dashboard, causing the
/bolt/assertion to time out.Root cause
The regression resulted from the interaction of two independent commits:
fbd0ed3a— Resolve framework configuration deprecationscookie_secure: true(previously omitted, using Symfony's default offalse).db37ed5d— Block open redirect on login endpointnew RedirectResponse(...)withHttpUtils::createRedirectResponse(...)for post-login redirects.HttpUtils::createRedirectResponse()validates redirect targets against a regular expression generated from the session cookie configuration (AddSessionDomainConstraintPass). Withcookie_secure: true, Symfony generates an HTTPS-only pattern ({^https://<host>$}i).The failing flow was:
loginhelper visits/bolt, so Symfony stores the target path ashttp://127.0.0.1:8088/bolt.symfony server:start --no-tls).http://...URL fails the HTTPS-only validation, socreateRedirectResponse()falls back to/./bolt/assertion to time out.This was broader than a test-only issue. Any Bolt installation running over plain HTTP would also have broken login sessions because browsers discard
Securecookies on HTTP.The fix
cookie_secure: 'auto'is Symfony's recommended value for this deprecation. It applies theSecureflag only when the current request uses HTTPS.As a result:
http://andhttps://same-host URLs, restoring the post-login redirect to/bolt/.Security impact: None for correctly configured HTTPS deployments. On HTTPS,
autobehaves identically totrue. On HTTP,truenever provided meaningful protection because browsers discardSecurecookies anyway.Part 2 — Fix 502 Bad Gateway errors (PHP 8.4)
Problem
With Part 1 fixed, the login tests passed, but the content- and API-related tests then failed with:
on serializer-backed routes, including the
/api/...content endpoints, public content-rendering routes (/entry/...,/page/...,/test/...), and content listings. Admin pages that do not hit the serializer continued working, making the failures appear unrelated.Root cause
composer.lockis intentionally gitignored, so CI resolves dependencies from scratch on every run based oncomposer.json("php": ">=8.2").The e2e workflow was pinned to PHP 8.2. Under PHP 8.2, the freshly resolved API Platform / Symfony serializer stack fatals while serializing or instantiating content entities, causing every serializer-backed route to return HTTP 502. Non-serializer admin pages were unaffected.
The fix
Upgrade the Cypress workflow to PHP 8.4, allowing Composer to resolve a dependency set that works correctly at runtime. All serializer-backed routes then render successfully.