Skip to content

Commit e6999a9

Browse files
committed
Security: Plugin: Validate plugin name to load its README.md file
1 parent 884d9b3 commit e6999a9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

main/inc/ajax/plugin.ajax.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,16 @@
1313

1414
switch ($action) {
1515
case 'md_to_html':
16-
$plugin = isset($_GET['plugin']) ? $_GET['plugin'] : '';
16+
$plugin = $_GET['plugin'] ?? '';
1717
$appPlugin = new AppPlugin();
18+
19+
$pluginPaths = $appPlugin->read_plugins_from_path();
20+
21+
if (!in_array($plugin, $pluginPaths)) {
22+
echo Display::return_message(get_lang('NotAllowed'), 'error', false);
23+
exit;
24+
}
25+
1826
$pluginInfo = $appPlugin->getPluginInfo($plugin);
1927

2028
$html = '';

0 commit comments

Comments
 (0)