Jump to content

Manual:$wgMimeTypeBlacklist

From mediawiki.org
This page is a translated version of the page Manual:$wgMimeTypeBlacklist and the translation is 94% complete.
MIME タイプ: $wgMimeTypeBlacklist
$wgVerifyMimeType が有効な場合の、許可しない MIME タイプ。
導入されたバージョン:1.5.0
除去されたバージョン:1.37.0 (Gerrit change 680806; git #4dae3b1a)
許容される値:(MIME タイプ (文字列) の配列)
既定値:(下記参照)

詳細

$wgVerifyMimeType が有効な場合、これらの MIME タイプのファイルのアップロードを禁止します。

既定値

  • 'application/x-opc+zip'、'application/msword'、'application/vnd.ms-powerpoint'、'application/vnd.msexcel' は、1.17.0 (r81376) で導入され r82783 で除去されました
  • 'application/x-opc+zip'、'text/scriptlet'、'application/x-msdownload' は 1.5.5 以降で導入されました
  • 'application/x-msmetafile' は 1.5.5 で追加されました
  • 'application/zip' は、1.14 で追加され 1.18 で除去されました
  • その他の値は、1.5.0 でこの変数が導入された時点から利用できるようになりました

1.35.12 (gerrit:961936, phab:T341565):

$wgMimeTypeBlacklist = [
	# HTML may contain cookie-stealing JavaScript and web bugs
	'text/html',
	# Similarly with JavaScript itself
	'application/javascript', 'text/javascript', 'text/x-javascript', 'application/x-shellscript',
	# PHP scripts may execute arbitrary code on the server
	'application/x-php', 'text/x-php',
	# Other types that may be interpreted by some servers
	'text/x-python', 'text/x-perl', 'text/x-bash', 'text/x-sh', 'text/x-csh',
	# Client-side hazards on Internet Explorer
	'text/scriptlet', 'application/x-msdownload',
	# Windows metafile, client-side vulnerability on some systems
	'application/x-msmetafile',
	# XML files generally - T341565
	'application/xml', 'text/xml',
];
MediaWiki バージョン:
1.35 – 1.36
$wgMimeTypeBlacklist = [
	# HTML は、Cookie を盗む JavaScript や Web のバグを含む場合がある
	'text/html',
	# Similarly with JavaScript itself
	'application/javascript', 'text/javascript', 'text/x-javascript', 'application/x-shellscript',
	# PHP スクリプトは、サーバー上で任意のコードを実行できてしまう
	'application/x-php', 'text/x-php',
	# 一部のサーバーで解釈できる場合があるその他のファイル形式
	'text/x-python', 'text/x-perl', 'text/x-bash', 'text/x-sh', 'text/x-csh',
	# Internet Explorer 向けのクライアント側の脅威
	'text/scriptlet', 'application/x-msdownload',
	# Windows メタファイル。一部のシステムでクライアント側の脆弱性になる
	'application/x-msmetafile',
];
MediaWiki バージョン:
1.18 – 1.34
$wgMimeTypeBlacklist = [
	# HTML may contain cookie-stealing JavaScript and web bugs
	'text/html', 'text/javascript', 'text/x-javascript', 'application/x-shellscript',
	# PHP scripts may execute arbitrary code on the server
	'application/x-php', 'text/x-php',
	# Other types that may be interpreted by some servers
	'text/x-python', 'text/x-perl', 'text/x-bash', 'text/x-sh', 'text/x-csh',
	# Client-side hazards on Internet Explorer
	'text/scriptlet', 'application/x-msdownload',
	# Windows metafile, client-side vulnerability on some systems
	'application/x-msmetafile',
];
MediaWiki バージョン:
1.17
$wgMimeTypeBlacklist = array(
	# HTML may contain cookie-stealing JavaScript and web bugs
	'text/html', 'text/javascript', 'text/x-javascript',  'application/x-shellscript',
	# PHP scripts may execute arbitrary code on the server
	'application/x-php', 'text/x-php',
	# Other types that may be interpreted by some servers
	'text/x-python', 'text/x-perl', 'text/x-bash', 'text/x-sh', 'text/x-csh',
	# Client-side hazards on Internet Explorer
	'text/scriptlet', 'application/x-msdownload',
	# Windows metafile, client-side vulnerability on some systems
	'application/x-msmetafile',
	# A ZIP file may be a valid Java archive containing an applet which exploits the
	# same-origin policy to steal cookies
	'application/zip',

	# MS Office OpenXML and other Open Package Conventions files are zip files
	# and thus blacklisted just as other zip files. If you remove these entries
	# from the blacklist in your local configuration, a malicious file upload
	# will be able to compromise the wiki's user accounts, and the user 
	# accounts of any other website in the same cookie domain.
	'application/x-opc+zip',
	'application/msword',
	'application/vnd.ms-powerpoint',
	'application/vnd.msexcel',
);
MediaWiki バージョン:
1.14 – 1.16
$wgMimeTypeBlacklist= array(
	# HTML may contain cookie-stealing JavaScript and web bugs
	'text/html', 'text/javascript', 'text/x-javascript',  'application/x-shellscript',
	# PHP scripts may execute arbitrary code on the server
	'application/x-php', 'text/x-php',
	# Other types that may be interpreted by some servers
	'text/x-python', 'text/x-perl', 'text/x-bash', 'text/x-sh', 'text/x-csh',
	# Client-side hazards on Internet Explorer
	'text/scriptlet', 'application/x-msdownload',
	# Windows metafile, client-side vulnerability on some systems
	'application/x-msmetafile',
	# A ZIP file may be a valid Java archive containing an applet which exploits the
	# same-origin policy to steal cookies
	'application/zip',
);
MediaWiki バージョン:
1.12 – 1.13
$wgMimeTypeBlacklist= array(
	# HTML may contain cookie-stealing JavaScript and web bugs
	'text/html', 'text/javascript', 'text/x-javascript',  'application/x-shellscript',
	# PHP scripts may execute arbitrary code on the server
	'application/x-php', 'text/x-php',
	# Other types that may be interpreted by some servers
	'text/x-python', 'text/x-perl', 'text/x-bash', 'text/x-sh', 'text/x-csh',
	# Client-side hazards on Internet Explorer
	'text/scriptlet', 'application/x-msdownload',
	# Windows metafile, client-side vulnerability on some systems
	'application/x-msmetafile'
);
MediaWiki バージョン:
1.5 – 1.11
$wgMimeTypeBlacklist= array(
	# HTML may contain cookie-stealing JavaScript and web bugs
	'text/html', 'text/javascript', 'text/x-javascript',  'application/x-shellscript',
	# PHP scripts may execute arbitrary code on the server
	'application/x-php', 'text/x-php',
	# Other types that may be interpreted by some servers
	'text/x-python', 'text/x-perl', 'text/x-bash', 'text/x-sh', 'text/x-csh',
	# Windows metafile, client-side vulnerability on some systems
	'application/x-msmetafile'
);

Example

If you wanted to allow html files to be uploaded:

$wgFileExtensions[] = 'html';
$wgFileBlacklist = array_diff( $wgFileBlacklist, array ('html') );
$wgMimeTypeBlacklist = array_diff( $wgMimeTypeBlacklist, array ('text/html') );