Skip to content

Commit 77eafdc

Browse files
Harden pickle.load() against deserialization attacks
1 parent 03f4992 commit 77eafdc

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pytest = "^7.1.3"
1313
requests = "^2.28.1"
1414
jupyter = "^1.0.0"
1515
ipython = "^8.5.0"
16+
fickling = ">=0.1.3,~=0.1.0"
1617

1718

1819
[tool.poetry.group.dev.dependencies]

python3/11_File_Operations/02_structured_files/01_pickle/01_pickle/c_dump_load.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
loads -- from a python string
1616
"""
1717
import pickle
18+
import fickling
1819

1920
data = (
2021
123,
@@ -35,7 +36,7 @@
3536
f.close()
3637

3738
with open("serialized_data.pkl", "rb") as g:
38-
retrieved_data = pickle.load(g)
39+
retrieved_data = fickling.load(g)
3940
print(f"retrieved_data: {retrieved_data} {type(retrieved_data)}")
4041

4142
assert data == retrieved_data
@@ -48,7 +49,7 @@
4849
f.close()
4950

5051
with open("serialized_data.pkl", "rb") as g:
51-
retrieved_data = pickle.load(g)
52+
retrieved_data = fickling.load(g)
5253
print(f"retrieved_data: {retrieved_data} {type(retrieved_data)}")
5354

5455
# cpython - it is c implementation of python

0 commit comments

Comments
 (0)