From 95383159089fe2c815aae5b1235aaadd871fa9ae Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Thu, 8 Oct 2026 06:41:44 -0700 Subject: [PATCH] fix(sonar): run container smoke test as non-root user (docker:S6471) --- tests/shell/Dockerfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/shell/Dockerfile b/tests/shell/Dockerfile index dd5aa4d..c711e1e 100644 --- a/tests/shell/Dockerfile +++ b/tests/shell/Dockerfile @@ -4,7 +4,11 @@ FROM ${GNOME_TEST_IMAGE} RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ dbus-x11 gir1.2-gdkpixbuf-2.0 gir1.2-gtk-4.0 gnome-shell gnome-shell-extension-appindicator python3-gi \ && rm -rf /var/lib/apt/lists/* \ - && rmdir /run/systemd/seats + && rmdir /run/systemd/seats \ + && groupadd --system gitify \ + && useradd --create-home --system --gid gitify gitify \ + && mkdir -p /run/dbus \ + && chown gitify:gitify /run/dbus WORKDIR /work COPY LICENSE LICENSE @@ -12,4 +16,6 @@ COPY gitify@gitify.io gitify@gitify.io COPY tests/shell tests/shell COPY scripts/test-shell.sh scripts/test-shell.sh -CMD ["bash", "-c", "mkdir -p /run/dbus && dbus-daemon --system --fork && exec bash scripts/test-shell.sh"] +USER gitify + +CMD ["bash", "-c", "dbus-daemon --system --fork && exec bash scripts/test-shell.sh"]