Skip to content

B8c: Pickles, spatial and images #101

Closed

Description

@Claptar

Part of #87.

wave 3 · 0.17.6 · size M · starts after: the in-flight spatial work (coordinate with it)

Goal. Pickle reading is hardened, and the image and cistopic paths respect --chunk.

Owns: formats/pickled.py, conversion/cistopic.py, conversion/xenium.py, formats/image.py

Approach:

  • Decision D3. Harden pickle reading (F038, F040, F140, security; details after the fix is released), and document that pickles are trusted input.
  • cistopic:
    • --dense chunks are capped by bytes, not set to (4096, n_features) (F007);
    • CSR from dense is streamed (F025);
    • --dense on a sparse mtx is honoured or refused (F100).
  • Xenium creates the output's parent folder, or refuses clearly (F112).
  • export image keeps 16-bit images or scales them explicitly (F066).

Findings

Ref Sev Finding Where
F007 H --dense on an imputed pickle uses chunks of (4096, n_features), which HDF5 refuses at 262,144 or more float32 features src/adata/conversion/cistopic.py:363
F025 H Writing a dense imputed-features pickle as CSR takes about 9x the matrix's bytes per 4096-cell block, so memory scales with n_features … src/adata/conversion/cistopic.py:376
F038 H pycisTopic pickle input is not validated enough (security; details after the fix is released)
F040 H The restricted unpickler needs hardening (security; details after the fix is released)
F066 M export image silently clips 16-bit and >255 images to 255 instead of keeping or scaling them src/adata/formats/image.py:43
F100 L --dense is silently ignored when a CistopicImputedFeatures holds a sparse mtx src/adata/conversion/cistopic.py:356
F112 L A Xenium bundle with a packed analysis fails with a bare Errno when the output's folder does not exist yet src/adata/conversion/xenium.py:121
F140 L The pickle allowlist needs narrowing (security; details after the fix is released)

Done when one PR on fix/b8c closes this, with a regression test against an oracle for every finding, and docs and changelog in the same PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions