Repository navigation
Dev - #52
Merged
Merged
Dev#52
Conversation
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.