Page MenuHomePhabricator

ReadingLists items contain non-secure project URLs
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:
Page doesn't render.
ReadingLists return with projects using http:// in URL rather than https://
API request is made to http:// rather than making use of current protocol "//"

What should have happened instead?:

Not sure if this due to ReadingList extension or patchdemo but I would expect getCanonicalServer to return https.

	/**
	 * @return string
	 */
	private function getLocalProject(): string {
		$url = MediaWikiServices::getInstance()->getUrlUtils()->getCanonicalServer();
		if ( $url === '' ) {
			return '';
		}

		$parts = MediaWikiServices::getInstance()->getUrlUtils()->parse( $url );
		$parts['port'] = null;
		$project = MediaWikiServices::getInstance()->getUrlUtils()->assemble( $parts );

		return $project;
	}

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Details

Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
stop trying to detect server protocolrepos/test-platform/catalyst/patchdemo!130jnucheT389560main
Customize query in GitLab

Event Timeline

It seems like this issue isn't due to the ReadingLists extension itself, because it makes sense for the canonical URL to always return https:// even if http:// is also supported. We should also ensure the proper URL is being returned for development environments when the server is running off localhost/127.0.0.1. It also looks like getLocalProject() is setting the port to null, which might be a mistake since the Docker container defaults to http://localhost:8080 for web browsers.

thcipriani subscribed.

This will require some digging in PatchDemo/Catalyst

Open questions I have (before digging)

  • Can we recreate this in Catalyst PatchDemo (i.e., with Catalyst checkbox checked)? Or is this Legacy PatchDemo only?
    • If someone beats us to this, that'd be neat
  • Is this related to mod_php config in legacy patch demo?

Worth some exploration in our next sprint: starts April 1.

T369385#10646417 and the following two comments (except @gerritbot) are about a very similar issue, probably the same underlying bug. @Lucas_Werkmeister_WMDE noted over there that Catalyst works better than legacy Patch Demo.

Just hardcode HTTPS URLs for $wgServer and $wgCanonicalServer. The whole concept of supporting both HTTP and HTTPS at the same time is very dated, we should just get rid of it (T372396: Remove mixed HTTP/HTTPS mode support from MediaWiki).

Thanks for investigation. Does seem like the issue here sits with patchdemo's configuration.

thcipriani added a subscriber: jnuche.

Assigning to @jnuche for some initial investigation on the PatchDemo/Catalyst side.

Catalyst wikis were not affected by this issue.

I could reproduce the problem with a local patchdemo instance and fix it. Fix is in prod, where I just tried creating a new legacy patchdemo wiki. I could see all requests generated from the Special:ReadingLists subpages using HTTPS and the lists were loaded correctly.

Thanks to everyone for your comments, especially @Tacsipacsi's which lead me to the MR where we fixed this issue for the Catalyst wikis: https://gitlab.wikimedia.org/repos/test-platform/catalyst/ci-charts/-/merge_requests/41

@Jdlrobson-WMF can you check that the issue is also fixed for you? You'll need to create a new wiki ufortunately, the fix won't apply retroactively to existing environments.

Awesome, glad it's working!