Skip to content

fix: [APPSEC-327] run Docker formatter without root privileges - #282

Merged
peter-matkovski merged 3 commits into
mainfrom
security/non-root-docker-20261110
Nov 10, 2026
Merged

peter-matkovski merged 3 commits into
mainfrom
security/non-root-docker-20261110

Conversation

@peter-matkovski

@peter-matkovski peter-matkovski commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

The Docker formatter defaults to root. Run it as an unprivileged formatter account and keep Gradle's writable cache under /tmp. The Makefile passes the host UID/GID so formatting can update bind-mounted source files without creating root-owned files on Linux.

Install shadow-utils to create the account and findutils because the current amazoncorretto:11 base lacks xargs, which the Gradle wrapper requires. The base image and Java version are unchanged.

Pin the PR CI workflow to Amazon Corretto 11 with actions/setup-java. The runner's default Java 25 cannot execute this repository's Gradle 8.4; Java 11 also matches the existing project toolchain and formatter image.

Validation:

  • Docker image build passed.
  • Gradle 8.4 starts as the default non-root user and can write its cache.
  • spotlessCheck passed against a bind-mounted checkout as an arbitrary UID/GID (12345:12345).
  • spotlessCheck and javadoc passed together on Java 11.
  • git diff --check passed.

Trivy DS-0002 passes. The Java 25 / Gradle 8.4 CI startup failure is addressed by the explicit Java 11 setup step.

GitHub CI passes: formatting, Javadoc and jacocoTestReport/full test suite on Java 11, plus CodeQL.

@peter-matkovski peter-matkovski changed the title fix: run Docker formatter without root privileges fix: [APPSEC-327] run Docker formatter without root privileges Nov 10, 2026
Added Java 11 setup step to CI workflow.
@peter-matkovski
peter-matkovski merged commit 28d8dca into main Nov 10, 2026
6 checks passed
@peter-matkovski
peter-matkovski deleted the security/non-root-docker-20261110 branch November 10, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants