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

mkcomposefs: Add a hidden CFS_PARSE_STRICT #340

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

cgwalters
Copy link
Contributor

Right now in some cases we have "loose" semantics; a simple case I noticed earlier is we accepted whatever input size for a symlink but ignored it.

I also noticed we accepted (and ignored) a nonzero rdev for a non-device.

We have prior cases around missing trailing newline, etc.

In preparation for a more official "mkcomposefs --strict" mode, add a hidden environment variable and use it to validate some of the above.

There's other bits missing though - for example in strict mode I'd like to hard require that the xattrs are already in canonical form (sorted, no duplicates).

This touches on a general topic that there's "strict" and then something even stronger around "normal form" where we disallow any ambiguous input such as duplicate // in filenames etc.

That'd be a good bit more work. For now let's just lay the groundwork for stricter validation.

Right now in some cases we have "loose" semantics; a
simple case I noticed earlier is we accepted whatever
input size for a symlink but ignored it.

I also noticed we accepted (and ignored) a nonzero rdev
for a non-device.

We have prior cases around missing trailing newline, etc.

In preparation for a more official "mkcomposefs --strict"
mode, add a hidden environment variable and use it to validate
some of the above.

There's other bits missing though - for example in strict
mode I'd like to hard require that the xattrs are already
in canonical form (sorted, no duplicates).

This touches on a general topic that there's "strict" and
then something even stronger around "normal form" where
we disallow any ambiguous input such as duplicate `//` in
filenames etc.

That'd be a good bit more work. For now let's just
lay the groundwork for stricter validation.

Signed-off-by: Colin Walters <[email protected]>
Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it make sense to always have these checks instead of a "strict" mode?

Either way, I am fine with it, LGTM

@cgwalters
Copy link
Contributor Author

would it make sense to always have these checks instead of a "strict" mode?

The thing that has me hesitant is we know (from PRs and issues here) that there are a set of composefs users who are working today, and I want to avoid breaking them.

See e.g. #327 (comment) where John (correctly) argued to accept the no-newline case - which I explicitly switched back to denying in strict mode here.

We can ask composefs users to try out "strict mode" in the future and maybe then consider turning it on by default...or probably before that, just emitting warnings in non-strict mode if we find strict mode violations, etc.

@cgwalters cgwalters merged commit 4a3c1c9 into containers:main Sep 12, 2024
13 checks passed
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.

2 participants