Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set umask=0 when creating unix sockets #743

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@
network, addr := getNetworkAndAddr(listenAddr, port)
lc := net.ListenConfig{KeepAlive: time.Duration(keepAlive) * time.Second}

oldMask := umask(0)
defer umask(oldMask)

Check warning on line 82 in runner/runner.go

View check run for this annotation

Codecov / codecov/patch

runner/runner.go#L80-L82

Added lines #L80 - L82 were not covered by tests
l, err := lc.Listen(context.Background(), network, addr)
if err == nil {
fmt.Println("Started listening for", connectionType, "on", l.Addr().Network(), l.Addr().String())
Expand Down
7 changes: 7 additions & 0 deletions runner/umask.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build unix

package runner

import "syscall"

var umask = syscall.Umask
7 changes: 7 additions & 0 deletions runner/umask_fallback.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build !unix

package runner

func umask(_ int) int {
return 0
}
Loading