Maintaining a plugin with thousands of sites
ContenidoContents
In October, according to the moodle.org stats, mod_jitsi was installed on 3,407 sites and had been downloaded 1,888 times in the previous 90 days. The first commit is from 12 February 2019. In 2021 it reached about 6,300 sites. The big jump was in March and April 2020: from 108 to 2,015, because of the pandemic.
With numbers like that, publishing a release is not the hard part. The hard part is what comes after: a security advisory, a patch, and deciding whether to ship another version eleven days after the last one.
A flaw, a report and a patch on the same day
On 4 November I audited the code. Among other things, I found a bug in universal.php: the guest link did not check the invitation token again when someone joined.
I prepared the patch in private. On 8 November, Netanel Stern (@netanelcyber) privately reported that same bug, through GitHub’s private security advisories. He had found it on his own, and he reported it the right way.
That same day I shipped 5.5.1, at 10:19 (Madrid time), and at 10:22 I published the advisory. The severity is high. It does not have a CVE yet.
Another release, eleven days later
Eleven days later I shipped 5.5.2 (build 2026111901), on 19 November at 21:11 (Madrid time). It is published on GitHub and on the Moodle Marketplace.
The issue was found by an internal audit, with no external reporter. The session presence web services (join, leave and heartbeat) could be called without signing in, so anyone could fake who was connected.
The fix requires a signed presence token or the permission to view the activity. I tested it by hand on Moodle 5.3 and 5.1, and also with curl-based attacks.
At 21:14 I published the advisory. The severity is moderate. It affects versions up to 5.5.1 and is patched in 5.5.2. It does not have a CVE yet; one has been requested.
The process was a draft advisory and a private fork. The fix landed on dev on 16 November; the release and the advisory went out together. This is the case of fixing first and disclosing when you publish.
5.5.2 also includes two hardening changes. On my own Moodle, with 5.5.1, I saw that if the plugin folder is web-accessible you can request api/composer.json, api/composer.lock and api/vendor/composer/installed.json. The plugin does not need them to run, and they reveal the exact versions of the dependencies. PR 227 drops them from each release zip. They stay in the repository, so Dependabot is unaffected.
PR 228 adds an api/.htaccess file that, on Apache, denies web access to api/. On nginx, the rule has to go in the server configuration.
Why not wait
The question was fair: 5.5.1 had just come out. Do I ship another one already? Yes, because it is a security fix and the code was already public on the dev branch. Other changes get spaced out. A security patch does not.
There are 932 sites on Moodle 4.5, 464 on 4.0 and 218 still on 3.9. Asking everyone to update for an urgent fix is not the same as asking them to update every few days for improvements. Anyone on an old version already has enough work keeping the campus running.
How the workflow is set up
All work goes to dev first. It only reaches master when there is a release. These past months I have also been paying down technical debt in the same plugin. That helps a patch come out cleaner. It does not change the rule for when to publish it.
CI runs PHPUnit on Moodle 4.5, 5.1, 5.2 and 5.3, with PostgreSQL and MySQL; also Behat, the coding style checks, and a check that api/vendor matches composer.lock.
Dependabot proposes a weekly bump of google/apiclient-services. Each time, api/vendor has to be regenerated before the merge.
Publishing is automated, in the same workflows folder: bump-version.yml on merge to master, release.yml when the tag is created (a GitHub release and a moodle.org listing) and camp-release.yml for CAMP.
That takes friction out of shipping a patch. It does not take away the decision of whether it is time to ship one.