commit 4b877649af0f6237f46cf7d033fc896aa7cf8ca6 from: Omar Polo date: Thu Oct 07 21:57:07 2021 UTC fix sandbox wrt XDG-style directories commit - fb3d08c1f0590014fcb4230feb8fda8fa056773e commit + 4b877649af0f6237f46cf7d033fc896aa7cf8ca6 blob - 952b4a1a2dca0bec9854e2ffa1d6c084b622dcb8 blob + be90c6eac055f1d4c56762e1d6655255bffed9cd --- sandbox.c +++ sandbox.c @@ -14,6 +14,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "fs.h" #include "telescope.h" #ifdef __OpenBSD__ @@ -50,11 +51,15 @@ sandbox_fs_process(void) if (unveil(path, "rwc") == -1) err(1, "unveil"); - strlcpy(path, getenv("HOME"), sizeof(path)); - strlcat(path, "/.telescope/", sizeof(path)); - if (unveil(path, "rwc") == -1) + if (unveil(config_path_base, "rwc") == -1) err(1, "unveil"); + if (unveil(data_path_base, "rwc") == -1) + err(1, "unveil"); + + if (unveil(cache_path_base, "rwc") == -1) + err(1, "unveil"); + if (pledge("stdio rpath wpath cpath sendfd", NULL) == -1) err(1, "pledge"); }