Skip to content

Dev - #52

Merged
nicholas9182 merged 12 commits into
mainfrom
dev
Sep 29, 2026
Merged

Dev#52
nicholas9182 merged 12 commits into
mainfrom
dev

Conversation

@nicholas9182

Copy link
Copy Markdown
Collaborator

No description provided.

0x1r1s and others added 12 commits September 24, 2026 17:24
- Store a class value as {'__type__': 'module.Class'} and resolve it through
  the allowlist. Before, a class value became None without an error.
- Serialize set and frozenset in sorted order. Accept a class, enum or tuple
  as a dict key.
- Add register_class_alias(old_path, new_path) so that payloads load after a
  class moves or is renamed.
- Add _schema_version, _migrate() and SchemaVersionError. Version 0 is not
  written, so existing payloads do not change.
- Raise MissingClassError when a payload names a class or module that the
  installed code does not have.
- PropagationMixin: do not call _set_parent on a class value.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
msgpack_numpy.decode calls pickle.loads on object-dtype ('O') numpy
arrays. m.patch() makes it the global msgpack object_hook, so any
msgpack.unpackb in the process runs pickle.loads on such an array.
pickle.loads runs arbitrary code, so an untrusted payload (for example
an uploaded .ocd design) could execute code during unpack, before any
class allowlist check. The patched reader also wraps a caller-supplied
object_hook and runs decode first, so a hook cannot make unpack safe.

Capture the unpatched msgpack.unpackb before m.patch(), then re-override
msgpack.unpackb/loads with a safe reader that refuses object-dtype
arrays and delegates all other maps (numeric/void arrays, complex
numbers, plain dicts) to the normal decoder. Writing (packb) is
unchanged. No cell design uses object-dtype arrays (verified against the
OpenCell database: 45895 arrays, all numeric, zero object arrays), so
the refusal breaks no real design.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
0.2.24 is already on PyPI and is now used by PR #48.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep dev's {'__set__': True, 'items': [...]} set payload (released in
0.2.24) with sorted items; reader also accepts the list-valued form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pe-references

Serializer: store classes as references, add aliases and schema versions
…-rce

Fix RCE: refuse object-dtype arrays in msgpack deserialization
@nicholas9182
nicholas9182 merged commit 082bbed into main Sep 29, 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.

2 participants