MediaWiki master
MediaWiki\Upload\SvgCssChecker Class Reference

Ensure SVG files cannot load external resources via URLs in CSS. More...

Public Member Functions

 checkPresentationalAttribute ( $value)
 Entry point to check presentational attributes like fill.
 checkStyleAttribute (string $value)
 Entry point to check style="..." attributes.
 checkStyleTag ( $value)
 Entry point to check <style> tags.

Detailed Description

Ensure SVG files cannot load external resources via URLs in CSS.

Beyond that restriction, it aims to be relaxed in the CSS it allows.

data: URLs are also banned except in @font-face. The rationale behind this is unclear. The restriction was copied over from the predecessor to this class.

Access: internal
Helper for UploadVerification

Definition at line 20 of file SvgCssChecker.php.

Member Function Documentation

◆ checkPresentationalAttribute()

MediaWiki\Upload\SvgCssChecker::checkPresentationalAttribute ( $value)

Entry point to check presentational attributes like fill.

Presentational attributes can contain CSS like values such as url()

Parameters
string$value
Returns
array|bool True if good or array containing error details

Definition at line 84 of file SvgCssChecker.php.

◆ checkStyleAttribute()

MediaWiki\Upload\SvgCssChecker::checkStyleAttribute ( string $value)

Entry point to check style="..." attributes.

Parameters
string$value
Returns
array|bool True if good or array containing error details

Definition at line 48 of file SvgCssChecker.php.

◆ checkStyleTag()

MediaWiki\Upload\SvgCssChecker::checkStyleTag ( $value)

Entry point to check <style> tags.

Note that data URLs are allowed in @font-face

Parameters
string$value
Returns
array|bool True if good or array containing error details

Definition at line 110 of file SvgCssChecker.php.


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