forked from dokufreaks/plugin-include
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "safeindex" feature, prevents indexing of protected included meta…
…data The safeindex feature that is turned on by default prevents the indexer from indexing metadata from included pages that are non-public. This means that for example only links from included pages that are public will be indexed. This affects plugins that add their own metadata to the index in the following ways: * there is no effect when all included pages are public or when no user is logged in when the page is indexed * when the plugin's event handler is called after the include plugin, the plugin will get only metadata from included pages that are public * when the plugin's event handler is called before the include plugin the include plugin will delete the plugin's metadata. I'm happy to add special handlers or exceptions for plugins like the tag plugin (already included) that are affected by this problem. The safeindex feature can be turned off when the ACL rules of all parent pages match the child pages or when information disclosure through metadata like backlinks is no problem.
- Loading branch information
Showing
5 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
class plugin_include_safeindex_test extends DokuWikiTest { | ||
public function setup() { | ||
$this->pluginsEnabled[] = 'include'; | ||
parent::setup(); | ||
} | ||
|
||
public function test_safeindex() { | ||
global $conf; | ||
global $AUTH_ACL; | ||
$conf['superuser'] = 'john'; | ||
$conf['useacl'] = 1; | ||
|
||
$AUTH_ACL = array( | ||
'* @ALL 0', | ||
'* @user 8', | ||
'public @ALL 1', | ||
); | ||
|
||
$_SERVER['REMOTE_USER'] = 'john'; | ||
|
||
saveWikiText('parent', "{{page>child}}\n\n[[public_link]]\n\n{{page>public}}", 'Test parent created'); | ||
saveWikiText('child', "[[foo:private]]", 'Test child created'); | ||
saveWikiText('public', "[[foo:public]]", 'Public page created'); | ||
|
||
idx_addPage('parent'); | ||
idx_addPage('child'); | ||
idx_addPage('public'); | ||
|
||
$this->assertEquals(array('parent', 'public'), ft_backlinks('foo:public')); | ||
$this->assertEquals(array('child'), ft_backlinks('foo:private')); | ||
$this->assertEquals(array('parent'), ft_backlinks('public_link')); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters