mscs 2.3.0__tar.gz → 2.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mscs-2.3.0 → mscs-2.4.1}/PKG-INFO +7 -6
- {mscs-2.3.0 → mscs-2.4.1}/README.md +6 -5
- {mscs-2.3.0 → mscs-2.4.1}/pyproject.toml +1 -1
- {mscs-2.3.0 → mscs-2.4.1}/src/mscs/_core.py +1276 -1159
- {mscs-2.3.0 → mscs-2.4.1}/.gitignore +0 -0
- {mscs-2.3.0 → mscs-2.4.1}/LICENSE +0 -0
- {mscs-2.3.0 → mscs-2.4.1}/src/mscs/__init__.py +0 -0
- {mscs-2.3.0 → mscs-2.4.1}/src/mscs/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mscs
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.1
|
|
4
4
|
Summary: Safe, fast serialization for Python — a secure replacement for pickle with HMAC authentication, native numpy/PyTorch support.
|
|
5
5
|
Project-URL: Homepage, https://github.com/ElEscribanoSilente/MSC-Serial
|
|
6
6
|
Project-URL: Repository, https://github.com/ElEscribanoSilente/MSC-Serial
|
|
@@ -41,7 +41,7 @@ Description-Content-Type: text/markdown
|
|
|
41
41
|
|
|
42
42
|
# MSCS — Safe Serialization for Python
|
|
43
43
|
|
|
44
|
-
**v2.
|
|
44
|
+
**v2.4.1** | [Changelog](CHANGELOG.md) | [PyPI](https://pypi.org/project/mscs/)
|
|
45
45
|
|
|
46
46
|
> **Status: Beta** — API is stable but the format may evolve. Not yet battle-tested in large-scale production.
|
|
47
47
|
|
|
@@ -208,13 +208,13 @@ mscs.loads(unsigned_data, hmac_key=key) # MSCSecurityError: anti-downgrade prot
|
|
|
208
208
|
|------|-------|
|
|
209
209
|
| `None`, `bool`, `int`, `float`, `complex` | Ints up to 8192 bytes (~19,700 digits) |
|
|
210
210
|
| `str`, `bytes`, `bytearray` | UTF-8, ref-tracked |
|
|
211
|
-
| `list`, `tuple`, `dict`, `set`, `frozenset` | Circular refs supported |
|
|
211
|
+
| `list`, `tuple`, `dict`, `set`, `frozenset`, `deque` | Circular refs supported; `deque` preserves `maxlen` |
|
|
212
212
|
| `datetime`, `date`, `time`, `timedelta` | ISO 8601 |
|
|
213
213
|
| `Decimal`, `UUID`, `Path` | Lossless |
|
|
214
214
|
| `Enum` | Must be registered |
|
|
215
215
|
| `numpy.ndarray` | dtype whitelist enforced |
|
|
216
216
|
| `torch.Tensor` | Auto CPU transfer, preserves requires_grad |
|
|
217
|
-
| `dataclass
|
|
217
|
+
| `dataclass` (incl. `frozen`), `__slots__`, `__dict__` objects | Must be registered |
|
|
218
218
|
|
|
219
219
|
## Performance
|
|
220
220
|
|
|
@@ -242,10 +242,10 @@ mscs provides a **defense-in-depth** approach, but it is **not a sandbox**. Unde
|
|
|
242
242
|
2. **Explicit registry**: Custom classes must be registered before deserialization; unregistered classes raise `MSCSecurityError`
|
|
243
243
|
3. **NumPy dtype whitelist**: Blocks `object`, `void`, and structured dtypes that could execute code
|
|
244
244
|
4. **Configurable limits**: `MAX_DEPTH=256`, `MAX_SIZE=512MB`, `MAX_COLLECTION=10M`, `MAX_INT_BYTES=8192`
|
|
245
|
-
5. **Anti zip-bomb**: `load_compressed`
|
|
245
|
+
5. **Anti zip-bomb**: `load_compressed` caps the compressed input and decompresses **incrementally** against a hard `MAX_SIZE` limit, aborting as soon as it is crossed — a bomb cannot exhaust memory before the size check
|
|
246
246
|
6. **Path null byte rejection**: Paths containing null bytes are rejected
|
|
247
247
|
7. **CRC32 corruption detection**: Optional checksum to detect accidental data corruption (not cryptographic — an attacker can forge CRC32)
|
|
248
|
-
8. **HMAC-SHA256 authentication**: Optional cryptographic signature to detect intentional tampering. Anti-downgrade protection
|
|
248
|
+
8. **HMAC-SHA256 authentication**: Optional cryptographic signature to detect intentional tampering. Anti-downgrade protection rejects any payload lacking a valid HMAC when a key is supplied — including the legacy **v1** format — so an attacker cannot strip or version-downgrade the signature.
|
|
249
249
|
9. **Trailing bytes rejection**: Payloads with unexpected bytes after the serialized object are rejected
|
|
250
250
|
10. **Integer size limit**: Ints larger than `MAX_INT_BYTES` (8192 bytes, ~19,700 digits) are rejected to prevent CPU exhaustion attacks
|
|
251
251
|
|
|
@@ -303,6 +303,7 @@ CRC32 and HMAC are mutually exclusive (HMAC is strictly superior).
|
|
|
303
303
|
| 0x17 | Path | `<I>` str len + UTF-8 path string |
|
|
304
304
|
| 0x18 | Tensor | str(meta) + `<I>` data size + raw buffer |
|
|
305
305
|
| 0x19 | timedelta2 | `<iiI>` days, seconds, microseconds |
|
|
306
|
+
| 0x1A | deque | `<i>` maxlen (-1 if None) + `<I>` item count + items |
|
|
306
307
|
|
|
307
308
|
**ndarray meta**: `"{dtype}|{shape}"` where shape is `"dim0xdim1x..."` (e.g., `"float32|100x100"`).
|
|
308
309
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MSCS — Safe Serialization for Python
|
|
2
2
|
|
|
3
|
-
**v2.
|
|
3
|
+
**v2.4.1** | [Changelog](CHANGELOG.md) | [PyPI](https://pypi.org/project/mscs/)
|
|
4
4
|
|
|
5
5
|
> **Status: Beta** — API is stable but the format may evolve. Not yet battle-tested in large-scale production.
|
|
6
6
|
|
|
@@ -167,13 +167,13 @@ mscs.loads(unsigned_data, hmac_key=key) # MSCSecurityError: anti-downgrade prot
|
|
|
167
167
|
|------|-------|
|
|
168
168
|
| `None`, `bool`, `int`, `float`, `complex` | Ints up to 8192 bytes (~19,700 digits) |
|
|
169
169
|
| `str`, `bytes`, `bytearray` | UTF-8, ref-tracked |
|
|
170
|
-
| `list`, `tuple`, `dict`, `set`, `frozenset` | Circular refs supported |
|
|
170
|
+
| `list`, `tuple`, `dict`, `set`, `frozenset`, `deque` | Circular refs supported; `deque` preserves `maxlen` |
|
|
171
171
|
| `datetime`, `date`, `time`, `timedelta` | ISO 8601 |
|
|
172
172
|
| `Decimal`, `UUID`, `Path` | Lossless |
|
|
173
173
|
| `Enum` | Must be registered |
|
|
174
174
|
| `numpy.ndarray` | dtype whitelist enforced |
|
|
175
175
|
| `torch.Tensor` | Auto CPU transfer, preserves requires_grad |
|
|
176
|
-
| `dataclass
|
|
176
|
+
| `dataclass` (incl. `frozen`), `__slots__`, `__dict__` objects | Must be registered |
|
|
177
177
|
|
|
178
178
|
## Performance
|
|
179
179
|
|
|
@@ -201,10 +201,10 @@ mscs provides a **defense-in-depth** approach, but it is **not a sandbox**. Unde
|
|
|
201
201
|
2. **Explicit registry**: Custom classes must be registered before deserialization; unregistered classes raise `MSCSecurityError`
|
|
202
202
|
3. **NumPy dtype whitelist**: Blocks `object`, `void`, and structured dtypes that could execute code
|
|
203
203
|
4. **Configurable limits**: `MAX_DEPTH=256`, `MAX_SIZE=512MB`, `MAX_COLLECTION=10M`, `MAX_INT_BYTES=8192`
|
|
204
|
-
5. **Anti zip-bomb**: `load_compressed`
|
|
204
|
+
5. **Anti zip-bomb**: `load_compressed` caps the compressed input and decompresses **incrementally** against a hard `MAX_SIZE` limit, aborting as soon as it is crossed — a bomb cannot exhaust memory before the size check
|
|
205
205
|
6. **Path null byte rejection**: Paths containing null bytes are rejected
|
|
206
206
|
7. **CRC32 corruption detection**: Optional checksum to detect accidental data corruption (not cryptographic — an attacker can forge CRC32)
|
|
207
|
-
8. **HMAC-SHA256 authentication**: Optional cryptographic signature to detect intentional tampering. Anti-downgrade protection
|
|
207
|
+
8. **HMAC-SHA256 authentication**: Optional cryptographic signature to detect intentional tampering. Anti-downgrade protection rejects any payload lacking a valid HMAC when a key is supplied — including the legacy **v1** format — so an attacker cannot strip or version-downgrade the signature.
|
|
208
208
|
9. **Trailing bytes rejection**: Payloads with unexpected bytes after the serialized object are rejected
|
|
209
209
|
10. **Integer size limit**: Ints larger than `MAX_INT_BYTES` (8192 bytes, ~19,700 digits) are rejected to prevent CPU exhaustion attacks
|
|
210
210
|
|
|
@@ -262,6 +262,7 @@ CRC32 and HMAC are mutually exclusive (HMAC is strictly superior).
|
|
|
262
262
|
| 0x17 | Path | `<I>` str len + UTF-8 path string |
|
|
263
263
|
| 0x18 | Tensor | str(meta) + `<I>` data size + raw buffer |
|
|
264
264
|
| 0x19 | timedelta2 | `<iiI>` days, seconds, microseconds |
|
|
265
|
+
| 0x1A | deque | `<i>` maxlen (-1 if None) + `<I>` item count + items |
|
|
265
266
|
|
|
266
267
|
**ndarray meta**: `"{dtype}|{shape}"` where shape is `"dim0xdim1x..."` (e.g., `"float32|100x100"`).
|
|
267
268
|
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "mscs"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.4.1"
|
|
8
8
|
description = "Safe, fast serialization for Python — a secure replacement for pickle with HMAC authentication, native numpy/PyTorch support."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|