-
-
Notifications
You must be signed in to change notification settings - Fork 80
fix(sso): admin auth-redirect preempts incoming cookie-less token - infinite customize.php <-> /login/ loop (site customizer down) #1636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -390,6 +390,19 @@ | |
| if ($this->input($sso_path) && $this->input($sso_path) !== 'done') { | ||
| return true; | ||
| } | ||
| /* | ||
| * A request that already carries a cookie-less SSO token must not kick | ||
| * off a new SSO round-trip: handle_cookie_less_sso_token() (init:4) is | ||
| * about to consume it and set the auth cookies. Without this | ||
| * short-circuit, wp-admin URLs like customize.php?wu_sso_token=... are | ||
| * redirected to the main /login/ BEFORE consumption, the main site mints | ||
| * yet another token and the browser loops forever between customize.php | ||
| * and /login/ (~2 rounds/sec observed in production access logs). This | ||
| * mirrors the $sso_path short-circuit right above. | ||
| */ | ||
| if ('' !== (string) $this->input('wu_sso_token', '')) { | ||
| return true; | ||
|
Comment on lines
+403
to
+404
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Reject non-string SSO tokens before bypassing authentication.
Proposed fix- if ('' !== (string) $this->input('wu_sso_token', '')) {
+ $wu_sso_token = $this->input('wu_sso_token', '');
+
+ if (is_string($wu_sso_token) && '' !== $wu_sso_token) {
return true;
}Also make 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| $should_skip_redirect = $this->get_isset($_COOKIE, 'wu_sso_denied', false); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Add the required blank line before the block comment.
This line triggers the static-analysis warning for a missing empty line before the new comment.
🧰 Tools
🪛 GitHub Check: Code Quality Checks
[warning] 393-393:
Empty line required before block comment
🤖 Prompt for AI Agents
Source: Linters/SAST tools