Skip to content

fix: p_cif.py get_symop no longer evals CIF symmetry operations, to s… - #205

Merged
sbillinge merged 1 commit into
mainfrom
fix-symop-eval
Nov 20, 2026
Merged

sbillinge merged 1 commit into
mainfrom
fix-symop-eval

Conversation

@sbillinge

Copy link
Copy Markdown
Contributor

…top code execution when loading a CIF, by parsing translations as numbers

The translation part of each symmetry operation was passed to eval, so a crafted CIF file could run arbitrary Python code on load. It is now matched against a strict pattern of signed integers, decimals and fractions, and anything else raises StructureFormatError.

closes #204

…top code execution when loading a CIF, by parsing translations as numbers

The translation part of each symmetry operation was passed to eval, so
a crafted CIF file could run arbitrary Python code on load. It is now
matched against a strict pattern of signed integers, decimals and
fractions, and anything else raises StructureFormatError.

closes #204

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@codecov

codecov Bot commented Nov 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.22%. Comparing base (520f319) to head (916194f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #205   +/-   ##
=======================================
  Coverage   99.21%   99.22%           
=======================================
  Files          15       15           
  Lines        2554     2581   +27     
=======================================
+ Hits         2534     2561   +27     
  Misses         20       20           
Files with missing lines Coverage Δ
tests/test_p_cif.py 99.72% <100.00%> (+0.02%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sbillinge
sbillinge merged commit f4be1d5 into main Nov 20, 2026
7 checks passed
@sbillinge
sbillinge deleted the fix-symop-eval branch November 20, 2026 05:45
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.

arbitrary code execution when loading a CIF file via eval of symmetry-operation strings (CWE-95)

1 participant