Skip to content

Commit

Permalink
fix: check binary permissions before serving (#1047)
Browse files Browse the repository at this point in the history
Signed-off-by: Toma Puljak <[email protected]>
  • Loading branch information
Tpuljak authored Sep 3, 2024
1 parent f18ca23 commit 1d15289
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/server/downloads.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ func (s *Server) GetBinaryPath(binaryName, binaryVersion string) (string, error)

// If the requested binary is the same as the host, return the current binary path
if *hostOs == binaryOs && binaryVersion == internal.Version {
return os.Executable()
executable, err := os.Executable()
if err == nil {
_, err := os.Stat(executable)
if err == nil {
return executable, nil
}
}
}

binaryPath := filepath.Join(s.config.BinariesPath, binaryVersion, binaryName)
Expand Down

0 comments on commit 1d15289

Please sign in to comment.