Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Fix permissions when creating file to be 640 #27

Merged
merged 2 commits into from
May 28, 2023

Conversation

calvinmclean
Copy link
Contributor

Files created for YAML/JSON storage should not be executable

@codecov
Copy link

codecov bot commented May 27, 2023

Codecov Report

Merging #27 (74ad5ad) into main (4609e29) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #27   +/-   ##
=======================================
  Coverage   89.60%   89.60%           
=======================================
  Files           8        8           
  Lines         779      779           
=======================================
  Hits          698      698           
  Misses         56       56           
  Partials       25       25           
Impacted Files Coverage Δ
drivers/hashmap/hashmap.go 87.90% <100.00%> (ø)

@@ -110,7 +110,7 @@ func (db *Database) Setup() error {
defer db.Unlock()

// check file and create if it does not exist
file, err := os.OpenFile(db.config.Filename, os.O_RDONLY|os.O_CREATE, 0755)
file, err := os.OpenFile(db.config.Filename, os.O_RDONLY|os.O_CREATE, 0644)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I think we should go with 640 though as this probably should also not be world readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, just pushed that change. I also updated the permission on the test files in testdata, but git didn't show them as modified

@calvinmclean calvinmclean changed the title Fix permissions when creating file to be 644 Fix permissions when creating file to be 640 May 27, 2023
@madflojo madflojo merged commit 58365df into madflojo:main May 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants