Conversation
In NLTK v3.9.3, a new security check was added for the Zip Slip issue: nltk/nltk#3468 This change unfortunately contained a bug that causes false positive security errors when packages are downloaded to a symlinked path, since the new check doesn't use `abspath` vs `realpath` consistently: nltk/nltk#3509 This causes errors like: ``` -----> Downloading NLTK packages: punkt punkt_tab <frozen runpy>:128: RuntimeWarning: 'nltk.downloader' found in sys.modules after import of package 'nltk', but prior to execution of 'nltk.downloader'; this may result in unpredictable behaviour [nltk_data] Downloading package punkt to [nltk_data] /app/.heroku/python/nltk_data... [nltk_data] Unzipping tokenizers/punkt.zip. [nltk_data] Zip Slip blocked: punkt/ Error installing package. Retry? [n/y/e] Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/app/.heroku/python/lib/python3.12/site-packages/nltk/downloader.py", line 2631, in <module> rv = downloader.download( ^^^^^^^^^^^^^^^^^^^^ File "/app/.heroku/python/lib/python3.12/site-packages/nltk/downloader.py", line 773, in download choice = input().strip() ^^^^^^^ EOFError: EOF when reading a line ``` See also: https://github.com/heroku/heroku-buildpack-python/actions/runs/22545824206/job/65308000022#step:5:539 Until upstream fix this regression, we can work around it by always passing the raw path to Python home instead of the symlinked path. (We generally prefer using the symlinked path where possible, to ensure the paths used/displayed match between build time and run time, given the build directory is difference from the run directory.) Longer term I will be deprecating and that removing support for `nltk.txt` since it's a Heroku-proprietary invention that's unnecessary given most users instead either commit the NLTK corpora or use the post_compile hook feature instead. Fixes #2037. GUS-W-21410908.
colincasey
approved these changes
Mar 2, 2026
Member
Author
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.
In NLTK v3.9.3, a new security check was added for the Zip Slip issue:
nltk/nltk#3468
This change unfortunately contained a bug that causes false positive security errors when packages are downloaded to a symlinked path, since the new check doesn't use
abspathvsrealpathconsistently:nltk/nltk#3509
This causes errors like:
See also:
https://github.com/heroku/heroku-buildpack-python/actions/runs/22545824206/job/65308000022#step:5:539
Until upstream fix this regression, we can work around it by always passing the raw path for Python home instead of the symlinked path. (We generally prefer using the symlinked path where possible, to ensure the paths used/displayed match between build time and run time, given the build directory is different from the run directory.)
Longer term I will be deprecating and that removing support for
nltk.txtsince it's a Heroku-proprietary invention that's unnecessary given most users instead either commit the NLTK corpora or use the post_compile hook feature instead.Fixes #2037.
GUS-W-21410908.