[MEDIUM] [SEC-15] `UrlValidator::isValidRedirect()` permits any HTTP/HTTPS host when `$allowedDomain` is null — open redirect
Audit Finding: SEC-15
- Severity:
MEDIUM - Category: Open redirect
- File:
src/Security/UrlValidator.php:112-134
Description
When called without the optional $allowedDomain argument, the method returns true for any URL with an http/https scheme and a host. Any caller that does not pass an explicit allowlist gets an open-redirect sink. The method is public static, so any controller can invoke it with a user-supplied URL and trust the result.
Impact
If used to validate a ?next= or return_to= parameter, an attacker can craft https://ownpay.example/login?next=https://attacker.com/ phishing and redirect users post-login.
Reproduction
UrlValidator::isValidRedirect('https://attacker.com/') → true.
Recommended Fix
Make $allowedDomain mandatory, or return false when it is null. Callers should always pass the application's canonical host.
Discovered during comprehensive codebase audit. See /home/z/my-project/worklog.md for full audit context.
Duplicate Issue — Closed
This issue is a duplicate of #309 (same audit finding SEC-15 — both issues share the same title, file path, and description).
The fix has been implemented and is ready for review in PR #523: https://github.com/own-pay/OwnPay/pull/523
Tracking will continue under the canonical issue #309, which is referenced by the PR's Closes #309 line and will be auto-closed when the PR merges.
Closing this duplicate as not_planned to keep the audit tracker clean.