ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
|
Public Member Functions | |
__construct () | |
setXMLOptions ($xmlOptions) | |
Set XML options to use when saving XML See: DOMDocument::saveXML. More... | |
getXMLOptions () | |
Get XML options to use when saving XML See: DOMDocument::saveXML. More... | |
getAllowedTags () | |
Get the array of allowed tags. More... | |
setAllowedTags (TagInterface $allowedTags) | |
Set custom allowed tags. More... | |
getAllowedAttrs () | |
Get the array of allowed attributes. More... | |
setAllowedAttrs (AttributeInterface $allowedAttrs) | |
Set custom allowed attributes. More... | |
removeRemoteReferences ($removeRemoteRefs=false) | |
Should we remove references to remote files? More... | |
getXmlIssues () | |
Get XML issues. More... | |
sanitize ($dirty) | |
Sanitize the passed string. More... | |
minify ($shouldMinify=false) | |
Should we minify the output? More... | |
removeXMLTag ($removeXMLTag=false) | |
Should we remove the XML tag in the header? More... | |
useThreshold ($useThreshold=1000) | |
Whether `<use ... More... | |
setUseNestingLimit ($limit) | |
Set the nesting limit for <use> tags. More... | |
Protected Member Functions | |
resetInternal () | |
Set up the DOMDocument. More... | |
setUpBefore () | |
Set up libXML before we start. More... | |
resetAfter () | |
Reset the class after use. More... | |
removeDoctype () | |
Remove the XML Doctype It may be caught later on output but that seems to be buggy, so we need to make sure it's gone. More... | |
cleanAttributesOnWhitelist (\DOMElement $element) | |
Only allow attributes that are on the whitelist. More... | |
cleanXlinkHrefs (\DOMElement $element) | |
Clean the xlink:hrefs of script and data embeds. More... | |
cleanHrefs (\DOMElement $element) | |
Clean the hrefs of script and data embeds. More... | |
isHrefSafeValue ($value) | |
Only allow whitelisted starts to be within the href. More... | |
removeNonPrintableCharacters ($value) | |
Removes non-printable ASCII characters from string & trims it. More... | |
hasRemoteReference ($value) | |
Does this attribute value have a remote reference? More... | |
isAriaAttribute ($attributeName) | |
Check to see if an attribute is an aria attribute or not. More... | |
isDataAttribute ($attributeName) | |
Check to see if an attribute is an data attribute or not. More... | |
isUseTagDirty (\DOMElement $element) | |
Make sure our use tag is only referencing internal resources. More... | |
isUseTagExceedingThreshold (\DOMElement $element) | |
Determines whether `<use ... More... | |
Protected Attributes | |
$xmlDocument | |
$allowedTags | |
$allowedAttrs | |
$xmlLoaderValue | |
$minifyXML = false | |
$removeRemoteReferences = false | |
$useThreshold = 1000 | |
$removeXMLTag = false | |
$xmlOptions = LIBXML_NOEMPTYTAG | |
$xmlIssues = array() | |
$elementReferenceResolver | |
$useNestingLimit = 15 | |
Definition at line 18 of file Sanitizer.php.
enshrined\svgSanitize\Sanitizer::__construct | ( | ) |
Definition at line 84 of file Sanitizer.php.
References enshrined\svgSanitize\data\AllowedAttributes\getAttributes(), and enshrined\svgSanitize\data\AllowedTags\getTags().
|
protected |
Only allow attributes that are on the whitelist.
\DOMElement | $element |
This is used for when a namespace isn't imported properly. Such as xlink:href when the xlink namespace isn't imported. We have to do this as the link is still ran in this case.
Definition at line 347 of file Sanitizer.php.
References $x, array, enshrined\svgSanitize\Sanitizer\hasRemoteReference(), enshrined\svgSanitize\Sanitizer\isAriaAttribute(), enshrined\svgSanitize\Sanitizer\isDataAttribute(), enshrined\svgSanitize\Sanitizer\isHrefSafeValue(), and enshrined\svgSanitize\Sanitizer\removeRemoteReferences().
Referenced by enshrined\svgSanitize\Sanitizer\removeDoctype().
|
protected |
Clean the hrefs of script and data embeds.
\DOMElement | $element |
Definition at line 415 of file Sanitizer.php.
References array, and enshrined\svgSanitize\Sanitizer\isHrefSafeValue().
Referenced by enshrined\svgSanitize\Sanitizer\removeDoctype().
|
protected |
Clean the xlink:hrefs of script and data embeds.
\DOMElement | $element |
Definition at line 398 of file Sanitizer.php.
References array, and enshrined\svgSanitize\Sanitizer\isHrefSafeValue().
Referenced by enshrined\svgSanitize\Sanitizer\removeDoctype().
enshrined\svgSanitize\Sanitizer::getAllowedAttrs | ( | ) |
Get the array of allowed attributes.
Definition at line 149 of file Sanitizer.php.
References enshrined\svgSanitize\Sanitizer\$allowedAttrs.
enshrined\svgSanitize\Sanitizer::getAllowedTags | ( | ) |
Get the array of allowed tags.
Definition at line 129 of file Sanitizer.php.
References enshrined\svgSanitize\Sanitizer\$allowedTags.
enshrined\svgSanitize\Sanitizer::getXmlIssues | ( | ) |
Get XML issues.
Definition at line 179 of file Sanitizer.php.
References enshrined\svgSanitize\Sanitizer\$xmlIssues.
enshrined\svgSanitize\Sanitizer::getXMLOptions | ( | ) |
Get XML options to use when saving XML See: DOMDocument::saveXML.
Definition at line 119 of file Sanitizer.php.
References enshrined\svgSanitize\Sanitizer\$xmlOptions.
|
protected |
Does this attribute value have a remote reference?
$value |
Definition at line 500 of file Sanitizer.php.
References enshrined\svgSanitize\Sanitizer\removeNonPrintableCharacters().
Referenced by enshrined\svgSanitize\Sanitizer\cleanAttributesOnWhitelist().
|
protected |
Check to see if an attribute is an aria attribute or not.
$attributeName |
Definition at line 552 of file Sanitizer.php.
Referenced by enshrined\svgSanitize\Sanitizer\cleanAttributesOnWhitelist().
|
protected |
Check to see if an attribute is an data attribute or not.
$attributeName |
Definition at line 564 of file Sanitizer.php.
Referenced by enshrined\svgSanitize\Sanitizer\cleanAttributesOnWhitelist().
|
protected |
Only allow whitelisted starts to be within the href.
This will stop scripts etc from being passed through, with or without attempting to hide bypasses. This stops the need for us to use a complicated script regex.
$value |
Definition at line 436 of file Sanitizer.php.
References array.
Referenced by enshrined\svgSanitize\Sanitizer\cleanAttributesOnWhitelist(), enshrined\svgSanitize\Sanitizer\cleanHrefs(), and enshrined\svgSanitize\Sanitizer\cleanXlinkHrefs().
|
protected |
Make sure our use tag is only referencing internal resources.
\DOMElement | $element |
Definition at line 575 of file Sanitizer.php.
Referenced by enshrined\svgSanitize\Sanitizer\removeDoctype().
|
protected |
Determines whether `<use ...
xlink:href="#identifier">` is expanded recursively in order to create DoS scenarios. The amount of a actually used element needs to be below $this->useThreshold
.
\DOMElement | $element |
Definition at line 589 of file Sanitizer.php.
Referenced by enshrined\svgSanitize\Sanitizer\removeDoctype().
enshrined\svgSanitize\Sanitizer::minify | ( | $shouldMinify = false | ) |
Should we minify the output?
bool | $shouldMinify |
Definition at line 519 of file Sanitizer.php.
|
protected |
Remove the XML Doctype It may be caught later on output but that seems to be buggy, so we need to make sure it's gone.
Definition at line 271 of file Sanitizer.php.
References $i, array, enshrined\svgSanitize\Sanitizer\cleanAttributesOnWhitelist(), enshrined\svgSanitize\Sanitizer\cleanHrefs(), enshrined\svgSanitize\Sanitizer\cleanXlinkHrefs(), enshrined\svgSanitize\Sanitizer\isUseTagDirty(), and enshrined\svgSanitize\Sanitizer\isUseTagExceedingThreshold().
Referenced by enshrined\svgSanitize\Sanitizer\sanitize().
|
protected |
Removes non-printable ASCII characters from string & trims it.
string | $value |
Definition at line 489 of file Sanitizer.php.
Referenced by enshrined\svgSanitize\Sanitizer\hasRemoteReference().
enshrined\svgSanitize\Sanitizer::removeRemoteReferences | ( | $removeRemoteRefs = false | ) |
Should we remove references to remote files?
bool | $removeRemoteRefs |
Definition at line 169 of file Sanitizer.php.
Referenced by enshrined\svgSanitize\Sanitizer\cleanAttributesOnWhitelist().
enshrined\svgSanitize\Sanitizer::removeXMLTag | ( | $removeXMLTag = false | ) |
Should we remove the XML tag in the header?
bool | $removeXMLTag |
Definition at line 529 of file Sanitizer.php.
Referenced by enshrined\svgSanitize\Sanitizer\sanitize().
|
protected |
Reset the class after use.
Definition at line 261 of file Sanitizer.php.
Referenced by enshrined\svgSanitize\Sanitizer\sanitize().
|
protected |
Set up the DOMDocument.
Definition at line 94 of file Sanitizer.php.
References enshrined\svgSanitize\Sanitizer\$minifyXML.
Referenced by enshrined\svgSanitize\Sanitizer\sanitize().
enshrined\svgSanitize\Sanitizer::sanitize | ( | $dirty | ) |
Sanitize the passed string.
string | $dirty |
Definition at line 190 of file Sanitizer.php.
References enshrined\svgSanitize\Sanitizer\removeDoctype(), enshrined\svgSanitize\Sanitizer\removeXMLTag(), enshrined\svgSanitize\Sanitizer\resetAfter(), enshrined\svgSanitize\Sanitizer\resetInternal(), and enshrined\svgSanitize\Sanitizer\setUpBefore().
enshrined\svgSanitize\Sanitizer::setAllowedAttrs | ( | AttributeInterface | $allowedAttrs | ) |
Set custom allowed attributes.
AttributeInterface | $allowedAttrs |
Definition at line 159 of file Sanitizer.php.
enshrined\svgSanitize\Sanitizer::setAllowedTags | ( | TagInterface | $allowedTags | ) |
Set custom allowed tags.
TagInterface | $allowedTags |
Definition at line 139 of file Sanitizer.php.
|
protected |
Set up libXML before we start.
Definition at line 246 of file Sanitizer.php.
References array.
Referenced by enshrined\svgSanitize\Sanitizer\sanitize().
enshrined\svgSanitize\Sanitizer::setUseNestingLimit | ( | $limit | ) |
Set the nesting limit for <use> tags.
$limit |
Definition at line 613 of file Sanitizer.php.
enshrined\svgSanitize\Sanitizer::setXMLOptions | ( | $xmlOptions | ) |
Set XML options to use when saving XML See: DOMDocument::saveXML.
int | $xmlOptions |
Definition at line 108 of file Sanitizer.php.
References enshrined\svgSanitize\Sanitizer\$xmlOptions.
enshrined\svgSanitize\Sanitizer::useThreshold | ( | $useThreshold = 1000 | ) |
Whether `<use ...
xlink:href="#identifier">` elements shall be removed in case expansion would exceed this threshold.
int | $useThreshold |
Definition at line 540 of file Sanitizer.php.
|
protected |
Definition at line 34 of file Sanitizer.php.
Referenced by enshrined\svgSanitize\Sanitizer\getAllowedAttrs().
|
protected |
Definition at line 29 of file Sanitizer.php.
Referenced by enshrined\svgSanitize\Sanitizer\getAllowedTags().
|
protected |
Definition at line 74 of file Sanitizer.php.
|
protected |
Definition at line 44 of file Sanitizer.php.
Referenced by enshrined\svgSanitize\Sanitizer\resetInternal().
|
protected |
Definition at line 49 of file Sanitizer.php.
|
protected |
Definition at line 59 of file Sanitizer.php.
|
protected |
Definition at line 79 of file Sanitizer.php.
|
protected |
Definition at line 54 of file Sanitizer.php.
|
protected |
Definition at line 24 of file Sanitizer.php.
|
protected |
Definition at line 69 of file Sanitizer.php.
Referenced by enshrined\svgSanitize\Sanitizer\getXmlIssues().
|
protected |
Definition at line 39 of file Sanitizer.php.
|
protected |
Definition at line 64 of file Sanitizer.php.
Referenced by enshrined\svgSanitize\Sanitizer\getXMLOptions(), and enshrined\svgSanitize\Sanitizer\setXMLOptions().