-
Notifications
You must be signed in to change notification settings - Fork 248
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
Ignition should fail validation if a file conflicts with the parent directory of another file/link/dir #1457
Comments
Hey @marmijo, could you please provide more context about this? Thank you! 😸 |
Hi Yasmin. Yes, you could use butane to create the ignition config. To reproduce, you'll need the resulting ignition config that has the file/link/dir conflicts specified like the ones above and run it through ignition validation. It currently doesn't fail validation but it should. It should be noted that butane isn't needed to write an ignition config, so ignition validation code is needed here. Basically, it's possible to create an ignition config with two files that conflict with one another in such a way that one file would be an implicit parent directory of the other e.g. |
Note: when we add this verification, we need to try and not reduce functionality. Its completely reasonable to have a file /home/bar/zed and a dir home/bar/zed/ |
AFAIK, Linux disallows dirs/files/links/pipes with the same name in the same directory. It shouldn't be possible to create |
@marmijo Wdyt about simply validating that files end with an extension ? |
@prestist That doesn't really fix it. It's perfectly valid for directories to have "extensions" and files not to. I don't think it'd be too hard to validate this. See e.g. Obviously, this validation can't catch symlinks that only exist on the host (e.g. if |
@jlebon ah, okay that was a wiff on my part, I assumed that directorys would not have extensions, what purpose does that serve for (my own knowledge) ? Thats great, thank you for the pointer to |
The base name is mostly an arbitrary string. Indeed, by convention files tend to have extensions and directories tend not to. An common example of directories with an extension are the systemd dropin dirs (i.e.
That would give duplicate entries which should already fail validation today. |
Bug
Operating System Version
Any
Ignition Version
All
Environment
All
Expected Behavior
Ignition should not allow internally inconsistent configs
Actual Behavior
Users can specify a file that would conflict with the parent directory of another file/link/dir. Ignition should fail validation if files/links/dirs conflict with implicit parent directories.
Reproduction Steps
1 - Write a config with a file at
/foo/bar
and a file/foo/bar/baz
OR
1 - Write a config with a file at
/foo/bar
and a directory at/foo/bar/baz
OR
1 - Write a config with a file at
/foo/bar
and a link at/foo/bar/baz
Other Information
On top of general validation for this issue, the validation added by Ignition PR#1456 may need to be updated to include the fix as well.
The text was updated successfully, but these errors were encountered: