Skip to content

chore: CVE upgrades for wandb, gitpython and cleanups - #1251

Open
mckornfield wants to merge 4 commits into
mainfrom
cves-08-12/mck
Open

chore: CVE upgrades for wandb, gitpython and cleanups#1251
mckornfield wants to merge 4 commits into
mainfrom
cves-08-12/mck

Conversation

@mckornfield

@mckornfield mckornfield commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Related Issue

Changes

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with documentation updates
  • Documentation only
  • Contributor tooling or automation
  • CI, build, or test infrastructure

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Documentation updated for user-visible behavior
  • Documentation not applicable — justification:

Verification

  • Pull request title follows the repository's Conventional Commit format
  • Every commit includes an appropriate Signed-off-by: trailer
  • uv run pre-commit run -a passes, or any blocked checks are identified below
  • Targeted tests pass, or tests are marked not applicable above
  • No secrets, API keys, or credentials are included

Targeted validation:

Summary by CodeRabbit

  • Bug Fixes

    • Improved runtime image hygiene by removing stale package and binary remnants.
    • Added more reliable security cleanup during container image builds.
    • Improved policy build reliability with fallback download sources and retry handling.
  • Maintenance

    • Updated W&B to 0.28.2 and GitPython to 3.1.58 across supported environments.
    • Refreshed dependency constraints, lockfiles, and package integrity data.
    • Standardized shell execution and improved download reliability with bounded retries and timeouts.

@mckornfield
mckornfield requested review from a team as code owners August 12, 2026 15:22
@github-actions github-actions Bot added the chore label Aug 12, 2026
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The pull request updates GitPython and W&B versions across project requirements and Docker images. It changes CVE cleanup to POSIX sh, removes stale packages, improves download retries, and adds fallback OPA download sources.

Changes

Dependency and runtime image alignment

Layer / File(s) Summary
Dependency version updates
pyproject.toml, third_party/requirements-main.txt, docker/*requirements.txt, docker/Dockerfile.*
GitPython is updated to 3.1.58. W&B is updated to 0.28.2 across project, lockfile, override, and Docker requirements.
Runtime image cleanup
docker/scripts/cve-cleanup.sh, docker/Dockerfile.*, docker/automodel/Dockerfile.nmp-automodel-base
Docker builds invoke the cleanup script with sh. The cleanup removes stale GitPython, JupyterLab, flash_attn, and FFmpeg files when applicable.
RL environment W&B maintenance
docker/rl/Dockerfile.nmp-rl-base
The NeMo-RL image configures UV download retries, installs W&B 0.28.2, updates it in Ray and Gym environments, and removes unused W&B cache archives.

Policy WASM build

Layer / File(s) Summary
Policy WASM download sources
docker/base/Dockerfile.policy-wasm, script/build_policy_wasm.sh
The Dockerfile delegates OPA retrieval and WASM generation to build_policy_wasm.sh. The script supports configured, legacy, official, and GitHub sources, with bounded retries across sources.

Possibly related PRs

Suggested reviewers: ironcommit, gabwow

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary dependency upgrades and cleanup changes in the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cves-08-12/mck

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docker/scripts/cve-cleanup.sh`:
- Around line 90-93: Update the cleanup entries in the script around the
GitPython and JupyterLab removals to target the runtime Python site-packages
directory rather than hardcoded Python 3.12 paths. Ensure Dockerfile.nmp-api and
Dockerfile.safe-synthesizer-tasks provide or resolve the correct Python 3.13
path, and add build assertions verifying the targeted packages and dist-info
files are absent afterward.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ee0a055f-8b30-4b4e-9beb-d7a9de09ee6f

📥 Commits

Reviewing files that changed from the base of the PR and between 95f9fb1 and 626c525.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • docker/Dockerfile.nmp-api
  • docker/Dockerfile.nmp-customizer-tasks
  • docker/Dockerfile.nmp-unsloth-training
  • docker/Dockerfile.safe-synthesizer-tasks
  • docker/automodel/Dockerfile.nmp-automodel-base
  • docker/automodel/no_override_requirements.txt
  • docker/rl/Dockerfile.nmp-rl-base
  • docker/scripts/cve-cleanup.sh
  • docker/unsloth/no_override_requirements.txt
  • pyproject.toml
  • third_party/requirements-main.txt

Comment on lines +90 to +93
rm -rf /usr/local/lib/python3.12/dist-packages/git \
/usr/local/lib/python3.12/dist-packages/gitpython-*.dist-info
rm -rf /usr/local/lib/python3.12/dist-packages/jupyterlab \
/usr/local/lib/python3.12/dist-packages/jupyterlab-*.dist-info

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.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Use the runtime Python path for the cleanup entries.

docker/Dockerfile.nmp-api and docker/Dockerfile.safe-synthesizer-tasks use Python 3.13, but Lines 90-93 only target /usr/local/lib/python3.12/dist-packages. These image builds can therefore skip the new GitPython and JupyterLab cleanup.

Discover the runtime site-packages directory or pass it from each image. Add a build assertion that the targeted files are absent.

Proposed fix
-rm -rf /usr/local/lib/python3.12/dist-packages/git \
-       /usr/local/lib/python3.12/dist-packages/gitpython-*.dist-info
-rm -rf /usr/local/lib/python3.12/dist-packages/jupyterlab \
-       /usr/local/lib/python3.12/dist-packages/jupyterlab-*.dist-info
+for site_packages in \
+    /usr/local/lib/python*/dist-packages \
+    /usr/local/lib/python*/site-packages; do
+    [ -d "$site_packages" ] || continue
+    rm -rf \
+        "$site_packages/git" \
+        "$site_packages"/gitpython-*.dist-info \
+        "$site_packages/jupyterlab" \
+        "$site_packages"/jupyterlab-*.dist-info
+done
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docker/scripts/cve-cleanup.sh` around lines 90 - 93, Update the cleanup
entries in the script around the GitPython and JupyterLab removals to target the
runtime Python site-packages directory rather than hardcoded Python 3.12 paths.
Ensure Dockerfile.nmp-api and Dockerfile.safe-synthesizer-tasks provide or
resolve the correct Python 3.13 path, and add build assertions verifying the
targeted packages and dist-info files are absent afterward.

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 32235/40906 78.8% 63.7%
Integration Tests 18640/38832 48.0% 20.7%

Signed-off-by: Matt Kornfield <mkornfield@nvidia.com>
Signed-off-by: Matt Kornfield <mkornfield@nvidia.com>

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docker/rl/Dockerfile.nmp-rl-base (1)

202-205: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Keep W&B 0.28.2 in the RL lock

The RL uv.lock copied by this Dockerfile pins wandb to 0.28.1. This command installs 0.28.2 outside the frozen dependency graph. Apply the same fix at line 344. Update the RL lock to 0.28.2, or constrain and validate the direct install's complete dependency graph.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docker/rl/Dockerfile.nmp-rl-base` around lines 202 - 205, Update the RL
dependency setup around the direct wandb installation and the corresponding lock
entry so wandb is consistently pinned to 0.28.2. Apply the same correction at
the installation site around line 344, ensuring the copied uv.lock and both
direct installs use the same resolved dependency graph rather than installing
0.28.2 outside the frozen lock.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@docker/rl/Dockerfile.nmp-rl-base`:
- Around line 202-205: Update the RL dependency setup around the direct wandb
installation and the corresponding lock entry so wandb is consistently pinned to
0.28.2. Apply the same correction at the installation site around line 344,
ensuring the copied uv.lock and both direct installs use the same resolved
dependency graph rather than installing 0.28.2 outside the frozen lock.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 77bfdfd4-72b5-44e5-aa9a-a4a4d1c2eb04

📥 Commits

Reviewing files that changed from the base of the PR and between 38c16ba and d208961.

📒 Files selected for processing (2)
  • docker/base/Dockerfile.policy-wasm
  • docker/rl/Dockerfile.nmp-rl-base

Signed-off-by: Matt Kornfield <mkornfield@nvidia.com>

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@script/build_policy_wasm.sh`:
- Around line 134-137: Update the download flow in the build policy script to
track a single absolute deadline across binary and checksum requests, rather
than relying on per-request --max-time and --retry-max-time values. Apply the
remaining time to each curl attempt and stop trying fallback sources when the
shared deadline is reached, reserving sufficient time for opa build within the
caller’s timeout.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d1c7ed92-79f5-40a0-9627-65440a4c3899

📥 Commits

Reviewing files that changed from the base of the PR and between d208961 and 2476aa3.

📒 Files selected for processing (2)
  • docker/base/Dockerfile.policy-wasm
  • script/build_policy_wasm.sh

Comment on lines +134 to +137
if curl -fsSL --retry 3 --retry-delay 2 --retry-all-errors \
--connect-timeout 10 --max-time 30 --retry-max-time 45 "${url}" -o "${tmp_bin}" && \
curl -fsSL --retry 3 --retry-delay 2 --retry-all-errors \
--connect-timeout 10 --max-time 10 --retry-max-time 15 "${sha_url}" -o "${tmp_sha}"; then

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.

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/sh
set -eu

# Verify curl retry-window behavior.
curl -fsSL https://curl.se/docs/manpage.html |
  grep -A12 -F -- '--retry-max-time' | sed -n '1,20p'

# Inspect the configured per-source budget.
sed -n '123,146p' script/build_policy_wasm.sh

Repository: NVIDIA-NeMo/nemo-platform

Length of output: 2696


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- script structure and timeout-related lines ---'
sed -n '1,180p' script/build_policy_wasm.sh

printf '%s\n' '--- caller timeout references ---'
rg -n -C 3 'DEFAULT_BUILD_TIMEOUT_SECONDS|build_policy_wasm|timeout' . \
  -g '*.py' -g '*.sh' -g '*.yaml' -g '*.yml' -g '*.toml' \
  | head -240

Repository: NVIDIA-NeMo/nemo-platform

Length of output: 22974


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- curl option documentation ---'
curl -fsSL https://curl.se/docs/manpage.html |
  sed -n '/id="--retry-max-time"/,/id="--retry"/p' |
  sed -n '1,100p'

printf '%s\n' '--- available local curl documentation ---'
curl --version
curl --help all | grep -E -A2 -B2 -- '--(max-time|retry-max-time|retry)' || true

Repository: NVIDIA-NeMo/nemo-platform

Length of output: 1561


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- policy_wasm.py locations and timeout definitions ---'
fd -i 'policy_wasm.py' .
rg -n -C 8 'DEFAULT_BUILD_TIMEOUT_SECONDS|build_policy_wasm|build_policy' \
  $(fd -i 'policy_wasm.py' .) 2>/dev/null || true

printf '%s\n' '--- exact retry-max-time documentation text ---'
curl -fsSL https://curl.se/docs/manpage.html |
  grep -n -i -A18 -B8 'retry-max-time' |
  head -100

Repository: NVIDIA-NeMo/nemo-platform

Length of output: 27101


🌐 Web query:

curl --retry-max-time current transfer allowed to finish --max-time resets on each retry official curl documentation

💡 Result:

In curl, the --max-time and --retry-max-time options function differently regarding how they handle time limits and retries [1][2][3]. --max-time: This option sets the maximum time allowed for a single, individual transfer attempt [1][4]. If you have enabled retries using the --retry option, the --max-time counter is reset for every new retry attempt [1][5][6]. Consequently, --max-time does not limit the total duration of the entire operation across all retries, only the duration of each specific attempt [1][2][3]. --retry-max-time: This option acts as a global timer for the entire retry process [2][3]. It limits the total time during which curl is allowed to perform retry attempts [2][3]. The timer starts before the first transfer attempt and continues to run through both the transfer attempts and the waiting periods (such as those caused by --retry-delay) between them [2][7][3]. If this timer reaches the specified limit, no further retries will be performed [2][3]. However, if a transfer is already in progress when the --retry-max-time limit is reached, that transfer is allowed to continue and complete, even if it exceeds the specified limit [2][7][3]. In summary, --max-time is reset on each retry attempt [1][6], while --retry-max-time sets a cumulative time limit for the entire retry lifecycle [2][3].

Citations:


🏁 Script executed:

#!/bin/bash
set -eu

curl -fsSL https://curl.se/docs/manpage.html |
  python3 - <<'PY'
import sys
from html.parser import HTMLParser

class Text(HTMLParser):
    def __init__(self):
        super().__init__()
        self.capture = False
        self.depth = 0
        self.parts = []
    def handle_starttag(self, tag, attrs):
        attrs = dict(attrs)
        if attrs.get("id") == "--retry-max-time":
            self.capture = True
            self.depth = 0
        elif self.capture:
            self.depth += 1
    def handle_endtag(self, tag):
        if self.capture:
            if self.depth == 0:
                self.capture = False
            else:
                self.depth -= 1
    def handle_data(self, data):
        if self.capture:
            self.parts.append(" ".join(data.split()))

p = Text()
p.feed(sys.stdin.read())
print(" ".join(p.parts))
PY

Repository: NVIDIA-NeMo/nemo-platform

Length of output: 238


🏁 Script executed:

#!/bin/bash
set -eu

python3 - <<'PY'
from html.parser import HTMLParser
from urllib.request import urlopen

class Text(HTMLParser):
    def __init__(self):
        super().__init__()
        self.capture = False
        self.depth = 0
        self.parts = []
    def handle_starttag(self, tag, attrs):
        attrs = dict(attrs)
        if attrs.get("id") == "--retry-max-time":
            self.capture = True
            self.depth = 0
        elif self.capture:
            self.depth += 1
    def handle_endtag(self, tag):
        if self.capture:
            if self.depth == 0:
                self.capture = False
            else:
                self.depth -= 1
    def handle_data(self, data):
        if self.capture:
            text = " ".join(data.split())
            if text:
                self.parts.append(text)

with urlopen("https://curl.se/docs/manpage.html") as response:
    parser = Text()
    parser.feed(response.read().decode())
print(" ".join(parser.parts))
PY

Repository: NVIDIA-NeMo/nemo-platform

Length of output: 2450


🏁 Script executed:

#!/bin/bash
set -eu

sed -n '83,125p' services/core/auth/src/nmp/core/auth/app/embedded_pdp/policy_wasm.py

Repository: NVIDIA-NeMo/nemo-platform

Length of output: 1650


Use a shared download deadline.

--retry-max-time does not stop an active transfer, and --max-time resets on each retry. The binary and checksum requests can consume about 100 seconds per source. Two fallback sources can exceed the caller's 120-second timeout before opa build starts.

Track one absolute deadline across all sources and reserve time for opa build.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@script/build_policy_wasm.sh` around lines 134 - 137, Update the download flow
in the build policy script to track a single absolute deadline across binary and
checksum requests, rather than relying on per-request --max-time and
--retry-max-time values. Apply the remaining time to each curl attempt and stop
trying fallback sources when the shared deadline is reached, reserving
sufficient time for opa build within the caller’s timeout.

Signed-off-by: Matt Kornfield <mkornfield@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant