-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
31 lines (26 loc) · 760 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (c) 2023 Joshua Rich <[email protected]>
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
package main
import (
"syscall"
"github.com/joshuar/autocorrector/cmd"
"github.com/rs/zerolog/log"
)
func main() {
cmd.Execute()
}
// Following is copied from https://git.kernel.org/pub/scm/libs/libcap/libcap.git/tree/goapps/web/web.go
//
// ensureNotEUID aborts the program if it is running setuid something,
// or being invoked by root.
func init() {
euid := syscall.Geteuid()
uid := syscall.Getuid()
egid := syscall.Getegid()
gid := syscall.Getgid()
if uid != euid || gid != egid || uid == 0 {
log.Fatal().Msg("autocorrector should not be run with additional privileges or as root.")
}
}