Comment 1 for bug 1815422

Revision history for this message
Tristan Cacqueray (tristan-cacqueray) wrote :

That is odd, perhaps there is a paste error?

$ cat test.py
```
import os
def is_safe_path(basedir, path, follow_symlinks=True):
# resolves symbolic links
  if follow_symlinks:
    return os.path.realpath(path).startswith(basedir)
  return os.path.abspath(path).startswith(basedir)
print(is_safe_path("/home/ad", "../admin/.ssh/id_rsa"))
```
$ python test.py
False
$ python -V
Python 3.7.3