Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 27 additions & 67 deletions STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ moves; the plan of record for the current item is in the section below.

| Version | What | Issues |
|---|---|---|
| 0.17.10 | numcodecs 0.16.6 or later, which refuses to unpickle unless asked; the image no longer ships 0.16.5 | #134 |
| 0.17.9 | A Zarr store naming a codec adata does not decode is refused when opened: numcodecs' `pickle`, which a v2 store could name for any text array, ran its author's code on the first read | #132 |
| 0.17.8 | Sparse matrices read at least 32 MiB at a time (`subset` of a narrow matrix on Lustre in a quarter of the time); no numpy huge pages, which stalled writes on nodes with fragmented memory; Performance on cluster storage page and the `benchmarks/lustre/` probe | #129, #130 |
| 0.17.7 | `import dataframe --categorical` keeps numeric-looking labels (leiden's 0, 1, 10) as categoricals of their text; `convert --feature-type` / `--split-feature-types` take a 10x input with no feature types (Cell Ranger 2) as gene expression; every tag gets its GitHub release from the changelog | #124, #127, #114 |
Expand All @@ -29,13 +30,17 @@ The conversion epic's sub-issues (#21–#30) are all done and ticked in #20.

## In progress

The December 2026 audit of 0.17.8 (85 findings). Its hotfix, B0, is 0.17.9;
the epic with the other batches is filed once 0.17.9 is out, and the
follow-ups it covers move there.
The fixes from the December 2026 audit of 0.17.8: epic #149, 86 findings
(F165-F250) in 16 batches, #133-#148. Wave 0 is done: B0 (#133), Zarr
codecs that ran code, in 0.17.9 with advisory GHSA-q5v7-469m-2xj2; and B0b
(#134), a patched numcodecs, in 0.17.10. Next is wave 1 (B1-B6, #135-#140)
for 0.17.11, once the epic's proposed decisions for it are confirmed.
Repository settings steps 1 to 3 are applied (2026-12-04); the rest are in
S (#148).

The fixes from the October 2026 audit (epic #87, 164 findings in 16 batches)
finished with 0.17.6; the sub-issues (#88–#103) are all done and ticked in
#87. The batch names in the follow-ups below (B1 to B10) are theirs.
The fixes from the October 2026 audit (epic #87, 164 findings in 16
batches) finished with 0.17.6. The batch names B1 to B10 in the follow-ups
below are October's.

## Follow-ups noticed

Expand Down Expand Up @@ -66,80 +71,35 @@ finished with 0.17.6; the sub-issues (#88–#103) are all done and ticked in
- An import that adds or replaces only the CSV's columns, joined on the
index, and leaves the frame's other columns as they are ("attach
metadata" without a round trip of the whole frame).
- GitHub releases stopped at 0.11.1: they were cut by hand, and the release
checklist never said so. PyPI, quay and the benchmark page were unaffected.
`publish.yml` now creates the release from the changelog section (#114).
0.12.0 to 0.17.6 were backfilled by hand from the changelog plus each
tag's benchmark artifact; the next tag is the first end-to-end check.
GitHub renders each newline in a release body as a line break, so the
changelog's wrapped lines show ragged there; unwrapping paragraphs when
the notes are extracted would fix it (review of #114).
- From waves 3 and 4 of the audit fixes:
- The streaming transpose and other users of `csr_build.BucketSorter`
append every input block to every bucket, (nnz/chunk)² appends, and
each bucket holds three growable datasets (1.8 GB at 30,000 buckets).
The transpose knows its row sizes, so fixed regions as in concat's
`_ColumnBuckets` would do; concat's `_csc_runs` and recast's
`_bucket_runs` could then move into `csr_build` (B3b, B6a).
- From waves 3 and 4 of the October audit fixes (those the December audit
filed are in #149):
- The transpose's scratch lives inside a Zarr output and is appended to
unbuffered, about 135 times its writes; an HDF5 scratch beside the
output, as concat has, would fix it. It is also missing from recast's
free-space estimate (B3b, B6a, B6b).
output, as concat has, would fix it (B3b, B6a, B6b).
- recast's sparse reads are a fixed million entries, not `--chunk`; and
`concat`, `recast` and `export` read `--chunk` rows where one chunk
height is over the read budget, with column tiles only in `subset`,
`split` and `convert` (B6a, B6b).
- `copy_dataset` writes HDF5 text uncompressed: a Zarr to h5ad
conversion's obs index is about nine times anndata's (B6b).
- `convert` has no `--chunk`: the cisTopic and MuData converters use a
fixed byte budget (B8b, B8c).
- A pickle holding pandas 3's Arrow strings is refused; pycisTopic's
pandas 1.5 never writes one (B8c).
- Python warnings reach stderr with their source line; printing them as
`Warning: ...` lines would match the rest of the output (B5).
- CI's `external-readers` job is named "10x h5 against scanpy and
PyTables" and its `compatibility` job "anndata 0.8-0.13", though the
first checks every converter's reader and the second reads 0.7.8 too.
Renaming a job changes its required-check name, so it waits for the
repository settings (B10). `test_concat_versions.py` is an
`integration` test no CI job runs (B10).
- `test_write_safety.py::test_export_writes_to_devices_and_pipes_as_they_are`
failed once in a dozen local runs on macOS: its FIFO reader stayed
blocked with no writer left. The reader thread is not a daemon, so it
failed once in a dozen local runs on macOS, and again under load in the
December audit's review: its FIFO reader stayed blocked with no writer
left. The reader thread is not a daemon, so it
also kept pytest from exiting; a daemon thread would at least let the
run end (B10).
- From wave 2 of the audit fixes:
- CI: a Python 3.14 leg; Dependabot for the pinned actions, uv and base
image (the pinned actions run on Node 20, which GitHub is retiring); the
base image to Debian trixie; a Codecov token (B9).
- Repository settings: the default workflow token can write, and the
`pypi` environment has no protection rules (B9).
- Zarr stores: their codecs are checked since 0.17.9; the rest of the
counterpart to the HDF5 hardening in 0.17.5 is in the December audit.
- Flex's `target_sets` group is not carried, and `--make-unique` names
export with their suffixes (B8a).
- `formats/textio.py` does not unquote a field that starts with `"`, as
pandas does; if it did, MTX export could quote such names rather than
refuse them (B8a).
- A fixed-width text dataset that HDF5 compressed can inflate far beyond
its stored size when read whole, as the loom import reads var columns;
only loom's global attributes are bounded (B8b).
- Under an outer join, an input lacking some genes counts as lacking var
columns, varm and varp entirely; anndata pads them (B3b).
- A numeric `in` list with thousands of values is slow (B4).
- From wave 1 of the audit fixes:
- `core/csr_build.py`'s on-disk sort makes many small appends, slow for
a Zarr scratch at small budgets; buffer bucket writes in
`BucketSorter` (B2a).
- From wave 2 of the October audit fixes:
- The container's base image to Debian trixie (B9; the rest of that
item, the 3.14 leg, Dependabot and Codecov, is in #139 and #146).
- Under an outer join, an input lacking some genes counts as lacking varm
and varp entirely; anndata pads them (B3b; the var columns are F205 in
#141).
- From wave 1 of the October audit fixes:
- The dense tile path's temporaries run to about 10-17x the budget, a
constant factor rather than growth with the input (B2a).
- `import array obs/<new>` doesn't add the column to `column-order`, so
anndata doesn't show it (pre-existing, B2b).
- The free-space estimate runs low for a var-only subset, a dense loom
output and the transpose's scratch: no false refusals, a weaker check
(B1).
- The floors job lets indirect dependencies float, so a new upstream
release can turn it red, and publish.yml reuses tests.yml (B7).
- The free-space estimate runs low for a dense loom output: no false
refusals, a weaker check (B1; the var-only subset and the transpose's
scratch are F189 and F188 in #138).
- `cell_id` (with `in_cell`, `in_nucleus`) on 2 µm bins, from Space Ranger
4's `barcode_mappings.parquet` (a 0.17.x after the audit fixes).
- Dropped: spatial bundles whose matrix is a MEX folder only. 10x always
Expand Down
23 changes: 23 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,29 @@ nav_order: 7
Notable changes to `adata-cli`. Versions are `MAJOR.MINOR.PATCH`; tags carry no
`v` prefix.

## 0.17.10

numcodecs 0.16.6 or later is now required. numcodecs fixed the root of
0.17.9's security issue in its own releases in October: its `pickle` codec
no longer decodes unless the process opts in. `adata` already refused the
codec whatever numcodecs was installed; the new floor means every
environment `adata` installs, and its container image, carries numcodecs'
fix for other readers too.

### Fixed

- **numcodecs 0.16.6 or later is required**
([#134](https://github.com/cellgeni/adata-cli/issues/134)). numcodecs
0.15.2, 0.16.6 and 0.17.1 refuse to decode the `pickle` codec unless
`NUMCODECS_ALLOW_UNSAFE_PICKLE_DECODE` is set
([GHSA-jqc8-qjfv-5m6r](https://github.com/zarr-developers/numcodecs/security/advisories/GHSA-jqc8-qjfv-5m6r)).
The floor was 0.14, so a resolution could keep a numcodecs that runs a
crafted store's code in any reader, and the image shipped 0.16.5. The
floor is now 0.16.6, skipping 0.17.0, and the image ships 0.17.1. adata's
own refusal (0.17.9) holds either way: a test now runs it with numcodecs
told to unpickle. numcodecs' advisory has not reached GitHub's advisory
database, so Dependabot never flagged the old pin.

## 0.17.9

A security fix: upgrade if you open Zarr stores that someone else wrote. A
Expand Down
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# so the distribution is published as `pyadata-cli`. The import package
# and the command are both still `adata`.
name = "pyadata-cli"
version = "0.17.9"
version = "0.17.10"
description = "Streaming CLI for exploring and editing large AnnData .h5ad and .zarr stores"
readme = "README.md"
requires-python = ">=3.12"
Expand Down Expand Up @@ -47,8 +47,11 @@ dependencies = [
# `.shape`, so streaming used memory in proportion to its blocks. 3.16
# brings HDF5 2.0, whose 8 MiB chunk cache `open_store` sets back to 1 MiB.
"h5py>=3.16.0,<4",
# Zarr v2 compressors (storage/__init__.py).
"numcodecs>=0.14",
# Zarr v2 compressors (storage/__init__.py). 0.16.6 refuses to decode the
# `pickle` codec unless the process opts in (GHSA-jqc8-qjfv-5m6r), and
# 0.17.0 came out before that fix. adata refuses the codec on any
# numcodecs, but nothing it installs should decode it for other readers.
"numcodecs>=0.16.6,!=0.17.0",
"numpy>=2.3.5,<3",
# 13.0.0 fixes the decoder advisories that reach `import image` and the
# Visium and Xenium tissue images.
Expand Down
34 changes: 34 additions & 0 deletions tests/test_zarr_safety.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,40 @@ def test_every_command_refuses_a_store_naming_the_pickle_codec(tmp_path, marker,
assert not list(tmp_path.glob("out*")), "a refused store left an output"


@pytest.mark.parametrize(
"command",
[COMMANDS["convert-h5ad"], COMMANDS["subset"], COMMANDS["export-dataframe"]],
ids=["convert-h5ad", "subset", "export-dataframe"],
)
def test_the_guard_holds_where_numcodecs_is_told_to_unpickle(tmp_path, marker, monkeypatch, command):
"""F250: numcodecs 0.16.6 and 0.17.1 refuse to unpickle by themselves,
unless the process opts in, as a pipeline reading its own old stores
may. The guard must not lean on that: with the opt-in on, which makes
the marker mean something again, adata still refuses."""
pickles = pytest.importorskip("numcodecs.pickles")
monkeypatch.setattr(pickles, "ALLOW_UNSAFE_PICKLE_DECODE", True, raising=False)
src = _poison(_anndata_v2(tmp_path / "evil.zarr"), marker)
(tmp_path / "keep.txt").write_text("c1\nc2\n")
result = runner.invoke(app, [a.format(src=src, tmp=tmp_path) for a in command])
assert result.exit_code == 1, _out(result)
assert re.search(REFUSED, _out(result)), _out(result)
assert not list(tmp_path.glob("out*"))


def test_an_array_no_listing_shows_is_refused_where_numcodecs_is_told_to_unpickle(
tmp_path, marker, monkeypatch
):
"""F250: the layer under every read holds without numcodecs' own refusal."""
pickles = pytest.importorskip("numcodecs.pickles")
monkeypatch.setattr(pickles, "ALLOW_UNSAFE_PICKLE_DECODE", True, raising=False)
store = _hide_categories(_anndata_v2(tmp_path / "evil.zarr"), marker, "no-group-metadata")
out = tmp_path / "out.npy"
result = runner.invoke(app, ["export", "array", str(store), "obs/grp/categories", "-o", str(out)])
assert result.exit_code == 1, _out(result)
assert re.search(REFUSED, _out(result)), _out(result)
assert not out.exists()


def _hide_categories(store: Path, marker: Path, how: str) -> Path:
"""Poison obs/grp's categories where no listing of the store shows it:
with no consolidated index, and obs/grp either without its group
Expand Down
Loading
Loading