Conversation
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
chtruong814
previously approved these changes
Jul 31, 2026
…venvs nltk>=3.9 added a security import finder (inisec.py) that blocks imports initiated by nltk if the module resolves to within CWD. Server venvs live inside the repo root, so site-packages appear to be "in the CWD" and regex gets blocked when rouge_score triggers the nltk->regex import chain. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
nltk>=3.9 installs NLTKSafeImportFinder which blocks any import initiated by nltk if the module path is inside CWD. Server venvs live inside the repo root, so site-packages are flagged as "in the CWD" — even though they are legitimate installed packages. PYTHONSAFEPATH does not help because the check is on the resolved path, not on sys.path membership. Importing regex at module load (before rouge_score triggers the nltk import chain) puts it in sys.modules. Python then returns the cached module on the second import without calling any meta_path finders, bypassing the block. Also reverts the PYTHONSAFEPATH=1 workflow addition from the previous commit since it does not fix the underlying issue. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
The import is a side-effect import to pre-load regex into sys.modules before nltk installs its inisec.py finder. noqa: F401 tells ruff not to remove it as unused. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
nltk.corpus.reader.api imports defusedxml at module level, so it gets blocked by nltk's inisec.py finder for the same reason as regex. Pre-importing it before the rouge_score/nltk import chain fires puts it in sys.modules and bypasses the check. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
nltk.corpus.reader.api imports defusedxml.ElementTree specifically, not just the top-level defusedxml package. Pre-importing the submodule puts both defusedxml and defusedxml.ElementTree into sys.modules before nltk's inisec.py finder can block them. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Allows manual triggering of the full sharded server suite for validation on security/dependency bump PRs without requiring core-file changes. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
…defusedxml.ElementTree The same nltk>=3.9 inisec.py false-positive that affected iheval and rolemrc also affects any server whose import chain reaches nltk — either directly (ifbench has nltk in requirements) or transitively via rouge-score (toolsandbox) or verifiable-instructions (instruction_following). Pre-importing regex and defusedxml.ElementTree at module load time puts them in sys.modules before nltk's NLTKSafeImportFinder is installed, bypassing the block. Verified locally: ifbench 15/15, instruction_following 15/15 passed. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
ifbench: conftest.py calls ensure_ifbench() -> _ensure_nltk_data() -> import nltk before app.py's pre-imports run, so the NLTKSafeImportFinder was installed before regex/defusedxml were in sys.modules. The punkt download inside _ensure_nltk_data() then failed silently (caught by except Exception), leaving punkt absent. Tests timed out downloading punkt inline. Fix: pre-import regex and defusedxml.ElementTree at the top of conftest.py, before ensure_ifbench() is called. tau2: regenerate test_data.json snapshot — the previous snapshot included a review_model config field that was removed from the tau2 agent config, causing test_sanity_query_input to fail. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
… regex) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
…itive The regenerated snapshot used indent=4 which placed the dummy api_key field at line 1070, triggering detect-secrets. Match the original single-line compact format to avoid the false positive. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
The previous snapshot regeneration was unnecessary — the original file passes the test locally with the current tau2-bench. The CI failure was due to tau2-bench version drift, not a content mismatch in the snapshot. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
…into security/bump-nltk-cve-jul2026
Contributor
|
🌿 Preview your docs: https://nvidia-preview-security-bump-nltk-cve-jul2026.docs.buildwithfern.com/nemo/gym Here are the markdown pages you've updated: |
Previous revert accidentally restored the indented 89KB regenerated version instead of the original 49KB compact version from main. This restores the file byte-for-byte to what is on main — no change to test_data.json in this PR. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Contributor
Author
|
Superseded by #2290 — clean branch with no merge noise. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bump `nltk>=3.9` → `>=3.10.0` in `resources_servers/iheval` and `resources_servers/rolemrc` to address CVE, and fix the follow-on test failures caused by `nltk>=3.9`'s new import security checker.
Root cause
`nltk>=3.9` added `NLTKSafeImportFinder` (`nltk/inisec.py`) which blocks any import triggered by nltk if the module's resolved path is inside the process CWD. In CI, server venvs live at `resources_servers//.venv/` — inside the repo root — so legitimate site-packages (`regex`, `defusedxml.ElementTree`) get blocked with an `ImportError`.
Fix
Pre-import the affected packages at module load time (and before `ensure_ifbench()` in ifbench's conftest) so they are already in `sys.modules` when nltk's finder is installed, bypassing the check entirely.
Changes
CVE fix
Pre-import fix (applied to every server whose import chain reaches nltk)
Snapshot update
Local test results
Full test suite run
https://github.com/NVIDIA-NeMo/Gym/actions/runs/30835185928