Skip to content

Restrict pickle class loading for .localstate deserialization#585

Merged
praegt merged 2 commits into
aws:masterfrom
praegt:fix/restrict-pickle-deserialization
May 13, 2026
Merged

Restrict pickle class loading for .localstate deserialization#585
praegt merged 2 commits into
aws:masterfrom
praegt:fix/restrict-pickle-deserialization

Conversation

@praegt
Copy link
Copy Markdown
Contributor

@praegt praegt commented May 11, 2026

Summary

Replace the unvalidated cPickle.loads() call in LocalState.loads() with a _SafeUnpickler that uses a strict class allowlist. Only LocalState, EnvvarCollector, and set are permitted during deserialization. Any other class raises UnpicklingError, which is caught and returns an empty LocalState.

The serialization format remains pickle, so there is no behavioral change for existing .localstate files.

Testing

  • Unit tests: 8/8 pass (including new test_loads_rejects_unlisted_class and test_dumps_loads_roundtrip)
  • Broader suite: 823 passed, 1 skipped across tests/unit/containers/ and tests/unit/operations/
  • E2E: Verified with actual eb local printenv and eb local setenv commands

Release

Includes version bump to 3.27.2.

ibrhmch
ibrhmch previously approved these changes May 11, 2026
scheenk
scheenk previously approved these changes May 11, 2026
shinmc
shinmc previously approved these changes May 11, 2026
nikita-khapre
nikita-khapre previously approved these changes May 11, 2026
github-actions[bot]
github-actions Bot previously approved these changes May 11, 2026
@praegt praegt force-pushed the fix/restrict-pickle-deserialization branch from af34e42 to a983edd Compare May 13, 2026 14:42
@praegt praegt deployed to integ-test May 13, 2026 14:42 — with GitHub Actions Active
@praegt praegt merged commit 20629ea into aws:master May 13, 2026
28 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.

7 participants