-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Fix permissions of generated Filebeat filesets #7140
Fix permissions of generated Filebeat filesets #7140
Conversation
@@ -70,7 +70,8 @@ func copyTemplate(template, dest string, replace map[string]string) error { | |||
if err != nil { | |||
return fmt.Errorf("cannot copy template: %v", err) | |||
} | |||
return nil | |||
|
|||
return os.Chmod(dest, 0644) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0644
should be passed to the ioutil.WriteFile
rather than doing this in a separate syscall.
On a side note, it looks like this file is is incorrectly using os.ModePerm
. Generally this value is used as a mask with mode bits to isolate the permission bits (e.g. perm = fileinfo.Mode() & os.ModePerm
). Writing a file with 0777
should almost never be done for security reasons. In most cases if you are creating a file without any sensitive data use 0644
and if it's a dir use 0755
.
1e7dc40
to
a3e6fb3
Compare
I added a new sections and a new entry to the developer changelog. @ruflin Is this the correct place for this PR? |
@kvch If it's also a problem in master, I would suggest to open it against master and then do the backport with out backport scripts. |
Sorry, I meant if the developer changelog is the correct changelog to put this entry. |
@kvch Argh, sorry. I was looking at an other PR against 6.2 and saw this comment and thought I'm still in the same PR. Ignore my comment. +1 on where you added it. |
* fix generated files' permission Closes elastic#6856 (cherry picked from commit 89178c3)
* fix generated files' permission Closes elastic#6856 (cherry picked from commit 298fd63)
Closes #6856