[RFE] s9y core: Do not leak titles of non-public posts
Posted: Sun Jul 20, 2008 7:51 pm
When blog entries are marked private or members only (for example with the "Hide/delete entries for non-registered users after a specific timespan"-plugin) the entry body will be hidden or replaced with a 'No entries to print'-message. However the s9y core (currently v1.3.1) will happily leak the title of a non-public entry if one visits its permalink.
In index.php the html-title is set for existing entries, for non-existing entries a 404-header gets generated. However this does not seem to be the right place to check for the public/private setting on entries.
In /include/genpage.inc.php after the following code can be inserted to stop titles from leaking, and generate a 404-header instead:
Note: This code has only been tested in my current setup.
genpage.inc.php may also not be the best place to do this. The _fetchentry-function in /include/functions_entries.inc.php may be a better place, but setting the 404-header there seems a bit unclean.
In index.php the html-title is set for existing entries, for non-existing entries a 404-header gets generated. However this does not seem to be the right place to check for the public/private setting on entries.
In /include/genpage.inc.php after
Code: Select all
switch ($serendipity['GET']['action']) {
// User wants to read the diary
case 'read':
if (isset($serendipity['GET']['id'])) {
$entry = array(serendipity_fetchEntry('id', $serendipity['GET']['id']));
if (!is_array($entry) || count($entry) < 1) {
unset($serendipity['GET']['id']);
$entry = array(array());
}
Code: Select all
else if (!is_array($entry[0])) {
$serendipity['head_title'] = htmlspecialchars($serendipity['blogTitle']);
$serendipity['head_subtitle'] = '';
$serendipity['smarty']->assign('head_title', $serendipity['head_title']);
$serendipity['smarty']->assign('head_subtitle', $serendipity['head_subtitle']);
header('HTTP/1.0 404 Not found');
}genpage.inc.php may also not be the best place to do this. The _fetchentry-function in /include/functions_entries.inc.php may be a better place, but setting the 404-header there seems a bit unclean.