3 ms·
Author of openat2(2) here, yes it would (as well as protecting against races where the target directory is having path components changed to symlinks during ext
by cyphar 4y ago
Author of openat2(2) here, yes it would (as well as protecting against races where the target directory is having path components changed to symlinks during extraction). RESOLVE_IN_ROOT would be more akin to extracting in a chroot(2). But you would need to be careful how you deal with path operations in the rest of the program in a way that is fairly easy to mess up.
I've been working on a userspace library[1] which would make writing userspace programs that interact with these kinds of dangerous paths more safe (though it's been on the backburner recently).
[1]: https://github.com/openSUSE/libpathrs https://github.com/openSUSE/libpathrs