Files
Evan Mattson 1b95e8585d Python: Add allowed_checkpoint_types support to CosmosCheckpointStorage for parity with FileCheckpointStorage (#5202)
* Python: Add allowed_checkpoint_types support to CosmosCheckpointStorage (#5200)

Add allowed_checkpoint_types parameter to CosmosCheckpointStorage for
parity with FileCheckpointStorage. This ensures both providers use the
same restricted pickle deserialization by default.

Changes:
- Accept allowed_checkpoint_types kwarg in __init__, stored as frozenset
- Convert _document_to_checkpoint from @staticmethod to instance method
- Forward allowed_types to decode_checkpoint_value on all load paths
- Update class docstring to describe the new parameter
- Add tests covering built-in safe types, app type opt-in/blocking,
  and all load paths (load, list_checkpoints, get_latest)
- Add changelog entry noting the breaking behavior change

BREAKING CHANGE: CosmosCheckpointStorage now uses restricted pickle
deserialization by default. Checkpoints containing application-defined
types will require passing those types via allowed_checkpoint_types.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Python: Add `allowed_checkpoint_types` support to `CosmosCheckpointStorage` for parity with `FileCheckpointStorage`

Fixes #5200

* Address PR review: add pickle security warning and fix docstring examples

- Reintroduce explicit security warning about pickle deserialization risks
- Convert Example:: block to .. code-block:: python with imports for
  consistency with other docstring examples
- Note: PR title should be updated to include [BREAKING] prefix per
  changelog convention (comment #3, requires GitHub UI change)

Fixes #5200

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1b95e8585d ยท 2026-04-14 02:20:55 +00:00
History
..