I suggest upstreaming this to reduce differences and so as to avoid things breaking in CI when there's an easy fix that we already apply in various places including:
- We currently set -e 'HOME=/tmp' in fresh-node18, node20, node22, etc.
- We set HOME=/tmp in the firefox wrapper in node-test-browser images for WMF CI.
- We set (as of today) HOME=/tmp in Quibble images to fix firefox-esr for QUnit tests (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/947898).