From 297e6625f30a4145ec08c11d2efa875945bc4150 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 31 Mar 2020 13:01:55 +0200 Subject: Browser: Refuse to run as root --- Applications/Browser/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Applications/Browser/main.cpp b/Applications/Browser/main.cpp index 25f01f5755..71f5cbfa45 100644 --- a/Applications/Browser/main.cpp +++ b/Applications/Browser/main.cpp @@ -62,6 +62,11 @@ static String s_title = ""; int main(int argc, char** argv) { + if (getuid() == 0) { + fprintf(stderr, "Refusing to run as root\n"); + return 1; + } + if (pledge("stdio shared_buffer accept unix cpath rpath wpath fattr", nullptr) < 0) { perror("pledge"); return 1; -- cgit v1.2.3