fix: allow SSO redirects to mapped domains#1609
Conversation
📝 WalkthroughWalkthroughThis PR adds an ChangesSSO Redirect Host Validation
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant WordPress as WordPress Filter System
participant SSO as SSO::allow_sso_redirect_hosts
participant DomainModel as WP_Ultimo\Models\Domain
participant SiteLookup as get_site_by_path/get_sites
WordPress->>SSO: apply_filters(allowed_redirect_hosts, host)
SSO->>SSO: normalize_redirect_host(host)
SSO->>DomainModel: get_by_domain(normalized host)
alt domain mapping available and matched
DomainModel-->>SSO: mapped domain found
else fallback
SSO->>SiteLookup: get_site_by_path/get_sites(host)
SiteLookup-->>SSO: site match result
end
SSO->>SSO: get_redirect_host_variants(host)
SSO-->>WordPress: return expanded, deduplicated allowed_hosts
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
Summary
allowed_redirect_hostsallow-list is registered in SSO grant contexts.Verification
php -l inc/sso/class-sso.php && php -l tests/WP_Ultimo/SSO/SSO_Coverage_Test.phpvendor/bin/phpcs inc/sso/class-sso.php tests/WP_Ultimo/SSO/SSO_Coverage_Test.phpwp --url=https://mygratis.site eval '$hosts = apply_filters("allowed_redirect_hosts", ["mygratis.site"], "ultimatemultisite.com"); echo implode("\n", $hosts) . "\n";'confirmedultimatemultisite.comis allowed locally.mygratis.site/sso-grant->ultimatemultisite.com/sso?...sso_verify=invalid->ultimatemultisite.com/Notes
Class "PHPUnit\\TextUI\\Command" not found.