Skip to content

Conversation

@erickgalinkin
Copy link
Collaborator

Description

Updates dependencies in jailbreak detection Docker container to avoid known vulnerable versions.

Confirmed containers build and run locally.

Checklist

  • [x ] I've read the CONTRIBUTING guidelines.
  • [x ] I've updated the documentation if applicable.
  • [x ] I've added tests if applicable.
  • [x ] @mentions of the person or team responsible for reviewing proposed changes.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 20, 2026

Greptile Summary

This 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:

  • CPU container: Upgraded from python:3.10-slim to python:3.11-slim
  • GPU container: Replaced nvidia/cuda:12.3.1 with pytorch/pytorch:2.9.1-cuda12.6-cudnn9-runtime, removing explicit Python installation
  • Dependencies: Updated starlette (0.27.0→0.50.0), transformers (4.56.0→4.57.6), torch (2.8.0→2.9.1), nemoguardrails (0.7.0→0.14.0)
  • Removed --no-cache-dir flag from pip install commands
  • Changed from python to python3 for GPT2 predownload in CPU image, but inconsistently used in GPU image

Issues Found:

  • CPU Dockerfile ENTRYPOINT uses /usr/local/bin/python which may not exist in Python 3.11-slim; should use python3
  • GPU Dockerfile-GPU has inconsistent Python command usage (line 27 uses python but ENTRYPOINT uses python3)
  • These runtime failures would occur when containers start

Confidence Score: 2/5

  • This PR has critical runtime errors that will cause container startup failures - Python binary path mismatches in ENTRYPOINT commands must be fixed before merging.
  • The PR introduces two critical logic errors in Docker ENTRYPOINT configurations that will cause runtime failures. The CPU Dockerfile uses /usr/local/bin/python which doesn't exist in Python 3.11-slim, and the GPU Dockerfile has inconsistent Python binary references between build steps and ENTRYPOINT. While the dependency updates themselves are reasonable and the base image upgrades are beneficial, these entrypoint bugs are blocking issues that would prevent the containers from running at all. The author's claim that containers build and run locally suggests these issues may have been overlooked during testing.
  • Both nemoguardrails/library/jailbreak_detection/Dockerfile and nemoguardrails/library/jailbreak_detection/Dockerfile-GPU require fixes to the Python binary paths in ENTRYPOINT commands before this PR can be safely merged.

Important Files Changed

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
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Additional Comments (1)

  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 uses python3, but ENTRYPOINT uses /usr/local/bin/python. This will fail at runtime.\n\n

3 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile


# 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');"
Copy link
Contributor

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
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Pouyanpi Pouyanpi changed the title Update dependencies for jailbreak detection docker container. chore(jailbreak): update dependencies for jailbreak detection docker container. Jan 22, 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.

2 participants