container: make hostconfig.json non-world-readable (0600)#41620
Merged
Conversation
Member
Author
|
rebased to get a fresh run of CI |
57a3f61 to
b2f930e
Compare
When writing container's `hostconfig.json`, permissions were set to 0644 (world- readable). While this is not a security concern (as the `/var/lib/docker/containers` directory has `0700` or `0701` permissions), there is no real need to have these permissions, as this file is only accessed by the daemon. Looking at history for file permissions; - 06b53e3 (first implementation) used `0666` (world-writable) - cf1a6c0 refactored the code, and removed explicit permissions - ea3cbd3 introduced atomic writes, and brought back the `0666` permissions - 3ec8fed removed world-writable bits, but kept world-readable This patch updates the permissions to `0600`, matching what's used for `config.v2.json`, which was updated in ae52cea, but forgot to update `hostconfig.json`. Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
b2f930e to
f4aafed
Compare
Member
Author
AkihiroSuda
approved these changes
Dec 1, 2020
Member
Author
|
ping @tonistiigi @justincormack @cpuguy83 PTAL |
1 similar comment
Member
Author
|
ping @tonistiigi @justincormack @cpuguy83 PTAL |
Member
Author
|
ping @tonistiigi @justincormack @cpuguy83 PTAL 🤗 |
tonistiigi
approved these changes
May 6, 2021
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.
fixes #17310 "644 permissions for config.json and the like security issue" (together with #34419, which updated permissions for
config.v2.jsonWhen writing container's
hostconfig.json, permissions were set to 0644 (world-readable). While this is not a security concern (as the/var/lib/docker/containersdirectory has0700or0701permissions), there is no need to have these permissions, as this file is only accessed by the daemon.Looking at history for file permissions;
0666(world-writable)0666permissionsThis patch updates the permissions to
0600, matching what's used forconfig.v2.json, which was updated in ae52cea, but forgot to updatehostconfig.json.The second commit is some small cleanup/refactoring
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)