-
Notifications
You must be signed in to change notification settings - Fork 595
chore(jailbreak): update dependencies for jailbreak detection docker container. #1596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Greptile SummaryThis PR updates dependencies for the jailbreak detection Docker containers to address known vulnerabilities. The changes include upgrading the Python base image from 3.10 to 3.11, updating the GPU image from a CUDA-only base to a PyTorch 2.9.1 image, and updating dependency versions (starlette, transformers, torch, nemoguardrails). Key Changes:
Issues Found:
|
| Filename | Overview |
|---|---|
| nemoguardrails/library/jailbreak_detection/Dockerfile | Upgraded base image from Python 3.10 to 3.11. Changed Python invocation from python to python3 on line 27. ENTRYPOINT still uses /usr/local/bin/python which may not exist - should be python3. |
| nemoguardrails/library/jailbreak_detection/Dockerfile-GPU | Replaced CUDA base image with PyTorch image, improving dependency management. However, Python command changed from python3 to python on line 27, inconsistent with explicit python3 in ENTRYPOINT. Changed pip to --no-cache-dir flag removal. Removed explicit Python installation (now in base image). |
| nemoguardrails/library/jailbreak_detection/requirements.txt | Updated dependency versions: starlette (0.27.0→0.50.0), transformers (4.56.0→4.57.6), torch (2.8.0→2.9.1), and nemoguardrails (0.7.0→0.14.0). Versions align with main project dependencies. Minor version bumps with backward compatibility maintained. |
Sequence Diagram
sequenceDiagram
participant Builder as Docker Builder
participant BaseImg as Base Image
participant Deps as Dependencies
participant Model as Model Cache
participant Server as Runtime Server
Builder->>BaseImg: Start with python:3.11-slim / pytorch:2.9.1
BaseImg-->>Builder: Base OS + Python ready
Builder->>Deps: apt-get install (git, gcc, wget)
Deps-->>Builder: System deps installed
Builder->>Model: wget snowflake.pkl
Model-->>Builder: Model cached
Builder->>Deps: pip install -r requirements.txt
Deps-->>Builder: Python packages installed
Builder->>Model: python3 -c GPT2 predownload
Model-->>Builder: GPT2 model cached
Builder->>Server: ENTRYPOINT set
Server-->>Builder: Image ready
Server->>Server: Start server on port 1337
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
nemoguardrails/library/jailbreak_detection/Dockerfile, line 33 (link)logic: Python 3.11-slim base image may not have
/usr/local/bin/python. The command on line 27 usespython3, but ENTRYPOINT uses/usr/local/bin/python. This will fail at runtime.\n\n
3 files reviewed, 2 comments
|
|
||
| # Predownload the GPT2 model. | ||
| RUN python3 -c "from transformers import GPT2LMHeadModel, GPT2TokenizerFast; GPT2LMHeadModel.from_pretrained('gpt2-large'); GPT2TokenizerFast.from_pretrained('gpt2-large');" | ||
| RUN python -c "from transformers import GPT2LMHeadModel, GPT2TokenizerFast; GPT2LMHeadModel.from_pretrained('gpt2-large'); GPT2TokenizerFast.from_pretrained('gpt2-large');" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Inconsistent Python command - changed from python3 to python, but ENTRYPOINT on line 33 explicitly uses python3. PyTorch base images typically have python3 but not necessarily a python symlink. For consistency and reliability, use python3.\n\nsuggestion\nRUN python3 -c \"from transformers import GPT2LMHeadModel, GPT2TokenizerFast; GPT2LMHeadModel.from_pretrained('gpt2-large'); GPT2TokenizerFast.from_pretrained('gpt2-large');\"\n
Prompt To Fix With AI
This is a comment left during a code review.
Path: nemoguardrails/library/jailbreak_detection/Dockerfile-GPU
Line: 27:27
Comment:
**logic:** Inconsistent Python command - changed from `python3` to `python`, but ENTRYPOINT on line 33 explicitly uses `python3`. PyTorch base images typically have `python3` but not necessarily a `python` symlink. For consistency and reliability, use `python3`.\n\n```suggestion\nRUN python3 -c \"from transformers import GPT2LMHeadModel, GPT2TokenizerFast; GPT2LMHeadModel.from_pretrained('gpt2-large'); GPT2TokenizerFast.from_pretrained('gpt2-large');\"\n```
How can I resolve this? If you propose a fix, please make it concise.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Description
Updates dependencies in jailbreak detection Docker container to avoid known vulnerable versions.
Confirmed containers build and run locally.
Checklist