-
Notifications
You must be signed in to change notification settings - Fork 34
[main] custom host path support #792
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
base: main
Are you sure you want to change the base?
Conversation
also set privileged false for the pod
9243030
to
236e18c
Compare
if path == "/" { | ||
return fmt.Errorf("root path '/' is not allowed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite sure we support running it on Windows nodes, either way this looks a bit more future proof:
if path == "/" { | |
return fmt.Errorf("root path '/' is not allowed") | |
if path == "/" || path == "\" { | |
return fmt.Errorf("root path is not allowed") |
hostPathSet := make(map[string]bool) | ||
|
||
for _, path := range hostPaths { | ||
if !filepath.IsAbs(path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only checks whether the path is rooted, and therefore would return true
for /abc/.../bin
. We must call filepath.Clean(path)
to ensure that becomes /bin
before we do all the checks we are doing here.
if !filepath.IsAbs(path) { | |
path = filepath.Clean(path) | |
if !filepath.IsAbs(path) { |
} | ||
|
||
for _, protected := range protectedDirs { | ||
if path == protected || strings.HasPrefix(path, protected+"/") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will probably not work very well if executed in Windows. Perhaps string(filepath.Separator)
could be used instead. Either way, it would be good to have unit tests showing all the inputs and outputs we have considered.
if path == protected || strings.HasPrefix(path, protected+"/") { | |
if path == protected || strings.HasPrefix(path, protected+"/") { |
No description provided.