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

Fix netns directory permissions #1169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

disconnect3d
Copy link

@disconnect3d disconnect3d commented Jun 9, 2020

Changed created netns directory permissions from 644 (-w----r--) to 0644 (rw-r--r--) when calling MkdirAll(...).

PoC:

dc@jhtc:~/gogo/makedir$ cat main.go
package main

import "os"

func main() {
    os.MkdirAll("644", 644)
    os.MkdirAll("0644", 0644)
}
dc@jhtc:~/gogo/makedir$ go run main.go
ls dc@jhtc:~/gogo/makedir$ ls -la
total 20
drwxrwxr-x 4 dc dc 4096 Jun  9 17:10 .
drwxrwxr-x 5 dc dc 4096 Jun  9 17:10 ..
drw-r--r-- 2 dc dc 4096 Jun  9 17:10 0644
d-w----r-- 2 dc dc 4096 Jun  9 17:10 644
-rw-rw-r-- 1 dc dc  101 Jun  9 17:05 main.go

Note: I found this issue via static analysis. I am not involved in this project and I don't have time to add tests etc.

PS: Can you accept this commit being not signed off? ;)

Changed created netns directory permissions from 644 (-w----r--) to 0644 (rw-r--r--) when calling `MkdirAll(...)`.

PoC:
```
dc@jhtc:~/gogo$ cat makedir.go
package main

import "os"

func main() {
    os.MkdirAll("644", 644)
    os.MkdirAll("0644", 0644)
}
dc@jhtc:~/gogo$ go run main.go
dc@jhtc:~/gogo$ ls -la *644
-rw-r--r-- 1 dc dc 7 Jun  9 17:05 0644
--w----r-- 1 dc dc 7 Jun  9 17:05 644
```
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.

1 participant