From 31bb24d1dd4349f56323f9b5f4d32fe4ab2b9156 Mon Sep 17 00:00:00 2001 From: Denis Ryabov Date: Sun, 27 Jun 2021 00:27:14 +0300 Subject: [PATCH] add check for allowed extension type (moved here from XMLManifest rules) --- .../com_jedchecker/libraries/rules/xmlinfo.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php b/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php index d8416be..6e5ed6e 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php +++ b/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php @@ -50,6 +50,15 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule */ protected $description = 'COM_JEDCHECKER_INFO_XML_DESC'; + /** + * List of JED extension types + * + * @var string[] + */ + protected $jedTypes = array( + 'component', 'module', 'package', 'plugin' + ); + /** * Mapping of the plugin title prefix to the plugin group * @@ -146,6 +155,12 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule if ($isTopLevel) { + // JED allows components, modules, plugins, and packages (as a container) only + if (!in_array($type, $this->jedTypes, true)) + { + $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_TYPE_NOT_ACCEPTED', $type)); + } + // NM3 - Listing name contains “module” or “plugin” // (and other reserved words) if (preg_match('/\b(?:module|plugin|component|template|extension|free)\b/i', $extensionName, $match))