Steps to reproduce:
1. Create new forum topic, and mark it as "Published".
2. Edit this forum topic and unpublish it by unchecking the "Published" checkbox.
3. Click save button.
The node is still listed in the topic list, but protected from access.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

StevenPatz’s picture

Priority: Critical » Normal
penyaskito’s picture

The node must be removed from forum_index once it is marked as unpublished.

penyaskito’s picture

Status: Active » Needs review
FileSize
765 bytes

The check for node->status is unnecessary because the index must be updated, and it is checked later for the other operations, please review the attached patch.

penyaskito’s picture

Issue tags: +Needs backport to D7

The bug is in D7 too.

penyaskito’s picture

Patch backported to d7.

skottler’s picture

Status: Needs review » Reviewed & tested by the community

This cleanly applies to both D7 and D8. Looks good to me, marking RTBC.

pillarsdotnet’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests
penyaskito’s picture

Assigned: Unassigned » penyaskito

Ok, let's try to make some tests.

penyaskito’s picture

Patch attached.

penyaskito’s picture

Assigned: penyaskito » Unassigned
Status: Needs work » Needs review

The same patch applies too to 7.x

pillarsdotnet’s picture

A nifty trick in such cases is to post two patches, one with tests only, and one with tests plus the fix.

In this way you can demonstrate (via the red/green color combination) that your tests fail before the fix, and pass afterwards.

penyaskito’s picture

penyaskito’s picture

Assigned: Unassigned » penyaskito
Status: Needs review » Needs work

Something must be wrong if the second one passes...

penyaskito’s picture

Another patch with a test that looks better. Let's see what the testbot thinks.

penyaskito’s picture

Status: Needs review » Needs work
FileSize
2.94 KB

Edited --DUPLICATED--

penyaskito’s picture

Status: Needs work » Needs review
FileSize
2.94 KB

Patch that includes the fix for the issue.

penyaskito’s picture

Assigned: penyaskito » Unassigned
Status: Needs work » Needs review

For me is RTBC, unassigning me so it gets reviewed.

penyaskito’s picture

Assigned: Unassigned » penyaskito
Status: Needs review » Needs work
FileSize
738 bytes

As suggested by chx, added an update path for 7.x sites in 7.x branch.

This needs testing, but depends on #1182296: Add tests for 7.0->7.x upgrade path (random test failures) AFAIU.

penyaskito’s picture

Assigned: penyaskito » Unassigned

Unassign me, waiting for comments.

pillarsdotnet’s picture

Status: Needs work » Needs review
larowlan’s picture

Status: Needs review » Needs work
Issue tags: +Novice

Needs refill post /core patch

realityloop’s picture

Status: Needs work » Needs review
FileSize
2.98 KB

#18 doesn't really aply to D8.x

#16 rerolled for /core

penyaskito’s picture

Status: Needs review » Needs work
Issue tags: -Needs tests, -Novice, -Needs backport to D7

The last submitted patch, forum-topic-unpublished-1302404-22.patch, failed testing.

langelhc’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
Issue tags: +Needs tests, +Novice, +Needs backport to D7

The last submitted patch, forum-topic-unpublished-1302404-22.patch, failed testing.

edutrul’s picture

We have tested the patch #23 and it keeps failing.

@heilop @edusempai

oriol_e9g’s picture

I have tested this and I can't reproduce this bug in D8-HEAD or D7-dev.

Unpublished forum topics don't appear in the topic list and don't appear in the block list.

More steps to reproduce the bug?

oriol_e9g’s picture

Status: Needs work » Active
Issue tags: -Needs tests, -Novice, -Needs backport to D7

Untaging

penyaskito’s picture

@oriol_e9g I reproduced the bug with the given instructions. The problem happens when you unpublish an existing and published post. I'll try to edit the summary to be more explicit.

penyaskito’s picture

Ok, I was testing the wrong thing: I was testing about the topics count displayed, and that was correct.

I added now another asserts for testing if the topic is or not listed.

The code approach has changed too.

Let's see if the build bot gives some love back.

penyaskito’s picture

Assigned: Unassigned » penyaskito
Status: Needs review » Needs work

Per @aspilicious review on IRC:

* one comment exceeds 80 chars and the summary line should be less or equal than 80 chars

penyaskito’s picture

Fixed those issues, improved wording and Doxygen comments.
Merged two last lines of aux function.

penyaskito’s picture

Assigned: penyaskito » Unassigned
Status: Needs work » Needs review

Bot!

aspilicious’s picture

Code looks ok to me, will leave this to others to see if they can identify possible problems with the approach.

Status: Needs review » Needs work
oriol_e9g’s picture

Status: Needs work » Needs review
FileSize
4.59 KB

The code looks good, same patch but with t() removal in assertions for #500866: [META] remove t() from assert message

oriol_e9g’s picture

I have tested the code and for my is RTBC.

penyaskito’s picture

Priority: Normal » Critical

This has been considered a vulnerability in D7 and fixed in http://drupal.org/node/1557938, so I think that is not bad increasing priority.

Advisory ID: DRUPAL-SA-CORE-2012-002
Access bypass - forum listing
CVE: CVE-2012-1590

webchick’s picture

Title: Unpublished topics are listed in topic list » D8 followup DRUPAL-SA-CORE-2012-002 - Access bypass - forum listing
Issue tags: +Security improvements
FileSize
5.73 KB

This was fixed in D7 as part of SA-CORE-2012-002. However, we still need the fix in D8.

Here's the patch from the security team issue tracker (which also needs the small typo fix in #1558402: D8 followup DRUPAL-SA-CORE-2012-002 - Access bypass - forum listing).

Commit credit should include mlhess, coltrane, xjm, and jhodgdon, as well as penyaskito.

I have not yet looked to see how different the committed D7 patch is from the one in this issue.

xjm’s picture

Assigned: Unassigned » xjm

I'll roll this one. The patches were pretty much the same.

xjm’s picture

Assigned: xjm » Unassigned
FileSize
5.22 KB
chx’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
1.25 KB

I have attached the output of git diff -b over the module to make the change super easy to see.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Thanks folks. Committed/pushed this one to 8.x.

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.