Skip to content

Conversation

@sampsyo
Copy link
Member

@sampsyo sampsyo commented Nov 26, 2021

When constructing paths to image files to serve, we previously spliced strings from URL requests directly into the path to be opened. This is theoretically worrisome because it could allow clients to read other files that they are not supposed to read.

I'm not actually sure this is a real security problem because Flask's URL parsing should probably rule out IDs that have / in them anyway. But out of an abundance of caution, this now prevents paths from showing up in IDs at all—and also prevents . and .. from being valid names.

Closes #4111.

When constructing paths to image files to serve, we previously spliced
strings from URL requests directly into the path to be opened. This is
theoretically worrisome because it could allow clients to read other
files that they are not supposed to read.

I'm not actually sure this is a real security problem because Flask's
URL parsing should probably rule out IDs that have `/` in them anyway.
But out of an abundance of caution, this now prevents paths from showing
up in IDs at all---and also prevents `.` and `..` from being valid
names.
@sampsyo sampsyo merged commit c03e0eb into master Nov 26, 2021
@sampsyo sampsyo mentioned this pull request Nov 28, 2021
@snejus snejus deleted the filter-img-filename branch June 15, 2024 03:43
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

2 participants