Skip to content

Main -> release: releasing version 3.0.1 with only vulnerabilities fixes - #399

Merged
oriolpetithelical merged 3 commits into
releasefrom
main
Jul 14, 2026
Merged

Main -> release: releasing version 3.0.1 with only vulnerabilities fixes#399
oriolpetithelical merged 3 commits into
releasefrom
main

Conversation

@oriolpetithelical

Copy link
Copy Markdown
Contributor

No description provided.

* fix(security): load dict assets as JSON instead of pickle (CWE-502)

Several models loaded small mapping dictionaries via pickle.load, which
allows arbitrary code execution during unpickling (CWE-502, semgrep
python.lang.security.deserialization.pickle.avoid-pickle). Each of these
assets is a plain str -> (str|int|float) mapping, so it can be serialized
as JSON, which has no code-execution surface -- retiring the finding
outright rather than accepting the risk.

Assets migrated (hosted on S3 under a new .json key alongside the
untouched .pkl, so the change is fully reversible):
- geneformer: gene_median_dictionary, token_dictionary, ensembl_mapping_dict
- uce: species_offsets

Changes:
- geneformer_tokenizer.py / uce_utils.py: pickle.load(rb) -> json.load(r),
  drop the now-unused `import pickle`
- geneformer_config.py / uce_config.py / uce/model.py: point paths at the
  .json keys; rename uce offset_pkl_path -> offset_json_path
- ci/download_all.py + geneformer tokenizer test: use the .json filenames

Tahoe's GeneVocab.from_file always receives vocab.json (downloaded from the
tahoebio HuggingFace repo), so its .pkl branch was dead code and is removed.

Verified: each .json reloads equal to its original pickle, and the
geneformer tokenizer / uce offset loaders read the JSON through the real
code paths with byte-identical results (token IDs load as Python int
rather than np.int16, which torch handles identically).
…395)

HyenaDNA was the only model still using torch.load(weights_only=False),
which allows arbitrary code execution during unpickling (CWE-502). The
hosted .ckpt is a full PyTorch-Lightning checkpoint whose non-tensor
objects (OmegaConf configs, optimizer/scheduler state) block
weights_only=True; only ["state_dict"] is ever consumed.

Point HyenaDNAConfig at a slimmed, tensor-only checkpoint hosted under a
new S3 key hyena_dna/<model>.weights.ckpt (originals left untouched) and
flip the loader to weights_only=True. Update ci/download_all.py and the
config test for the new filename.
@oriolpetithelical oriolpetithelical self-assigned this Jul 14, 2026
@oriolpetithelical
oriolpetithelical merged commit 3dd0fb2 into release Jul 14, 2026
11 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