Skip to content

Fix security issues - #3489

Open
jeromekelleher wants to merge 5 commits into
tskit-dev:mainfrom
jeromekelleher:fix-security-issues
Open

jeromekelleher wants to merge 5 commits into
tskit-dev:mainfrom
jeromekelleher:fix-security-issues

Conversation

@jeromekelleher

Copy link
Copy Markdown
Member

Fixes a handful of security issues reported by @gregorgorjanc - Codex was spot on.

I'm quite pleased that this is all that security audits are surfacing - go tskit!

Sample and ancestor IDs equal to the number of nodes were accepted,
leading to out-of-bounds accesses on node-sized arrays.

Closes tskit-dev#3484
Sample IDs equal to the number of nodes were accepted by both
ibd_within and ibd_between, leading to an out-of-bounds write
on the sample_set_id array.

Closes tskit-dev#3485
delete_older used edge parents, mutation nodes and mutation parents
as array indexes without validation, after it had already started
rewriting the tables. Invalid references led to out-of-bounds reads
and partially modified tables.

Closes tskit-dev#3486
@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.67%. Comparing base (0e38fc3) to head (56dccf0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3489      +/-   ##
==========================================
- Coverage   91.68%   91.67%   -0.02%     
==========================================
  Files          38       38              
  Lines       32232    32240       +8     
  Branches     5153     5155       +2     
==========================================
+ Hits        29553    29555       +2     
- Misses       2346     2350       +4     
- Partials      333      335       +2     
Flag Coverage Δ
C 82.24% <100.00%> (+<0.01%) ⬆️
c-python 77.52% <93.75%> (-0.04%) ⬇️
python-tests 96.44% <ø> (ø)
python-tests-no-jit 33.30% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Python API 98.73% <ø> (ø)
Python C interface 91.25% <ø> (ø)
C library 91.20% <100.00%> (-0.04%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

The table metadata schema tests computed the length of example2
using strlen(example), reading past the end of the shorter string.
test_zero_edges passed a single tsk_id_t as the simplify node_map,
which must have space for every input node.
The number of reference sets was used to compute an allocation size
before being checked, so out-of-range values led to very large (or
overflowing) allocation requests before the error was returned.
@jeromekelleher

Copy link
Copy Markdown
Member Author

Also tacked on a couple of extra fixes which came up while looking at this.

This branch has not been deployed

No deployments
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.

1 participant