Skip to content

Security hardening: pickle -> json - #423

Merged
hobu merged 7 commits into
Toblerity:mainfrom
adamjstewart:security/json
Sep 23, 2026
Merged

hobu merged 7 commits into
Toblerity:mainfrom
adamjstewart:security/json

Conversation

@adamjstewart

Copy link
Copy Markdown
Collaborator

Alternative to #420

@hobu @mwtoews I think I found a way to make json safe. This supports a much wider variety of types than manual str parsing, and should be unnoticeable for most users. The only difference found during testing is that tuples are replaced by lists, but that may not matter for most use cases. Arbitrary custom objects are no longer supported, but we could document this. If this looks good I can also add unit tests for this new error path.

Closes #420

Signed-off-by: Adam J. Stewart <ajstewart426@gmail.com>
Comment thread rtree/index.py Outdated
Signed-off-by: Adam J. Stewart <ajstewart426@gmail.com>
Comment thread rtree/index.py Outdated

@hobu hobu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if we should let users dynamically control this size limitation, but we should parameterize it to make it convenient to change.

Comment thread rtree/index.py
Comment thread rtree/index.py
Comment thread rtree/index.py Outdated
Comment thread rtree/index.py Outdated
Comment thread rtree/index.py Outdated
adamjstewart and others added 3 commits September 18, 2026 14:40
Co-authored-by: Howard Butler <howard@hobu.co>
Signed-off-by: Adam J. Stewart <ajstewart426@gmail.com>
Signed-off-by: Adam J. Stewart <ajstewart426@gmail.com>
@adamjstewart

Copy link
Copy Markdown
Collaborator Author

Reminder: double check for other places in the docs that mention pickle and document that only valid JSON objects are serializable.

Signed-off-by: Adam J. Stewart <ajstewart426@gmail.com>
Signed-off-by: Adam J. Stewart <ajstewart426@gmail.com>
@hobu
hobu merged commit 6641371 into Toblerity:main Sep 23, 2026
25 checks passed
@adamjstewart
adamjstewart deleted the security/json branch September 23, 2026 15:49
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