Skip to content

fix(security): pin base image digest and run as jenkins user - #5173

Open
causten wants to merge 1 commit into
developfrom
mythos/pr-docker-hardening
Open

fix(security): pin base image digest and run as jenkins user#5173
causten wants to merge 1 commit into
developfrom
mythos/pr-docker-hardening

Conversation

@causten

@causten causten commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Pin ubuntu:24.04 to reviewed digest (from tag 24.04)
  • Add non-root jenkins user for runtime

JIRA

  • ROCM-26612, ROCM-26613

Test plan

  • docker build .

Made with Cursor

Addresses ROCM-26612, ROCM-26613.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI lite review requested due to automatic review settings August 21, 2026 23:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens the project’s Docker build environment by making the base image reproducible (digest-pinned) and switching the container’s default runtime user away from root.

Changes:

  • Pin ubuntu:24.04 to a specific sha256 digest for supply-chain/reproducibility.
  • Add a non-root jenkins user and switch the image default USER to jenkins.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Dockerfile
Comment on lines +159 to +160
RUN groupadd -r jenkins && useradd -r -g jenkins -m jenkins && \
chown -R jenkins:jenkins /tmp /var/tmp $ONNX_HOME
Comment thread Dockerfile
Comment on lines +159 to +160
RUN groupadd -r jenkins && useradd -r -g jenkins -m jenkins && \
chown -R jenkins:jenkins /tmp /var/tmp $ONNX_HOME
Comment thread Dockerfile
Comment on lines +162 to +163
USER jenkins

@gh-app-migraphx-bot-pr-write

Copy link
Copy Markdown
Test Batch New Rate (d72737) Old Rate (3a503c)* Diff Status
torchvision-resnet50 64 3,323.35 3,264.92 1.79%
torchvision-resnet50_fp16 64 7,878.92 7,548.67 4.38%
torchvision-densenet121 32 2,489.94 2,483.99 0.24%
torchvision-densenet121_fp16 32 5,019.50 5,004.24 0.30%
torchvision-inceptionv3 32 2,072.51 2,058.51 0.68%
torchvision-inceptionv3_fp16 32 4,454.63 4,416.99 0.85%
cadene-inceptionv4 16 818.12 820.61 -0.30%
cadene-resnext64x4 16 782.51 782.78 -0.03%
slim-mobilenet 64 8,383.23 8,386.36 -0.04%
slim-nasnetalarge 64 228.39 228.86 -0.20%
slim-resnet50v2 64 3,239.52 3,180.91 1.84%
bert-mrpc-onnx 8 1,169.60 1,168.84 0.07%
bert-mrpc-tf 1 490.25 498.63 -1.68%
pytorch-examples-wlang-gru 1 484.81 473.35 2.42%
pytorch-examples-wlang-lstm 1 413.77 384.83 7.52% 🔆
torchvision-resnet50_1 1 1,056.55 1,046.63 0.95%
cadene-dpn92_1 1 450.44 437.32 3.00%
cadene-resnext101_1 1 366.23 365.89 0.09%
onnx-taau-downsample 1 847.57 844.09 0.41%
dlrm-criteoterabyte 1 32.27 32.42 -0.45%
dlrm-criteoterabyte_fp16 1 51.65 51.80 -0.29%
agentmodel 1 15,180.57 9,209.12 64.84% 🔆
unet_fp16 2 58.37 58.80 -0.72%
resnet50v1_fp16 1 1,439.21 1,366.11 5.35% 🔆
resnet50v1_int8 1 1,773.80 1,883.96 -5.85% 🔴
bert_base_cased_fp16 64 1,097.71 1,098.16 -0.04%
bert_large_uncased_fp16 32 345.76 345.59 0.05%
bert_large_fp16 1 207.34 206.59 0.36%
distilgpt2_fp16 16 2,092.37 2,092.89 -0.02%
yolov5s 1 553.53 558.33 -0.86%
tinyllama 1 45.84 45.83 0.03%
vicuna-fastchat 1 44.25 44.20 0.12%
whisper-tiny-encoder 1 412.93 411.87 0.26%
whisper-tiny-decoder 1 409.43 408.48 0.23%
llama2_7b 1 20.86 20.84 0.12%
qwen1.5-7b 1 23.65 23.58 0.30%
phi3-3.8b 1 26.72 26.72 0.01%
llama3-8b 1 21.76 21.80 -0.18%
whisper-large-encoder 1 10.16 10.18 -0.12%
whisper-large-decoder 1 108.43 105.30 2.97%
mistral-7b 1 23.72 23.78 -0.23%
FLUX.1-schnell 1 785.46 755.22 4.00%

Regressions detected 🔴

* No develop baseline was found for this PR's branch point; compared against the latest available develop run instead.

@gh-app-migraphx-bot-pr-write

Copy link
Copy Markdown
Test Status Result
bert-mrpc-onnx PASSED: MIGraphX meets tolerance
bert-mrpc-tf ERROR - check error output
traceback
Traceback (most recent call last):
File "/src/AMDMIGraphX/tools/accuracy/accuracy_checker.py", line 377, in
main()
File "/src/AMDMIGraphX/tools/accuracy/accuracy_checker.py", line 313, in main
import tensorflow as tf
File "/usr/local/lib/python3.12/dist-packages/tensorflow/init.py", line 40, in
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow # pylint: disable=unused-import
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 37, in
self_check.preload_check()
File "/usr/local/lib/python3.12/dist-packages/tensorflow/python/platform/self_check.py", line 63, in preload_check
from tensorflow.python.platform import _pywrap_cpu_feature_guard
ImportError: libnuma.so.1: cannot open shared object file: No such file or directory
pytorch-examples-wlang-gru PASSED: MIGraphX meets tolerance
pytorch-examples-wlang-lstm PASSED: MIGraphX meets tolerance
dlrm-criteoterabyte PASSED: MIGraphX meets tolerance
agentmodel PASSED: MIGraphX meets tolerance
unet PASSED: MIGraphX meets tolerance
resnet50v1 PASSED: MIGraphX meets tolerance
bert_base_cased_fp16 PASSED: MIGraphX meets tolerance
bert_large_uncased_fp16 🔴 FAILED: MIGraphX is not within tolerance - check verbose output
bert_large PASSED: MIGraphX meets tolerance
yolov5s PASSED: MIGraphX meets tolerance
tinyllama PASSED: MIGraphX meets tolerance
vicuna-fastchat PASSED: MIGraphX meets tolerance
whisper-tiny-encoder PASSED: MIGraphX meets tolerance
whisper-tiny-decoder PASSED: MIGraphX meets tolerance
distilgpt2_fp16 🔴 FAILED: MIGraphX is not within tolerance - check verbose output
llama2_7b PASSED: MIGraphX meets tolerance
qwen1.5-7b PASSED: MIGraphX meets tolerance
phi3-3.8b PASSED: MIGraphX meets tolerance
llama3-8b PASSED: MIGraphX meets tolerance
whisper-large-decoder PASSED: MIGraphX meets tolerance
mistral-7b PASSED: MIGraphX meets tolerance
FLUX.1-schnell PASSED: MIGraphX meets tolerance

Comment thread Dockerfile
ENV ASAN_OPTIONS=detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1
RUN ln -s /opt/rocm/llvm/bin/llvm-symbolizer /usr/bin/llvm-symbolizer

RUN groupadd -r jenkins && useradd -r -g jenkins -m jenkins && \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Dont add a jenkins user as this might not match the user id of the jenkins user on the machine.

Comment thread Dockerfile
Comment on lines +159 to +162
RUN groupadd -r jenkins && useradd -r -g jenkins -m jenkins && \
chown -R jenkins:jenkins /tmp /var/tmp $ONNX_HOME

USER jenkins

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should just be deleted as this is not a security issue. Jenkins user should be set when running the docker container(which is already the case).

Suggested change
RUN groupadd -r jenkins && useradd -r -g jenkins -m jenkins && \
chown -R jenkins:jenkins /tmp /var/tmp $ONNX_HOME
USER jenkins

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.

3 participants