Browse code

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>

Mitch Capper authored on 2015/03/16 02:19:15
Showing 3 changed files
... ...
@@ -6,6 +6,6 @@ const (
6 6
 	// identifies if test suite is running on a unix platform
7 7
 	isUnixCli = false
8 8
 
9
-	// this is the expected file permission set on windows: gh#11047
10
-	expectedFileChmod = "-rwx------"
9
+	// this is the expected file permission set on windows: gh#11395
10
+	expectedFileChmod = "-rwxr-xr-x"
11 11
 )
... ...
@@ -28,10 +28,9 @@ func CanonicalTarNameForPath(p string) (string, error) {
28 28
 // chmodTarEntry is used to adjust the file permissions used in tar header based
29 29
 // on the platform the archival is done.
30 30
 func chmodTarEntry(perm os.FileMode) os.FileMode {
31
-	// Clear r/w on grp/others: no precise equivalen of group/others on NTFS.
32
-	perm &= 0711
31
+	perm &= 0755
33 32
 	// Add the x bit: make everything +x from windows
34
-	perm |= 0100
33
+	perm |= 0111
35 34
 
36 35
 	return perm
37 36
 }
... ...
@@ -51,11 +51,11 @@ func TestChmodTarEntry(t *testing.T) {
51 51
 	cases := []struct {
52 52
 		in, expected os.FileMode
53 53
 	}{
54
-		{0000, 0100},
55
-		{0777, 0711},
56
-		{0644, 0700},
57
-		{0755, 0711},
58
-		{0444, 0500},
54
+		{0000, 0111},
55
+		{0777, 0755},
56
+		{0644, 0755},
57
+		{0755, 0755},
58
+		{0444, 0555},
59 59
 	}
60 60
 	for _, v := range cases {
61 61
 		if out := chmodTarEntry(v.in); out != v.expected {