是的,是的。看见Ticket #16778 wordpress is leaking user/blog information during wp_version_check(). 所有详细信息都在/wp-includes/update.php
:
if ( is_multisite( ) ) {
$user_count = get_user_count( );
$num_blogs = get_blog_count( );
$wp_install = network_site_url( );
$multisite_enabled = 1;
} else {
$user_count = count_users( );
$user_count = $user_count[\'total_users\'];
$multisite_enabled = 0;
$num_blogs = 1;
$wp_install = home_url( \'/\' );
}
$query = array(
\'version\' => $wp_version,
\'php\' => $php_version,
\'locale\' => $locale,
\'mysql\' => $mysql_version,
\'local_package\' => isset( $wp_local_package ) ? $wp_local_package : \'\',
\'blogs\' => $num_blogs,
\'users\' => $user_count,
\'multisite_enabled\' => $multisite_enabled
);
$url = \'http://api.wordpress.org/core/version-check/1.6/?\' . http_build_query( $query, null, \'&\' );
$options = array(
\'timeout\' => ( ( defined(\'DOING_CRON\') && DOING_CRON ) ? 30 : 3 ),
\'user-agent\' => \'WordPress/\' . $wp_version . \'; \' . home_url( \'/\' ),
\'headers\' => array(
\'wp_install\' => $wp_install,
\'wp_blog\' => home_url( \'/\' )
)
);
$response = wp_remote_get($url, $options);
用户代理包含安装的URL,因此所有这些数据不再是匿名的。获取一些隐私返回过滤器
\'http_request_args\'
并更改您不想泄漏的数据。
下面是一个匿名化UA字符串的简单示例(来自recent blog article):
add_filter( \'http_request_args\', \'t5_anonymize_ua_string\' );
/**
* Replace the UA string.
*
* @param array $args Request arguments
* @return array
*/
function t5_anonymize_ua_string( $args )
{
global $wp_version;
$args[\'user-agent\'] = \'WordPress/\' . $wp_version;
// catch data set by wp_version_check()
if ( isset ( $args[\'headers\'][\'wp_install\'] ) )
{
$args[\'headers\'][\'wp_install\'] = \'http://example.com\';
$args[\'headers\'][\'wp_blog\'] = \'http://example.com\';
}
return $args;
}
您可以将其更改为…
add_filter( \'http_request_args\', \'t5_anonymize_ua_string\', 10, 2 );
…并获取请求URL作为回调的第二个参数。现在可以检查URL是否包含
http://api.wordpress.org/core/version-check/
然后根据需要更改所有值,取消请求并发送新的请求。仍然没有办法只更改URL,这就是为什么我在票证中创建了补丁。