Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix(release): map non-root browser mount access

pulse-triage[bot]0d0b1053527a
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index dbcd4eacf9..4cf5315ccb 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -2153,8 +2153,18 @@ artifact-selection behaviour.
version selection and exit status. The executed-shell fixture in
`scripts/release_control/internal/release_preflight_test.py` verifies the
runner path, argument quoting, container identity and failure propagation
- with mocked Docker; it is not browser qualification or proof that the
- retained spawn-sh EACCES failure has been repaired.
+ with mocked Docker; it is not browser qualification.
+
+ After npm ci and image selection, the worker reads the selected non-root
+ container's UID map. When that UID maps to a different host identity,
+ POSIX ACLs grant only that mapped UID read/write/search access within the
+ disposable `tests/integration` bind mount, without following symlinks.
+ Default directory ACLs retain the host worker's access to generated evidence.
+ No checkout-wide chmod, world access, root container, or gate bypass is
+ permitted. Missing mapping/ACL support fails preparation closed. Identity
+ mappings need no ACL change. A bounded real-container CLI startup and
+ evidence read/cleanup probe is prerequisite evidence, not a browser pass
+ or exact-candidate admission; the original failed admission remains retained.
## Forbidden Paths
diff --git a/scripts/release-preflight-worker.sh b/scripts/release-preflight-worker.sh
index 19a859e969..7a1d84ccc6 100755
--- a/scripts/release-preflight-worker.sh
+++ b/scripts/release-preflight-worker.sh
@@ -204,11 +204,41 @@ run_backend() {
fi
}
+# Rootless Docker maps the selected non-root UID to a subordinate host UID.
+# Grant only that identity access to the disposable integration bind mount;
+# never make the checkout world-readable/writable or change container identity.
+prepare_playwright_mount() {
+ local host_uid mapped_uid uid_map integration_dir
+ host_uid="$(id -u)"
+ integration_dir="$REPOSITORY_DIR/tests/integration"
+ uid_map="$(docker run --rm --user "$(id -u):$(id -g)" \
+ "$PLAYWRIGHT_IMAGE" cat /proc/self/uid_map)"
+ mapped_uid="$(printf '%s\n' "$uid_map" | awk -v uid="$host_uid" '
+ NF == 3 && uid >= $1 && uid < $1 + $3 { print $2 + uid - $1; found++ }
+ END { if (found != 1) exit 1 }
+ ')"
+ if [[ ! "$mapped_uid" =~ ^[0-9]+$ ]] || [ "$mapped_uid" = 0 ]; then
+ echo "Error: invalid non-root browser UID mapping." >&2
+ return 3
+ fi
+ [ "$mapped_uid" != "$host_uid" ] || return 0
+ command -v setfacl >/dev/null || {
+ echo "Error: setfacl is required for the rootless browser mount." >&2
+ return 3
+ }
+ # -P avoids following dependency symlinks outside this disposable tree.
+ setfacl -R -P -m "u:${mapped_uid}:rwX" "$integration_dir"
+ # Retain host access to evidence subsequently created by the mapped UID.
+ find "$integration_dir" -type d -exec setfacl -m \
+ "d:u:${host_uid}:rwx,d:u:${mapped_uid}:rwx" {} +
+}
+
run_integration_prep() {
phase integration-dependencies npm --prefix tests/integration ci
PLAYWRIGHT_VERSION="$(node -p "require('./tests/integration/node_modules/@playwright/test/package.json').version")"
PLAYWRIGHT_IMAGE="mcr.microsoft.com/playwright:v${PLAYWRIGHT_VERSION}-noble"
phase playwright-image docker pull "$PLAYWRIGHT_IMAGE"
+ phase playwright-mount prepare_playwright_mount
phase mock-github-image docker build --tag pulse-mock-github:test tests/integration/mock-github-server
}
diff --git a/scripts/release_control/internal/release_preflight_test.py b/scripts/release_control/internal/release_preflight_test.py
index d8ef5ea87b..21aa2eae0d 100755
--- a/scripts/release_control/internal/release_preflight_test.py
+++ b/scripts/release_control/internal/release_preflight_test.py
@@ -297,6 +297,61 @@ run_playwright 'tests/a test.spec.ts' --project=chromium
f"{os.getuid()}:{os.getgid()}")
self.assertIn("mcr.microsoft.com/playwright:v1.61.1-noble", args)
+ def test_browser_mount_mapping_and_fail_closed(self) -> None:
+ worker = (ROOT / "scripts/release-preflight-worker.sh").read_text()
+ function = re.search(
+ r"prepare_playwright_mount\(\) \{.*?\n\}", worker, flags=re.DOTALL
+ ).group(0)
+ for mapping, status, acl in (
+ ("0 1001 1\n1 165536 65536", 0, "u:166536:rwX"),
+ ("0 0 4294967295", 0, None),
+ ("0 1001 1", 1, None),
+ ("garbage", 1, None),
+ ):
+ with self.subTest(mapping=mapping):
+ result = subprocess.run(["bash", "-c", r'''
+set -euo pipefail
+id() { echo 1001; }
+docker() { printf '%s\n' "$MAPPING"; }
+setfacl() { printf 'ACL %s\n' "$*"; }
+find() { printf 'FIND %s\n' "$*"; }
+REPOSITORY_DIR='/tmp/worker with spaces/repo'
+PLAYWRIGHT_IMAGE='selected-image'
+''' + function + "\nprepare_playwright_mount"],
+ env={**os.environ, "MAPPING": mapping},
+ text=True, capture_output=True, check=False)
+ self.assertEqual(result.returncode, status, result.stderr)
+ if acl:
+ self.assertIn(acl, result.stdout)
+ self.assertIn("-R -P", result.stdout)
+ self.assertIn("d:u:1001:rwx,d:u:166536:rwx", result.stdout)
+ self.assertIn("/tmp/worker with spaces/repo/tests/integration", result.stdout)
+ else:
+ self.assertNotIn("ACL", result.stdout)
+ prep = re.search(r"run_integration_prep\(\) \{.*?\n\}", worker,
+ flags=re.DOTALL).group(0)
+ self.assertLess(prep.index("integration-dependencies"), prep.index("playwright-mount"))
+ self.assertLess(prep.index("playwright-image"), prep.index("playwright-mount"))
+
+ def test_browser_mount_acl_errors_propagate(self) -> None:
+ worker = (ROOT / "scripts/release-preflight-worker.sh").read_text()
+ function = re.search(r"prepare_playwright_mount\(\) \{.*?\n\}", worker,
+ flags=re.DOTALL).group(0)
+ for failing in ("docker", "setfacl", "find"):
+ with self.subTest(failing=failing):
+ script = r'''
+set -euo pipefail
+id() { echo 1001; }
+docker() { printf '0 1001 1\n1 165536 65536\n'; }
+setfacl() { :; }
+find() { :; }
+REPOSITORY_DIR=/unused
+PLAYWRIGHT_IMAGE=selected-image
+''' + f"\n{failing}() {{ return 19; }}\n" + function + "\nprepare_playwright_mount"
+ result = subprocess.run(["bash", "-c", script],
+ text=True, capture_output=True, check=False)
+ self.assertEqual(result.returncode, 19, result.stderr)
+
def test_worker_serializes_resource_intensive_test_suites(self) -> None:
worker = (ROOT / "scripts/release-preflight-worker.sh").read_text()
scheduling_block = re.search(