Restrict config files to owner access - #542
Merged
selviarora merged 1 commit intoSep 15, 2026
Merged
Conversation
Assisted-By: devx/736bac94-4b2a-4b19-b5cc-1826ad565f21
donk-shopify
approved these changes
Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Config#setcreates files with mode0644under the usual022umask, allowing other local users to read credentials when the containing directories are traversable. Updates preserve those broad permissions.Create configs with
0600permissions, subject to a stricter umask. When replacing an existing config, retain only its owner read/write bits:0644and0640become0600, while0400stays0400. This also prevents the temporary file from being made group/world-readable before the atomic rename. Symlink targets receive the same protection without replacing the symlink.Existing configs are tightened on their next successful write. Applications intentionally sharing config files through group/other permissions will now lose that access when writing through
Config#set.Validation on Ruby 3.4.3 with locked dependencies:
bundle exec rake test: 143 runs, 664 assertions, 0 failures/errors, 7 existing skips.bundle exec rake style: 62 files, no offenses.bundle exec srb tc: no errors.0644to0600under umask022.Independent of #541, which removes values from config write errors. The two changes merge cleanly.