oss-sec mailing list archives

Re: ipython3 may execute code from the current working directory


From: Jakub Wilk <jwilk () jwilk net>
Date: Sat, 24 Jul 2021 18:59:55 +0200

* Mats Wichmann <mats () wichmann us>, 2021-07-23, 14:39:
https://github.com/ipython/ipython/blob/7.25.0/IPython/core/shellapp.py#L219

normally (cpython), an empty string in sys.path doesn't mean "current directory", it means "script directory", the directory the script you're running is found in [1].

No, empty string in sys.path always means cwd.

sys.path[0] is the script directory (if available), but that's a non-empty string.

But you might be right that this is IPython's failure to mimic how the normal Python interpreter initializes sys.path.

--
Jakub Wilk


Current thread: