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

Fix permissions of generated Filebeat filesets #7140

Merged
merged 2 commits into from
May 22, 2018

Conversation

kvch
Copy link
Contributor

@kvch kvch commented May 18, 2018

Closes #6856

@kvch kvch added review Filebeat Filebeat labels May 18, 2018
@@ -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)
Copy link
Member

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.

@kvch kvch force-pushed the fix/filebeat/generator-permissions branch from 1e7dc40 to a3e6fb3 Compare May 22, 2018 08:23
@kvch kvch changed the title Fix generated files' permission in Filebeat Fix permissions of generated Filebeat filesets May 22, 2018
@kvch
Copy link
Contributor Author

kvch commented May 22, 2018

I added a new sections and a new entry to the developer changelog. @ruflin Is this the correct place for this PR?

@ruflin
Copy link
Member

ruflin commented May 22, 2018

@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.

@kvch
Copy link
Contributor Author

kvch commented May 22, 2018

Sorry, I meant if the developer changelog is the correct changelog to put this entry.
But you are right, this should be backported.

@kvch kvch added the needs_backport PR is waiting to be backported to other branches. label May 22, 2018
@ruflin
Copy link
Member

ruflin commented May 22, 2018

@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.

@andrewkroh andrewkroh merged commit 89178c3 into elastic:master May 22, 2018
kvch added a commit to kvch/beats that referenced this pull request Jun 18, 2018
* fix generated files' permission

Closes elastic#6856

(cherry picked from commit 89178c3)
ph pushed a commit that referenced this pull request Jun 18, 2018
* fix generated files' permission

Closes #6856

(cherry picked from commit 89178c3)
@kvch kvch removed the needs_backport PR is waiting to be backported to other branches. label Jun 26, 2018
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
* fix generated files' permission

Closes elastic#6856

(cherry picked from commit 298fd63)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants