Commit 861f3006465e1fe55732efb1052b4e3ddd5474e3

Stefan Sperling 2020-03-18T16:13:44

pledge got-index-pack

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/libexec/got-index-pack/got-index-pack.c b/libexec/got-index-pack/got-index-pack.c
index a6cace5..db94f5f 100644
--- a/libexec/got-index-pack/got-index-pack.c
+++ b/libexec/got-index-pack/got-index-pack.c
@@ -762,7 +762,14 @@ main(int argc, char **argv)
 	}
 
 	imsg_init(&ibuf, GOT_IMSG_FD_CHILD);
-
+#ifndef PROFILE
+	/* revoke access to most system calls */
+	if (pledge("stdio recvfd", NULL) == -1) {
+		err = got_error_from_errno("pledge");
+		got_privsep_send_error(&ibuf, err);
+		return 1;
+	}
+#endif
 	err = got_privsep_recv_imsg(&imsg, &ibuf, 0);
 	if (err)
 		goto done;