From befff4f2efb2c0274e24e7a7a842091f3b81a541 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 7 Jan 2014 11:32:40 -0800 Subject: [PATCH] SECURITY: Added missing auth check in img_auth.php For $wgImgAuthUrlPathMap in img_auth.php Bug: 57016 Change-Id: I874878322a91bf14091500223d3520861a1556bb --- img_auth.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/img_auth.php b/img_auth.php index 2d2db9a5ed..72a7dab855 100644 --- a/img_auth.php +++ b/img_auth.php @@ -92,12 +92,17 @@ function wfImageAuthMain() { if ( strpos( $path, $prefix ) === 0 ) { $be = FileBackendGroup::singleton()->backendFromPath( $storageDir ); $filename = $storageDir . substr( $path, strlen( $prefix ) ); // strip prefix + // Check basic user authorization + if ( !RequestContext::getMain()->getUser()->isAllowed( 'read' ) ) { + wfForbidden( 'img-auth-accessdenied', 'img-auth-noread', $path ); + return; + } if ( $be->fileExists( array( 'src' => $filename ) ) ) { wfDebugLog( 'img_auth', "Streaming `" . $filename . "`." ); $be->streamFile( array( 'src' => $filename ), array( 'Cache-Control: private', 'Vary: Cookie' ) ); } else { - wfForbidden( 'img-auth-accessdenied', 'img-auth-nofile', $filename ); + wfForbidden( 'img-auth-accessdenied', 'img-auth-nofile', $path ); } return; } -- 2.20.1