Selaa lähdekoodia

js: Use pledge()

It is now no longer possible to make network connections from a hijacked
js(1) :^)
Linus Groh 3 vuotta sitten
vanhempi
commit
8fa5dc7241
1 muutettua tiedostoa jossa 5 lisäystä ja 0 poistoa
  1. 5 0
      Userland/Utilities/js.cpp

+ 5 - 0
Userland/Utilities/js.cpp

@@ -61,6 +61,7 @@
 #include <LibJS/Runtime/Value.h>
 #include <LibJS/Runtime/Value.h>
 #include <LibLine/Editor.h>
 #include <LibLine/Editor.h>
 #include <LibMain/Main.h>
 #include <LibMain/Main.h>
+#include <LibSystem/Wrappers.h>
 #include <fcntl.h>
 #include <fcntl.h>
 #include <signal.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdio.h>
@@ -1105,6 +1106,10 @@ public:
 
 
 ErrorOr<int> serenity_main(Main::Arguments arguments)
 ErrorOr<int> serenity_main(Main::Arguments arguments)
 {
 {
+#ifdef __serenity__
+    TRY(System::pledge("stdio rpath wpath cpath tty sigaction", nullptr));
+#endif
+
     bool gc_on_every_allocation = false;
     bool gc_on_every_allocation = false;
     bool disable_syntax_highlight = false;
     bool disable_syntax_highlight = false;
     Vector<String> script_paths;
     Vector<String> script_paths;