Support

Admin Tools

#37924 meta name="generator"

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
Joomla! 3.10.11
PHP version
8
Admin Tools version
latest

Latest post by marvays on Tuesday, 25 October 2022 01:18 CDT

marvays

Hi. I am trying to remove the meta tag generator from the page code. I turned it on in the firewall settings, but it doesn't work. I can't delete it or replace it. Please make it into the next version of admintools please. Just a simple button to delete this tag from the site. Thank you.

https://prnt.sc/EoYOoJ7ntv_6

https://prnt.sc/pgjqHIOjrdmK

For now, I have to hide it with the byebyegenerator plugin.

nicholas
Akeeba Staff
Manager

Can you please check your template? If your template is setting the generator tag during its initialisation or, worse, has a hard-coded generator tag then yes, you will not be able to use Admin Tools because your template is doing something Joomla frowns upon and considers wrong. Admin Tools' feature works when the meta generator tag is set correctly in Joomla's HtmlDocument object.

The ByeByeGenerator plugin is, as far as I know, post-processing the HTML generated by the template using regular expressions to remove the generator tag. This has two problems. One, it is incredibly slow — we are talking about a good 10 milliseconds added to a page response time that's otherwise under 500 milliseconds. The second problem is that this kind of plugin also kicks in when there is no HTML output which can indeed screw up third party modules, plugins, and components. That's why we did not go that way.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

marvays

Good.

That sounds reasonable. how about adding this feature to HtaccessMaker? I would simply check "remove meta tag generator" and HtaccessMaker will add a two line to htaccess

// generator tag removed
$this->setGenerator(null);

 

More info:
https://forum.joomla.org/viewtopic.php?t=798230

nicholas
Akeeba Staff
Manager

It is not a feature for the .htaccess file. The .htaccess file is read by the web server.

The feature to tell Joomla to set a different generator meta tag already exists and you already found it.

Setting the generator to NULL IS NOT ALLOWED; IT IS A BUG WHICH WILL BREAK JOOMLA UNDER NEWER PHP 8 VERSIONS. Ever since Joomla 1.7.0 the setGenerator argument is documented as a string (not string|null). Likewise, the internal _generator property and the getGenerator method of the same \Joomla\CMS\Document\Document class are documented as string. Joomla 5 will increase the minimum PHP version to 8.1 which means that the properties in these objects will eventually become typed and have the correct visibility, i.e. protected string $_generator instead of public $_generator. The methods will also get scalar type hints so it will be public function setGenerator(string $generator): void instead of public function setGenerator($generator). Care to guess what idiotically doing ->setGenerator(null) does? Yeah, it makes Joomla fail with an ErrorException. So of course we are NOT going to do that.

Joomla requires a generator tag. For the reason please refer to \Joomla\CMS\Document\Document::getMetaData.

The correct way to address it is by setting a fake / nondescript generator tag using the feature we already provide. Removing it doesn't protect you any more than using a fake one. The whole point is whether your CMS type can be found from a simple Google search.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

marvays

I apologize for my ignorance.

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!