Skip to content

Dev - #42

Merged
nicholas9182 merged 9 commits into
mainfrom
dev
Aug 18, 2026
Merged

Dev#42
nicholas9182 merged 9 commits into
mainfrom
dev

Conversation

@nicholas9182

Copy link
Copy Markdown
Collaborator

No description provided.

nicholas9182 and others added 9 commits July 23, 2026 10:01
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Dense point clouds (>4096 points) are reduced to their outer rim
(max-radius candidates per angular bin around the centroid) before the
shapely minimum-bounding-circle call, and the redundant pd.isna scan on
float arrays is gone. ~10-25x faster on jelly-roll cross-sections with
sub-micrometre result drift.

Co-authored-by: Cursor <cursoragent@cursor.com>
`SerializerMixin.deserialize` resolved class paths taken from the payload:
`_get_class` passed them to `importlib.import_module` + `getattr`, and the
`__enum__` branch then *called* the result with a payload-supplied argument. A
crafted `.ocd` file could therefore reach any importable callable, e.g.

    {"__enum__": true, "class": "os.system", "value": "<cmd>"}

Class resolution is now gated by an allowlist of top-level packages, and the
resolved object must be a class of the expected kind — a SerializerMixin
subclass for objects, an Enum subclass for enums. Restricting the enum branch to
real enums is what makes that call safe: `SomeEnum(value)` is a member lookup.

Rejections raise the new `UnsafeClassPathError`, a `ValueError` subclass, so
callers already catching `ValueError` around `deserialize` are unaffected.
`allow_class_roots()` lets downstream packages register their own roots.

Verified against real data: every class path in all 19 cells in the OpenCell
reference database resolves under `steer_opencell_design` and is a
SerializerMixin or Enum subclass, and all 19 still deserialize and round-trip.
The gadget above is rejected without executing.

Bumped to 0.2.21. 13 new tests cover the gadgets, the type checks, malformed
paths, and a legitimate round trip as the positive control.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@nicholas9182
nicholas9182 merged commit fd75854 into main Aug 18, 2026
2 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.

1 participant