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

Fix Security issue in media manager #3604

Merged
merged 3 commits into from
Jun 22, 2018
Merged

Fix Security issue in media manager #3604

merged 3 commits into from
Jun 22, 2018

Conversation

Denoder
Copy link
Contributor

@Denoder Denoder commented Jun 22, 2018

Currently there is a way to manipulate folder names using the request headers for the medafinder folder path. Since MediaLibrary::validatePath() does not validate folder names but rather only validates the existence of a folder as a parent directory or subdirectory. Using that manipulation, if the folder does not exist as a parent directory or subdirectory, the folder will be created using the path query.

We can utilize $this->validateFileName() to verify if the name of the folder path name being used for the folder name is valid during the folder creation function and the name applying function for the path query.

Currently there is a way to manipulate folder names using the request headers for the medafinder folder path. since `validatePath` does not validate file names but rather only validates the existence of a folder in a parent/subdirectory. We can utilize `validateFileName` to verify if the name of the folder path being created is valid during the folder creation process and the name applying process.
@Denoder Denoder changed the title Fix Security issue Fix Security issue in media manager Jun 22, 2018
variable renaming so it would make sense
@LukeTowers
Copy link
Contributor

Awesome @teranode! Could you please add some tests for invalid vs valid paths?

@Denoder
Copy link
Contributor Author

Denoder commented Jun 22, 2018

@LukeTowers I have like 0 idea on how to do that :( -> I've never concerned myself with doing unit testing or creating a test file. I just use the issue live and then fix it live. :/

Sorry about that.

@LukeTowers
Copy link
Contributor

@teranode no worries, basically you would add to https://github.com/octobercms/october/blob/master/tests/unit/system/classes/MediaLibraryTest.php to test a valid path to make sure it passes validation and test an invalid path to make sure it fails validation. If you don't want to give it a try let me know and I will take care of it for you

@daftspunk daftspunk merged commit 0eac53b into octobercms:develop Jun 22, 2018
@daftspunk
Copy link
Member

All good, I'll get it. Thanks @teranode

@Denoder
Copy link
Contributor Author

Denoder commented Jun 22, 2018

Ill let u handle that :|

daftspunk added a commit that referenced this pull request Jun 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants