1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Change windows default permissions to 755 not 711, read access for all poses little security risk and prevents breaking existing Dockerfiles

Signed-off-by: Mitch Capper <mitch.capper@gmail.com>
This commit is contained in:
Mitch Capper 2015-03-15 10:19:15 -07:00
parent 7974481162
commit b7dc9040f0
3 changed files with 9 additions and 10 deletions

View file

@ -6,6 +6,6 @@ const (
// identifies if test suite is running on a unix platform // identifies if test suite is running on a unix platform
isUnixCli = false isUnixCli = false
// this is the expected file permission set on windows: gh#11047 // this is the expected file permission set on windows: gh#11395
expectedFileChmod = "-rwx------" expectedFileChmod = "-rwxr-xr-x"
) )

View file

@ -28,10 +28,9 @@ func CanonicalTarNameForPath(p string) (string, error) {
// chmodTarEntry is used to adjust the file permissions used in tar header based // chmodTarEntry is used to adjust the file permissions used in tar header based
// on the platform the archival is done. // on the platform the archival is done.
func chmodTarEntry(perm os.FileMode) os.FileMode { func chmodTarEntry(perm os.FileMode) os.FileMode {
// Clear r/w on grp/others: no precise equivalen of group/others on NTFS. perm &= 0755
perm &= 0711
// Add the x bit: make everything +x from windows // Add the x bit: make everything +x from windows
perm |= 0100 perm |= 0111
return perm return perm
} }

View file

@ -51,11 +51,11 @@ func TestChmodTarEntry(t *testing.T) {
cases := []struct { cases := []struct {
in, expected os.FileMode in, expected os.FileMode
}{ }{
{0000, 0100}, {0000, 0111},
{0777, 0711}, {0777, 0755},
{0644, 0700}, {0644, 0755},
{0755, 0711}, {0755, 0755},
{0444, 0500}, {0444, 0555},
} }
for _, v := range cases { for _, v := range cases {
if out := chmodTarEntry(v.in); out != v.expected { if out := chmodTarEntry(v.in); out != v.expected {