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

Avoid leading .. for temporary files from Filesystem recursive remove #49581

Merged
merged 1 commit into from
Apr 17, 2023

Conversation

giosh94mhz
Copy link
Contributor

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR

Method Filesystem::doRemove is using renaming of parent directory before recursive removal, in order to implement atomic remove.

This is a good thing, but to implement this is generating a random path name, with a modified base64 which replaces base64's = sign with .. This may lead to directory named as path/..8U6/ which freaked out our synchronization tools and security log scanner.

Since the leading . is already (correctly) hard-coded, I see no issue in using _ as a safer alternative.

@alexislefebvre
Copy link
Contributor

This may lead to directory named as path/..8U6/ which freaked out our synchronization tools and security log scanner.

Are these tools right when they consider this path as risky? To my knowledge, there is no risk of accessing the parent directory here.

But this change looks good anyway, someone seeing a path like path/..8U6/ could be confused too.

@giosh94mhz
Copy link
Contributor Author

Are these tools right when they consider this path as risky? To my knowledge, there is no risk of accessing the parent directory here.
But this change looks good anyway, someone seeing a path like path/..8U6/ could be confused too.

Precisely as you say.

The tools aren't right, strictly speaking, but usually when I find /a/path/..like/this, I verify that there are no fishy patterns, like a GET /?request=..like/this.

@nicolas-grekas nicolas-grekas added this to the 5.4 milestone Apr 17, 2023
@nicolas-grekas
Copy link
Member

Thank you @giosh94mhz.

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.

None yet

3 participants