Commit 90cc8dd
committed
Add pickle.load, pickle.loads, and pickle.Unpickler audit events
Add audit hooks that fire when unpickling operations are initiated,
complementing the existing pickle.find_class audit event. This allows
audit hooks to detect and block untrusted deserialization at the entry
point, before any pickle opcodes are processed.
New audit events:
- pickle.load: raised by pickle.load() with no arguments
- pickle.loads: raised by pickle.loads() with the data argument
- pickle.Unpickler: raised by Unpickler.__init__() with the file argument
Both the C (_pickle) and Python (pickle) implementations are covered.
https://claude.ai/code/session_014cvXKnYLMAjdJpE59sKGUi1 parent 149c465 commit 90cc8dd
5 files changed
Lines changed: 58 additions & 0 deletions
File tree
- Doc/library
- Lib
- test
- Misc/NEWS.d/next/Security
- Modules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| 243 | + | |
| 244 | + | |
243 | 245 | | |
244 | 246 | | |
245 | 247 | | |
| |||
255 | 257 | | |
256 | 258 | | |
257 | 259 | | |
| 260 | + | |
| 261 | + | |
258 | 262 | | |
259 | 263 | | |
260 | 264 | | |
| |||
430 | 434 | | |
431 | 435 | | |
432 | 436 | | |
| 437 | + | |
| 438 | + | |
433 | 439 | | |
434 | 440 | | |
435 | 441 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1314 | 1314 | | |
1315 | 1315 | | |
1316 | 1316 | | |
| 1317 | + | |
1317 | 1318 | | |
1318 | 1319 | | |
1319 | 1320 | | |
| |||
1909 | 1910 | | |
1910 | 1911 | | |
1911 | 1912 | | |
| 1913 | + | |
1912 | 1914 | | |
1913 | 1915 | | |
1914 | 1916 | | |
1915 | 1917 | | |
1916 | 1918 | | |
1917 | 1919 | | |
1918 | 1920 | | |
| 1921 | + | |
1919 | 1922 | | |
1920 | 1923 | | |
1921 | 1924 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
| |||
155 | 156 | | |
156 | 157 | | |
157 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
158 | 191 | | |
159 | 192 | | |
160 | 193 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7514 | 7514 | | |
7515 | 7515 | | |
7516 | 7516 | | |
| 7517 | + | |
| 7518 | + | |
| 7519 | + | |
| 7520 | + | |
7517 | 7521 | | |
7518 | 7522 | | |
7519 | 7523 | | |
| |||
8043 | 8047 | | |
8044 | 8048 | | |
8045 | 8049 | | |
| 8050 | + | |
| 8051 | + | |
| 8052 | + | |
| 8053 | + | |
8046 | 8054 | | |
8047 | 8055 | | |
8048 | 8056 | | |
| |||
8104 | 8112 | | |
8105 | 8113 | | |
8106 | 8114 | | |
| 8115 | + | |
| 8116 | + | |
| 8117 | + | |
| 8118 | + | |
8107 | 8119 | | |
8108 | 8120 | | |
8109 | 8121 | | |
| |||
0 commit comments