Fossil SCM
checkin/fb3970684dd6b7980d08d5071b413c3caad8129b791d9784508719fa6ba20e63
Redirect to another site after a login
login_redirect_to_g() in src/login.c takes the fossil-goto value from a
query parameter, a form field or a cookie, and after a successful login sent
the browser to it as given. That includes the anonymous login, which needs no
account, and the answer to the robot check at /ityaar. A link could
therefore send a user to any site by way of the repository's own login page.
The fix follows the value only when it names a page of this repository: the base URL followed by "/" or by nothing. Anything else goes to the home page. 94412d502b goes with it.
Tested on macOS: addresses on another site, on a host whose name begins with
this one's, and without a scheme now go to the home page, by each of the
three routes and for each kind of login; an address on this site is followed
as before. The tests are in test/login.test, which will come with the
test-suite work. Not run on Linux or Windows.