-
Notifications
You must be signed in to change notification settings - Fork 159
validate: add maskedpaths and readonlypaths check #259
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
validate: add maskedpaths and readonlypaths check #259
Conversation
vbatts
left a comment
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.
Is checking for absolute path enough to determine read-only? I wonder if there is a unit test for some of these validations. It would require permission though.
|
This just check config file in bundle if it meets the requirements in runtime SPEC. |
validate/validate.go
Outdated
| } | ||
|
|
||
| for _, maskedPath := range v.spec.Linux.MaskedPaths { | ||
| if !filepath.IsAbs(maskedPath) { |
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.
We should probably factor our explicit-platform filepath analog out into its own package to handle cross-platform validation. See previous discussion in #256.
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.
maskedPath and readonlyPath are Linux-specific, I think we don't need cross-platform validation here.
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.
You might be validating a Linux config on a Windows host. When --host-specific is not set, the validating host shouldn't matter at all.
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.
maskedPath and readonlyPath means to set paths inside Linux-based container to be masked and readonly in container namespace. In my opinion there is nothing to do with Windows host and there is nothing to do with --host-specific
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.
Nothing to do with a Windows runtime host, but you should be able to do host-agnostic validation with oci-runtime-tool validate … regardless of whether the config is for Linux/Solaris/Windows or your validating host is Linux/Solaris/Windows.
Consider the use-case where someone is running a config registry and they want to validate all the configs they host against the spec. Maybe their registry is on a Linux box, or maybe it's on a Windows box, but either way, they should still be able to check for “If this is a Linux config, are all the paths in linux.maskedPath absolute?”.
|
On 10/28/2016 11:46 AM, W. Trevor King wrote:
Part agreed.
Agreed, and that's also the current implement. |
|
On Sun, Oct 30, 2016 at 08:20:37PM -0700, Ma Shimiao wrote:
Agreed, but “I'm validating a Linux container” doesn't mean “I'm
I want to replace path/filepath with a version of filepath that lets if !explicitOSFilepath.IsAbs(v.spec.Platform.OS, maskedPath) and similarly for readonlyPath. explicitOSFilepath is a terrible import ( or some such. And once we'd completed the transition: import ( |
|
On 10/31/2016 12:45 PM, W. Trevor King wrote:
Until here, I do really know what you mean...
I think there is no need to do so complicated thing. |
f86075c to
c8001ea
Compare
|
On Sun, Oct 30, 2016 at 10:36:35PM -0700, Ma Shimiao wrote:
Grepping for ‘filepath.’, I turn up a few more filepath.IsAbs calls |
Signed-off-by: Ma Shimiao <[email protected]>
c8001ea to
6bfa0a0
Compare
|
ping @opencontainers/runtime-tools-maintainers |
|
@Mashimiao LGTM |
|
@liangchenye need you re-LGTM. And just comment |
Signed-off-by: Ma Shimiao [email protected]