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

Overly broad file permissions #35

Open
blockauditech opened this issue May 2, 2018 · 0 comments
Open

Overly broad file permissions #35

blockauditech opened this issue May 2, 2018 · 0 comments

Comments

@blockauditech
Copy link

database/ffldb/blockio.go

func (s *blockStore) openWriteFile(fileNum uint32) (filer, error) {
	// The current block file needs to be read-write so it is possible to
	// append to it.  Also, it shouldn't be part of the least recently used
	// file.
	filePath := blockFilePath(s.basePath, fileNum)
	file, err := os.OpenFile(filePath, os.O_RDWR|os.O_CREATE, 0666) // HERE
	if err != nil {
		str := fmt.Sprintf("failed to open file %q: %v", filePath, err)
		return nil, makeDbErr(database.ErrDriverSpecific, str, err)
	}

	return file, nil
}

Should be 0640 or 0660, but 0666 lets anyone r/w to the file called via openWriteFile() on the local system.

@blockauditech blockauditech changed the title Overly permissive file permissions Overly broad file permissions May 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant