Skip to content

aura: Sanitize filenames in image IDs - #4160

Merged
sampsyo merged 2 commits into
masterfrom
filter-img-filename
Nov 26, 2021
Merged

aura: Sanitize filenames in image IDs#4160
sampsyo merged 2 commits into
masterfrom
filter-img-filename

Conversation

@sampsyo

@sampsyo sampsyo commented Nov 26, 2021

Copy link
Copy Markdown
Member

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
@snejus snejus added the aura aura plugin label Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aura aura plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

None

2 participants