From b42ebd2317e3b688ae9aaf3d4910e8e38763cf11 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Thu, 16 Mar 2023 17:23:53 -0700 Subject: [PATCH 1/3] api: Use 0700 file permissions for ExportChain --- eth/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth/api.go b/eth/api.go index cd6510ccf9a2..94024d1e5d19 100644 --- a/eth/api.go +++ b/eth/api.go @@ -161,7 +161,7 @@ func (api *AdminAPI) ExportChain(file string, first *uint64, last *uint64) (bool return false, errors.New("location would overwrite an existing file") } // Make sure we can create the file to export into - out, err := os.OpenFile(file, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.ModePerm) + out, err := os.OpenFile(file, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.FileMode(0700)) if err != nil { return false, err } From 8df98883257a5a9b06562de2a2a1d174160baa1e Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Fri, 17 Mar 2023 08:35:42 -0700 Subject: [PATCH 2/3] change perm to 0644 --- eth/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth/api.go b/eth/api.go index 94024d1e5d19..1787eb420504 100644 --- a/eth/api.go +++ b/eth/api.go @@ -161,7 +161,7 @@ func (api *AdminAPI) ExportChain(file string, first *uint64, last *uint64) (bool return false, errors.New("location would overwrite an existing file") } // Make sure we can create the file to export into - out, err := os.OpenFile(file, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.FileMode(0700)) + out, err := os.OpenFile(file, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.FileMode(0644)) if err != nil { return false, err } From a2229b23af0b4f1b10609ed6cdd8a1cbc2c82faf Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 17 Mar 2023 18:58:07 +0100 Subject: [PATCH 3/3] Update api.go --- eth/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth/api.go b/eth/api.go index 1787eb420504..66df927ac641 100644 --- a/eth/api.go +++ b/eth/api.go @@ -161,7 +161,7 @@ func (api *AdminAPI) ExportChain(file string, first *uint64, last *uint64) (bool return false, errors.New("location would overwrite an existing file") } // Make sure we can create the file to export into - out, err := os.OpenFile(file, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.FileMode(0644)) + out, err := os.OpenFile(file, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644) if err != nil { return false, err }