Handle cookie-gate redirects that loop to the same URL#396
Open
beginner59 wants to merge 4 commits into
Open
Conversation
2 tasks
26d8f7f to
adf61d6
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #396 +/- ##
============================================
+ Coverage 95.85% 96.37% +0.51%
- Complexity 704 713 +9
============================================
Files 17 17
Lines 1908 1930 +22
============================================
+ Hits 1829 1860 +31
+ Misses 79 70 -9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Sites like tagesanzeiger.ch respond with 302, Set-Cookie, and a Location header pointing back to the same URL. RedirectPlugin throws CircularRedirectionException before cookies are stored. Store Set-Cookie from the redirect response and retry the request once so the entitlement token is sent on the follow-up request.
Remove redundant method_exists() checks that fail PHPStan on CircularRedirectionException, and add tests for non-cookie-gate redirects and CookiePlugin edge cases. Co-authored-by: Cursor <cursoragent@cursor.com>
ef64689 to
23a46a1
Compare
Keep the non-cookie-gate redirect regression test, but stop asserting into Monolog test record offsets so the test suite stays within the existing PHPStan ignore count. Co-authored-by: Cursor <cursoragent@cursor.com>
Drop brittle Monolog record-index assertions that broke PHPUnit on CI while keeping behavioral checks for cookie-gate retry and no-retry paths. Co-authored-by: Cursor <cursoragent@cursor.com>
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
Some sites (for example Tamedia/Piano CMS pages such as
tagesanzeiger.ch) respond with:302 FoundSet-CookieLocationpointing back to the same URLIn this case
RedirectPluginraisesCircularRedirectionExceptionbefore the cookie plugin can persist the cookie, so the follow-up request never includes the entitlement token.This patch fixes that by:
CookiePluginto the plugin chainCookiePlugin::storeSetCookies()for manual persistenceTest plan
testCookieGateRedirectRetriesWithStoredCookieentitlementToken