ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
ILIAS\Filesystem\Security\Sanitizing\FilenameSanitizer Interface Reference

The filename sanitizer verifies and fixes file name endings. More...

+ Inheritance diagram for ILIAS\Filesystem\Security\Sanitizing\FilenameSanitizer:
+ Collaboration diagram for ILIAS\Filesystem\Security\Sanitizing\FilenameSanitizer:

Public Member Functions

 isClean (string $filename)
 Checks if the filename is prefixed with a valid whitelisted ending. More...
 
 sanitize (string $filename)
 Validates the file ending, with the filesystem whitelist provided by ILIAS. More...
 

Data Fields

const CLEAN_FILE_SUFFIX = 'sec'
 This file suffix will be used to sanitize not whitelisted file names. More...
 

Detailed Description

The filename sanitizer verifies and fixes file name endings.

It will not check the file for invalid character or other potential problems.

Author
Nicolas Schäfli ns@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 29 of file FilenameSanitizer.php.

Member Function Documentation

◆ isClean()

ILIAS\Filesystem\Security\Sanitizing\FilenameSanitizer::isClean ( string  $filename)

Checks if the filename is prefixed with a valid whitelisted ending.

Parameters
string$filenameThe filename which should be checked for a whitelisted ending.
Returns
bool True if the filename ending is whitelisted otherwise false.

Implemented in ILIAS\Filesystem\Security\Sanitizing\FilenameSanitizerImpl.

◆ sanitize()

ILIAS\Filesystem\Security\Sanitizing\FilenameSanitizer::sanitize ( string  $filename)

Validates the file ending, with the filesystem whitelist provided by ILIAS.

If the filename is suffixed with an not listed file ending

Parameters
string$filenameThe filename which should be sanitized.
Returns
string The filename with a valid ending.

Implemented in ILIAS\Filesystem\Security\Sanitizing\FilenameSanitizerImpl.

Field Documentation

◆ CLEAN_FILE_SUFFIX

const ILIAS\Filesystem\Security\Sanitizing\FilenameSanitizer::CLEAN_FILE_SUFFIX = 'sec'

This file suffix will be used to sanitize not whitelisted file names.

Definition at line 34 of file FilenameSanitizer.php.

Referenced by ILIAS\Filesystem\Security\Sanitizing\FilenameSanitizerImpl\__construct(), and ILIAS\Filesystem\Security\Sanitizing\FilenameSanitizerImpl\sanitize().


The documentation for this interface was generated from the following file: