Page MenuHomePhabricator

PHP Notice: Key file permissions are not correct, recommend changing to 600 or 660 instead of 644
Closed, ResolvedPublicSecurity

Description

Error
normalized_message
[{reqId}] {exception_url}   PHP Notice: Key file "file:///tmp/44dfa0e0d4660ebb8f0e791a240f7704510e74f2.key" permissions are not correct, recommend changing to 600 or 660 instead of 644
exception.trace
from /srv/mediawiki/php-1.42.0-wmf.24/vendor/league/oauth2-server/src/CryptKey.php(63)
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.42.0-wmf.24/vendor/league/oauth2-server/src/CryptKey.php(63): trigger_error(string, integer)
#2 /srv/mediawiki/php-1.42.0-wmf.24/vendor/league/oauth2-server/src/ResourceServer.php(50): League\OAuth2\Server\CryptKey->__construct(string)
#3 /srv/mediawiki/php-1.42.0-wmf.24/extensions/OAuth/src/ResourceServer.php(50): League\OAuth2\Server\ResourceServer->__construct(MediaWiki\Extension\OAuth\Repository\AccessTokenRepository, string)
#4 /srv/mediawiki/php-1.42.0-wmf.24/extensions/OAuth/src/ResourceServer.php(39): MediaWiki\Extension\OAuth\ResourceServer->__construct(string, string)
#5 /srv/mediawiki/php-1.42.0-wmf.24/extensions/OAuth/src/SessionProvider.php(107): MediaWiki\Extension\OAuth\ResourceServer::factory()
#6 /srv/mediawiki/php-1.42.0-wmf.24/includes/session/SessionManager.php(539): MediaWiki\Extension\OAuth\SessionProvider->provideSessionInfo(MediaWiki\Request\WebRequest)
#7 /srv/mediawiki/php-1.42.0-wmf.24/includes/session/SessionManager.php(245): MediaWiki\Session\SessionManager->getSessionInfoForRequest(MediaWiki\Request\WebRequest)
#8 /srv/mediawiki/php-1.42.0-wmf.24/includes/Request/WebRequest.php(863): MediaWiki\Session\SessionManager->getSessionForRequest(MediaWiki\Request\WebRequest)
#9 /srv/mediawiki/php-1.42.0-wmf.24/includes/session/SessionManager.php(166): MediaWiki\Request\WebRequest->getSession()
#10 /srv/mediawiki/php-1.42.0-wmf.24/includes/Setup.php(487): MediaWiki\Session\SessionManager::getGlobalSession()
#11 /srv/mediawiki/php-1.42.0-wmf.24/includes/WebStart.php(85): require_once(string)
#12 /srv/mediawiki/php-1.42.0-wmf.24/api.php(37): require(string)
#13 /srv/mediawiki/w/api.php(3): require(string)
#14 {main}
Impact
Notes
  • Making this a sec task out of an abundance of caution

Details

Risk Rating
Medium
Author Affiliation
Wikimedia Communities

Event Timeline

Still happening as of his week, but only 7 of these errors in 90 days.

Fresh stack trace:

Error
labels.normalized_message
[{reqId}] {exception_url}   PHP Notice: Key file "file:///tmp/44dfa0e0d4660ebb8f0e791a240f7704510e74f2.key" permissions are not correct, recommend changing to 600 or 660 instead of 644
error.stack_trace
from /srv/mediawiki/php-1.43.0-wmf.11/vendor/league/oauth2-server/src/CryptKey.php(63)
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.43.0-wmf.11/vendor/league/oauth2-server/src/CryptKey.php(63): trigger_error(string, integer)
#2 /srv/mediawiki/php-1.43.0-wmf.11/vendor/league/oauth2-server/src/ResourceServer.php(50): League\OAuth2\Server\CryptKey->__construct(string)
#3 /srv/mediawiki/php-1.43.0-wmf.11/extensions/OAuth/src/ResourceServer.php(50): League\OAuth2\Server\ResourceServer->__construct(MediaWiki\Extension\OAuth\Repository\AccessTokenRepository, string)
#4 /srv/mediawiki/php-1.43.0-wmf.11/extensions/OAuth/src/ResourceServer.php(39): MediaWiki\Extension\OAuth\ResourceServer->__construct(string, string)
#5 /srv/mediawiki/php-1.43.0-wmf.11/extensions/OAuth/src/SessionProvider.php(107): MediaWiki\Extension\OAuth\ResourceServer::factory()
#6 /srv/mediawiki/php-1.43.0-wmf.11/includes/session/SessionManager.php(542): MediaWiki\Extension\OAuth\SessionProvider->provideSessionInfo(MediaWiki\Request\WebRequest)
#7 /srv/mediawiki/php-1.43.0-wmf.11/includes/session/SessionManager.php(248): MediaWiki\Session\SessionManager->getSessionInfoForRequest(MediaWiki\Request\WebRequest)
#8 /srv/mediawiki/php-1.43.0-wmf.11/includes/Request/WebRequest.php(870): MediaWiki\Session\SessionManager->getSessionForRequest(MediaWiki\Request\WebRequest)
#9 /srv/mediawiki/php-1.43.0-wmf.11/includes/session/SessionManager.php(167): MediaWiki\Request\WebRequest->getSession()
#10 /srv/mediawiki/php-1.43.0-wmf.11/includes/Setup.php(489): MediaWiki\Session\SessionManager::getGlobalSession()
#11 /srv/mediawiki/php-1.43.0-wmf.11/includes/WebStart.php(85): require_once(string)
#12 /srv/mediawiki/php-1.43.0-wmf.11/api.php(37): require(string)
#13 /srv/mediawiki/w/api.php(3): require(string)
#14 {main}

Noting that there is no error about chmod from PHP (which it sounds like is what the library does). Only a failure for permissions after the chmod.

PrivateSettings.php is 664 so security-wise this doesn't really make any difference. In any case the weird workaround of writing in-memory keys to tempfiles is removed in recent versions of oauth2-server so the pending upgrade will resolve this.

matmarex subscribed.

Looks resolved, last error was on 11 February.

I think this task can be made public now. @sbassett (or anyone else with the permissions) Could you do the honors?

In any case the weird workaround of writing in-memory keys to tempfiles is removed in recent versions of oauth2-server so the pending upgrade will resolve this.

This was done in https://gerrit.wikimedia.org/r/c/mediawiki/vendor/+/1229647 and related patches.

I think this task can be made public now. @sbassett (or anyone else with the permissions) Could you do the honors?

This was done in https://gerrit.wikimedia.org/r/c/mediawiki/vendor/+/1229647 and related patches.

Sounds good, thanks.

sbassett triaged this task as Medium priority.Feb 23 2026, 4:14 PM
sbassett changed Author Affiliation from N/A to Wikimedia Communities.
sbassett changed the visibility from "Custom Policy" to "Public (No Login Required)".
sbassett changed the edit policy from "Custom Policy" to "All Users".
sbassett changed Risk Rating from N/A to Medium.