Skip to content

Reject empty path arguments - #771

Merged
smcv merged 1 commit into
containers:mainfrom
AbhinavMir:reject-empty-path-arguments
Aug 29, 2026
Merged

Reject empty path arguments#771
smcv merged 1 commit into
containers:mainfrom
AbhinavMir:reject-empty-path-arguments

Conversation

@AbhinavMir

Copy link
Copy Markdown
Contributor

@smcv smcv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The security fixes in 0.12.0 seem to have mostly addressed this as a side-effect. Is this still necessary?

@smcv smcv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please add a Signed-off-by to your commit(s) to indicate that the Developer Certificate of Origin can be applied to your contribution.

See https://github.com/containers/common/blob/main/CONTRIBUTING.md for details.

(@alexlarsson, @cgwalters: we should probably add a CONTRIBUTING.md to this project too, even if it's just a cross-reference to that one)

Path arguments become real filenames by concatenation onto "/oldroot/"
or "/newroot/", so an empty path turns into the root directory.

`--bind-try "" DEST` therefore gave the sandbox read/write access to the
whole filesystem, and an empty destination replaced the sandbox root in
the same way. The variants without `-try` failed earlier, because
realpath() rejects an empty source, but the other options that take a
path had no check at all.

Check every path argument during option parsing, and report an empty one
as a usage error.

Signed-off-by: abhinavmir <atg271@gmail.com>
@AbhinavMir
AbhinavMir force-pushed the reject-empty-path-arguments branch from 4310388 to 9fb7980 Compare August 26, 2026 18:39
@smcv

smcv commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

(As a general Github thing, please leave a comment after fixing issues and pushing a new version - otherwise maintainers aren't notified that your PR is ready for review again.)

@smcv
smcv merged commit b6c225d into containers:main Aug 29, 2026
4 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