Skip to content

Allow newer NLTK versions - #3464

Merged
ptrendx merged 1 commit into
NVIDIA:mainfrom
fheinecke:fred/allow-newer-nltk-1
Sep 3, 2026
Merged

ptrendx merged 1 commit into
NVIDIA:mainfrom
fheinecke:fred/allow-newer-nltk-1

Conversation

@fheinecke

Copy link
Copy Markdown
Collaborator

Description

nltk>=3.10.1 was blocked via #3306 due to an upstream bug. Versions 3.10.2 onward have fixed this, so I'm relaxing the constraint again.

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

Please list the changes introduced in this PR:

  • Allow nltk>3.10.1 in tests and example

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Signed-off-by: Fred Heinecke <fheinecke@nvidia.com>
@fheinecke

Copy link
Copy Markdown
Collaborator Author

/te-ci jax L2

@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR relaxes the temporary NLTK upper bound while continuing to exclude version 3.10.1.

  • Updates the JAX encoder example requirement.
  • Applies the same constraint to the L0 and L2 JAX QA setup.
  • The range also admits NLTK 3.10.2, although relevant security fixes are available only in 3.10.3.

Confidence Score: 4/5

The PR appears safe to merge, but the NLTK range should preferably start at 3.10.3 to avoid admitting a release with known security defects.

The compatibility change works for normal dependency resolution, while a lagging or constrained package index could select newly allowed NLTK 3.10.2 and retain downloader-related security exposure.

Files Needing Attention: examples/jax/encoder/requirements.txt, qa/L0_jax_unittest/test.sh, qa/L2_jax_unittest/test.sh

Security Review

The relaxed range can resolve to NLTK 3.10.2, retaining known security defects fixed in 3.10.3. Requiring 3.10.3 or newer while excluding the upstream-buggy release would avoid that exposure.

Important Files Changed

Filename Overview
examples/jax/encoder/requirements.txt Relaxes the NLTK range but newly admits version 3.10.2, which predates several relevant security fixes.
qa/L0_jax_unittest/test.sh Applies the relaxed NLTK constraint to the L0 JAX test environment.
qa/L2_jax_unittest/test.sh Applies the relaxed NLTK constraint to the L2 JAX test environment.

Reviews (1): Last reviewed commit: "Allow newer NLTK versions" | Re-trigger Greptile

datasets<4.0.0
flax>=0.7.1
nltk>=3.8.2,<3.10.1
nltk>=3.8.2,!=3.10.1

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.

P2 security Constraint admits vulnerable NLTK release

If the package index resolves NLTK 3.10.2, the encoder's nltk.download("punkt_tab") path retains downloader-related security defects fixed in 3.10.3, including exposure to denial of service from a malicious XML index. Exclude 3.10.2 or require 3.10.3 and newer. How this was verified: The relaxed constraint admits 3.10.2, both JAX QA suites run the encoder downloader, and the relevant fixes land in 3.10.3.

Suggested change
nltk>=3.8.2,!=3.10.1
nltk>=3.8.2,!=3.10.1,!=3.10.2

Knowledge Base Used: Verification and CI matrix

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Strictly speaking this is wrong. The security advisory lists vulnerable versions as anything older than 3.10.3, including 3.8.2 to 3.10.0. If the goal is to address this vulnerability, then this should be nltk>=3.10.3.

However, there's a couple of reasons to not do this:

  • It raises the minimum nltk version two minor patches
  • Package managers installing the example deps in a clean environment will pick the latest nltk version (>=3.10.3) anyway
  • The example does not exercise the vulnerable code path

I'm happy to increase this if a human reviewer wants it raised, but I don't see a reason to do so right now.

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.

You're right. My comment was incorrect and incomplete: excluding only 3.10.2 would still allow 3.8.2 through 3.10.0, which the advisory also identifies as vulnerable, so it is not a valid security remediation. If this constraint were intended to address GHSA-m4rf-3fr8-xwx3, the correct change would be nltk>=3.10.3. Given that this example does not exercise the vulnerable downloader path, raising the minimum is a policy choice rather than a necessary fix for this PR. I'll withdraw the finding.

@ptrendx
ptrendx merged commit 9c2fcd6 into NVIDIA:main Sep 3, 2026
29 of 34 checks passed
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