Repository navigation
Conversation
…es can't run code
This branch has not been deployed
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.
Addresses #40
get_cache()opens the resolve cache with diskcache's defaultDisk, sotaxonopy traceand every other cached read unpickle whatever the cache folder holds. CVE-2025-69872 (GHSA-w8v5-vhqr-4h9v) applies to all diskcache releases and none fixes it. This moves TaxonoPy to diskcache-community, a maintained, faster fork that keeps diskcache's API and cache files, and opens the cache with itsSafeDisk.Specifically:
pyproject.toml:"diskcache"becomes"diskcache-community>=5.8.4".cache_manager.py:get_cache()passesdisk=SafeDisk.with_types(modules=("taxonopy.types",)).with_options(on_error="miss"). The cached values are lists of TaxonoPy's own dataclasses, so the allowlist is thetaxonopy.typespackage and nothing else. An entry that would load anything outside it is dropped and recomputed, with one warning, instead of running.tests/test_cache_manager.py:test_planted_cache_entry_is_a_missparses a one-row CSV, rewrites its cached entry as a pickle through a cache on the defaultDisk, then checks that the nextparse_input_listreturns the same entries and the planted function never ran.Caches written by 0.2.0 store the same dataclasses, so they keep their hits.
Before and after
The script from #40, resolving the sample's honey bee row and then running
trace entryon it.TaxonoPy 0.2.0 with diskcache 5.6.3:
This branch with diskcache-community:
Testing
Diskinget_cache().ruff checkon the changed files reports the same findings as onmain.Update
Every day new libraries getting updated, as example several libraries that were updated yesterday lithops and octotools.
improved performance
Measured over 20 rounds per build, each build in its own venv in random order, medians vs PyPI diskcache 5.6.3 — classic mix (100,000 ops/round, 90% gets / 9% sets / 1% deletes) plus size tiers (100 B to 1 MB) and Django backends, millions of ops total.
Cache.gethitCache.getmissDjangoCache.gethitCache.setCache.setwith expire / Django setP.S I created this pacakge myself after running into this issue, and I'm the one maintaining it.