summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-05-29 05:27:41 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-05-29 05:27:41 -0400
commite64e4e3ec85753dcfcc1a0bfa3c65573e351b0ef (patch)
tree19098ac25875cedaf5271723bc19806cd10f29e8 /main.go
parent47cfde452d5638fb7eb418a70ef775c03d25f91c (diff)
Add permission flags
Diffstat (limited to 'main.go')
-rw-r--r--main.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/main.go b/main.go
index 3069c0380..ce96c1e7f 100644
--- a/main.go
+++ b/main.go
@@ -14,6 +14,29 @@ var flagV8Options = flag.Bool("v8-options", false, "Print V8 command line option
var flagDebug = flag.Bool("debug", false, "Enable debug output.")
var flagGoProf = flag.String("goprof", "", "Write golang cpu profile to file.")
+var flagAllowWrite = flag.Bool("allow-write", false,
+ "Allow program to write to the fs.")
+var flagAllowConnect = flag.Bool("allow-connect", false,
+ "Allow program to connect to other network addresses.")
+var flagAllowAccept = flag.Bool("allow-accept", false,
+ "Allow program to accept connections.")
+var flagAllowRead = flag.Bool("allow-read", true,
+ "Allow program to read file system.")
+
+var Perms struct {
+ FsRead bool
+ FsWrite bool
+ Connect bool
+ Accept bool
+}
+
+func setPerms() {
+ Perms.FsRead = *flagAllowRead
+ Perms.FsWrite = *flagAllowWrite
+ Perms.Connect = *flagAllowConnect
+ Perms.Accept = *flagAllowAccept
+}
+
func stringAsset(path string) string {
data, err := Asset("dist/" + path)
check(err)
@@ -23,6 +46,7 @@ func stringAsset(path string) string {
func FlagsParse() []string {
flag.Parse()
args := flag.Args()
+ setPerms()
if *flagV8Options {
args = append(args, "--help")
}