Skip to content

Commit 9879d29

Browse files
committed
Drupal 7.13
1 parent b1f01b2 commit 9879d29

File tree

12 files changed

+149
-37
lines changed

12 files changed

+149
-37
lines changed

CHANGELOG.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

2-
Drupal 7.13 xxxx-xx-xx (development version)
2+
Drupal 7.13 2012-05-02
33
----------------------
4+
- Fixed security issues (Multiple vulnerabilities), see SA-CORE-2012-002.
45

56
Drupal 7.12, 2012-02-01
67
----------------------

includes/bootstrap.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* The current system version.
1010
*/
11-
define('VERSION', '7.13-dev');
11+
define('VERSION', '7.13');
1212

1313
/**
1414
* Core API compatibility.

includes/file.inc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,7 +1971,9 @@ function file_download() {
19711971
$function = $module . '_file_download';
19721972
$result = $function($uri);
19731973
if ($result == -1) {
1974-
return drupal_access_denied();
1974+
// Throw away the headers received so far.
1975+
$headers = array();
1976+
break;
19751977
}
19761978
if (isset($result) && is_array($result)) {
19771979
$headers = array_merge($headers, $result);
@@ -1980,9 +1982,12 @@ function file_download() {
19801982
if (count($headers)) {
19811983
file_transfer($uri, $headers);
19821984
}
1983-
return drupal_access_denied();
1985+
drupal_access_denied();
19841986
}
1985-
return drupal_not_found();
1987+
else {
1988+
drupal_not_found();
1989+
}
1990+
drupal_exit();
19861991
}
19871992

19881993

modules/filter/filter.module

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ function _filter_url($text, $filter) {
14091409
$tasks['_filter_url_parse_full_links'] = $pattern;
14101410

14111411
// Match e-mail addresses.
1412-
$url_pattern = "[A-Za-z0-9._-]+@(?:$domain)";
1412+
$url_pattern = "[A-Za-z0-9._-]{1,254}@(?:$domain)";
14131413
$pattern = "`($url_pattern)`";
14141414
$tasks['_filter_url_parse_email_links'] = $pattern;
14151415

modules/forum/forum.install

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,3 +442,16 @@ function forum_update_7003() {
442442
/**
443443
* @} End of "addtogroup updates-7.x-extra"
444444
*/
445+
446+
/**
447+
* Update {form_index} so that only published nodes are indexed.
448+
*/
449+
function forum_update_7011() {
450+
$select = db_select('node', 'n')
451+
->fields('n', array('nid'))
452+
->condition('status', 0 );
453+
454+
db_delete('forum_index')
455+
->condition('nid', $select, 'IN')
456+
->execute();
457+
}

modules/forum/forum.module

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -545,32 +545,43 @@ function forum_field_storage_pre_insert($entity_type, $entity, &$skip_fields) {
545545
function forum_field_storage_pre_update($entity_type, $entity, &$skip_fields) {
546546
$first_call = &drupal_static(__FUNCTION__, array());
547547

548-
if ($entity_type == 'node' && $entity->status && _forum_node_check_node_type($entity)) {
549-
// We don't maintain data for old revisions, so clear all previous values
550-
// from the table. Since this hook runs once per field, per object, make
551-
// sure we only wipe values once.
552-
if (!isset($first_call[$entity->nid])) {
553-
$first_call[$entity->nid] = FALSE;
554-
db_delete('forum_index')->condition('nid', $entity->nid)->execute();
555-
}
556-
$query = db_insert('forum_index')->fields(array('nid', 'title', 'tid', 'sticky', 'created', 'comment_count', 'last_comment_timestamp'));
557-
foreach ($entity->taxonomy_forums as $language) {
558-
foreach ($language as $item) {
559-
$query->values(array(
560-
'nid' => $entity->nid,
561-
'title' => $entity->title,
562-
'tid' => $item['tid'],
563-
'sticky' => $entity->sticky,
564-
'created' => $entity->created,
565-
'comment_count' => 0,
566-
'last_comment_timestamp' => $entity->created,
567-
));
548+
if ($entity_type == 'node' && _forum_node_check_node_type($entity)) {
549+
550+
// If the node is published, update the forum index.
551+
if ($entity->status) {
552+
553+
// We don't maintain data for old revisions, so clear all previous values
554+
// from the table. Since this hook runs once per field, per object, make
555+
// sure we only wipe values once.
556+
if (!isset($first_call[$entity->nid])) {
557+
$first_call[$entity->nid] = FALSE;
558+
db_delete('forum_index')->condition('nid', $entity->nid)->execute();
559+
}
560+
$query = db_insert('forum_index')->fields(array('nid', 'title', 'tid', 'sticky', 'created', 'comment_count', 'last_comment_timestamp'));
561+
foreach ($entity->taxonomy_forums as $language) {
562+
foreach ($language as $item) {
563+
$query->values(array(
564+
'nid' => $entity->nid,
565+
'title' => $entity->title,
566+
'tid' => $item['tid'],
567+
'sticky' => $entity->sticky,
568+
'created' => $entity->created,
569+
'comment_count' => 0,
570+
'last_comment_timestamp' => $entity->created,
571+
));
572+
}
568573
}
574+
$query->execute();
575+
// The logic for determining last_comment_count is fairly complex, so
576+
// call _forum_update_forum_index() too.
577+
_forum_update_forum_index($entity->nid);
569578
}
570-
$query->execute();
571-
// The logic for determining last_comment_count is fairly complex, so
572-
// call _forum_update_forum_index() too.
573-
_forum_update_forum_index($entity->nid);
579+
580+
// When a forum node is unpublished, remove it from the forum_index table.
581+
else {
582+
db_delete('forum_index')->condition('nid', $entity->nid)->execute();
583+
}
584+
574585
}
575586
}
576587

modules/forum/forum.test

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,3 +548,65 @@ class ForumTestCase extends DrupalWebTestCase {
548548
}
549549
}
550550
}
551+
552+
/**
553+
* Tests the forum index listing.
554+
*/
555+
class ForumIndexTestCase extends DrupalWebTestCase {
556+
557+
public static function getInfo() {
558+
return array(
559+
'name' => 'Forum index',
560+
'description' => 'Tests the forum index listing.',
561+
'group' => 'Forum',
562+
);
563+
}
564+
565+
function setUp() {
566+
parent::setUp('taxonomy', 'comment', 'forum');
567+
568+
// Create a test user.
569+
$web_user = $this->drupalCreateUser(array('create forum content', 'edit own forum content', 'edit any forum content', 'administer nodes'));
570+
$this->drupalLogin($web_user);
571+
}
572+
573+
/**
574+
* Tests the forum index for published and unpublished nodes.
575+
*/
576+
function testForumIndexStatus() {
577+
578+
$langcode = LANGUAGE_NONE;
579+
580+
// The forum ID to use.
581+
$tid = 1;
582+
583+
// Create a test node.
584+
$title = $this->randomName(20);
585+
$edit = array(
586+
"title" => $title,
587+
"body[$langcode][0][value]" => $this->randomName(200),
588+
);
589+
590+
// Create the forum topic, preselecting the forum ID via a URL parameter.
591+
$this->drupalPost('node/add/forum/' . $tid, $edit, t('Save'));
592+
593+
// Check that the node exists in the database.
594+
$node = $this->drupalGetNodeByTitle($title);
595+
$this->assertTrue(!empty($node), 'New forum node found in database.');
596+
597+
// Verify that the node appears on the index.
598+
$this->drupalGet('forum/' . $tid);
599+
$this->assertText($title, 'Published forum topic appears on index.');
600+
601+
// Unpublish the node.
602+
$edit = array(
603+
'status' => FALSE,
604+
);
605+
$this->drupalPost("node/{$node->nid}/edit", $edit, t('Save'));
606+
$this->assertText(t('Access denied'), 'Unpublished node is no longer accessible.');
607+
608+
// Verify that the node no longer appears on the index.
609+
$this->drupalGet('forum/' . $tid);
610+
$this->assertNoText($title, 'Unpublished forum topic no longer appears on index.');
611+
}
612+
}

modules/image/image.module

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,9 @@ function image_file_download($uri) {
297297
// Send headers describing the image's size, and MIME-type...
298298
'Content-Type' => $info['mime_type'],
299299
'Content-Length' => $info['file_size'],
300-
// ...and allow the file to be cached for two weeks (matching the
301-
// value we/ use for the mod_expires settings in .htaccess) and
302-
// ensure that caching proxies do not share the image with other
303-
// users.
304-
'Expires' => gmdate(DATE_RFC1123, REQUEST_TIME + 1209600),
305-
'Cache-Control' => 'max-age=1209600, private, must-revalidate',
300+
// By not explicitly setting them here, this uses normal Drupal
301+
// Expires, Cache-Control and ETag headers to prevent proxy or
302+
// browser caching of private images.
306303
);
307304
}
308305
}

modules/image/image.test

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,22 @@ class ImageStylesPathAndUrlUnitTest extends DrupalWebTestCase {
209209
$this->assertEqual($this->drupalGetHeader('Content-Type'), $generated_image_info['mime_type'], t('Expected Content-Type was reported.'));
210210
$this->assertEqual($this->drupalGetHeader('Content-Length'), $generated_image_info['file_size'], t('Expected Content-Length was reported.'));
211211
if ($scheme == 'private') {
212+
$this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', t('Expires header was sent.'));
213+
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'no-cache, must-revalidate, post-check=0, pre-check=0', t('Cache-Control header was set to prevent caching.'));
212214
$this->assertEqual($this->drupalGetHeader('X-Image-Owned-By'), 'image_module_test', t('Expected custom header has been added.'));
215+
// Verify access is denied to private image styles.
216+
$this->drupalLogout();
217+
$this->drupalGet($generate_url);
218+
$this->assertResponse(403, t('Confirmed that access is denied for the private image style.') );
219+
// Verify that images are not appended to the response. Currently this test only uses PNG images.
220+
if (strpos($generate_url, '.png') === FALSE ) {
221+
$this->fail( t('Confirming that private image styles are not appended require PNG file.') );
222+
}
223+
else {
224+
// Check for PNG-Signature (cf. http://www.libpng.org/pub/png/book/chapter08.html#png.ch08.div.2) in the
225+
// response body.
226+
$this->assertNoRaw( chr(137) . chr(80) . chr(78) . chr(71) . chr(13) . chr(10) . chr(26) . chr(10), t('No PNG signature found in the response body.') );
227+
}
213228
}
214229
}
215230
}

modules/node/node.admin.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ function node_admin_nodes() {
422422
->fields('n',array('nid'))
423423
->limit(50)
424424
->orderByHeader($header)
425+
->addTag('node_access')
425426
->execute()
426427
->fetchCol();
427428
$nodes = node_load_multiple($nids);

modules/user/user.module

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ function user_user_categories() {
12821282
}
12831283

12841284
function user_login_block($form) {
1285-
$form['#action'] = url($_GET['q'], array('query' => drupal_get_destination()));
1285+
$form['#action'] = url(current_path(), array('query' => drupal_get_destination(), 'external' => FALSE));
12861286
$form['#id'] = 'user-login-form';
12871287
$form['#validate'] = user_login_default_validators();
12881288
$form['#submit'][] = 'user_login_submit';

modules/user/user.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,13 @@ class UserBlocksUnitTests extends DrupalWebTestCase {
14551455
$this->drupalPost('filter/tips', $edit, t('Log in'));
14561456
$this->assertNoText(t('User login'), t('Logged in.'));
14571457
$this->assertPattern('!<title.*?' . t('Compose tips') . '.*?</title>!', t('Still on the same page after login for allowed page'));
1458+
1459+
// Check that the user login block is not vulnerable to information
1460+
// disclosure to third party sites.
1461+
$this->drupalLogout();
1462+
$this->drupalPost('http://example.com/', $edit, t('Log in'), array('external' => FALSE));
1463+
// Check that we remain on the site after login.
1464+
$this->assertEqual(url('user/' . $user->uid, array('absolute' => TRUE)), $this->getUrl(), t('Redirected to user profile page after login from the frontpage'));
14581465
}
14591466

14601467
/**

0 commit comments

Comments
 (0)