Skip to content

join: loosen cleanliness requirements for SecureJoin root#47

Merged
cyphar merged 1 commit intomainfrom
unclean-root-dotdot
Jan 24, 2025
Merged

join: loosen cleanliness requirements for SecureJoin root#47
cyphar merged 1 commit intomainfrom
unclean-root-dotdot

Conversation

@cyphar
Copy link
Owner

@cyphar cyphar commented Jan 22, 2025

It turns out that some users do provide unclean paths like "foo/bar/"
and as a result the new behaviour in commit bc750ad ("join: return
an error if root is unclean path") was far too aggressive and lead to
regressions.

The more gentle solution is to only error out if the path contains a
".." component (which is the only component type we are really worried
about here because it's the only one that can turn a safe
root-joined-path into an unsafe one due to how symlinks are resolved on
Linux).

Fixes: bc750ad ("join: return an error if root is unclean path")
Fixes #46
Signed-off-by: Aleksa Sarai cyphar@cyphar.com

@cyphar
Copy link
Owner Author

cyphar commented Jan 22, 2025

@kolyshkin WDYT?

Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

Left some notes but LGTM

It turns out that some users do provide unclean paths like "foo/bar/"
and as a result the new behaviour in commit bc750ad ("join: return
an error if root is unclean path") was far too aggressive and lead to
regressions.

The more gentle solution is to only error out if the path contains a
".." component (which is the only component type we are really worried
about here because it's the only one that can turn a safe
root-joined-path into an unsafe one due to how symlinks are resolved on
Linux).

Fixes: bc750ad ("join: return an error if root is unclean path")
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
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.

[regression] hardening against bad root paths in 0.4.0 is too agressive

2 participants