Repository navigation
fix: block unsafe low-level stdlib imports - #349
DilipMallavarapu wants to merge 4 commits into
Conversation
|
Thanks for the contribution! Could you please sign the contributor license agreement? We’ll need the signed CLA before we can review and merge this PR. |
|
I tried to sign the agreement yesterday but due to some rate limiting issues I couldn't sign it, I checked it now and signed it! Thanks :) |
dguido
left a comment
There was a problem hiding this comment.
[P1] fickling/fickle.py:249 blocks termios.tcsetattr, but tty.tcsetattr is the same function on Unix. A pickle importing it through tty receives LIKELY_SAFE from check_safety(). Please block the relevant tty exports and add an alias-path regression test.
|
Good catch @dguido ! Confirmed on Python 3.12 that tty re-exports the termios functions via from termios import *, so tty.tcsetattr and the other affected functions resolve to the same objects. Added the six unsafe tty aliases to UNSAFE_GLOBALS and regression tests covering the tty import paths. Left the read-only tcgetattr and tcgetwinsize out to avoid false positives. Fixed in 3fdf2dc. Thanks for the review! |
Summary
fcntl,termios,resource, andmsvcrttoUNSAFE_IMPORTSto flag potentially unsafe standard library calls.Testing