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

blobl/fileblob: Add a custom createTemp function that uses consistent file permissions. #3166

Merged
merged 1 commit into from Sep 16, 2022

Conversation

calebbrown
Copy link
Contributor

A take at trying to make the file permissions consistent between directories, blob files and attribute files.

Rather than using a syscall to grab the umask, we replace os.CreateTemp/ioutil.TempFile with our own version that uses the permissions we desire.

Differences with os.CreateTemp:

  • Uses time.UnixNano() instead of fastrand()
  • Stores the temporary file "in-place" while it is being written

This has the following implications:

  • After the year 2262 the behaviour is undefined (as per time.UnixNano())
  • It is possible for the file to already exist - this has a low likelihood, as the int64 is serialized as a hex value in the filename

Fixes #3165

Signed-off-by: Caleb Brown <calebbrown@google.com>
@codecov
Copy link

codecov bot commented Sep 16, 2022

Codecov Report

Merging #3166 (afc114a) into master (2c69298) will increase coverage by 0.00%.
The diff coverage is 63.63%.

@@           Coverage Diff           @@
##           master    #3166   +/-   ##
=======================================
  Coverage   72.78%   72.79%           
=======================================
  Files         113      113           
  Lines       14388    14398   +10     
=======================================
+ Hits        10473    10481    +8     
- Misses       3189     3191    +2     
  Partials      726      726           
Impacted Files Coverage Δ
blob/fileblob/fileblob.go 81.97% <63.63%> (-0.50%) ⬇️
runtimevar/awssecretsmanager/awssecretsmanager.go 83.00% <0.00%> (+0.97%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@vangent vangent merged commit b078f17 into google:master Sep 16, 2022
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

Successfully merging this pull request may close these issues.

blob/fileblob: file permissions are inconsistent
2 participants