Skip to content

fix: run full Docker image as non-root#1024

Merged
mldangelo-oai merged 2 commits intomainfrom
mdangelo/codex/nonroot-full-dockerfile
Apr 16, 2026
Merged

fix: run full Docker image as non-root#1024
mldangelo-oai merged 2 commits intomainfrom
mdangelo/codex/nonroot-full-dockerfile

Conversation

@mldangelo-oai
Copy link
Copy Markdown
Contributor

Summary

  • Add a dedicated non-root appuser to Dockerfile.full, matching the slim image hardening pattern.
  • Create and chown /data so the existing full-image entrypoint test helper has a writable default location without requiring root.
  • Switch the runtime image to USER appuser before the entrypoint.

Validation

  • docker --version
  • docker buildx version (not available in this local Docker CLI, so Dockerfile syntax was inspected directly)
  • uv run ruff format --check modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/
  • uv run ruff check modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/
  • uv run mypy modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/
  • PROMPTFOO_DISABLE_TELEMETRY=1 uv run pytest -n auto -m "not slow and not integration" --maxfail=1

@mldangelo-oai mldangelo-oai changed the title [codex] fix: run full Docker image as non-root fix: run full Docker image as non-root Apr 15, 2026
@mldangelo-oai mldangelo-oai marked this pull request as ready for review April 15, 2026 23:31
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5eeaf09b36

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Dockerfile.full
Comment on lines +52 to +54
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Give appuser a writable home directory

Setting appuser home to /nonexistent with --no-create-home breaks default cache behavior for remote scans. The CLI uses Path.home() to build cache paths (~/.modelaudit/cache), and cache initialization creates directories immediately. As UID 10001 cannot create /nonexistent/..., modelaudit scan against hf://, s3://, etc. can fail with PermissionError in the full image.

Useful? React with 👍 / 👎.

@mldangelo-oai mldangelo-oai merged commit c1d2be6 into main Apr 16, 2026
30 of 31 checks passed
@mldangelo-oai mldangelo-oai deleted the mdangelo/codex/nonroot-full-dockerfile branch April 16, 2026 06:29
@github-actions github-actions bot mentioned this pull request Apr 16, 2026
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.

1 participant