J3 Issue ?
avatar horus68
horus68
11 Mar 2019

Steps to reproduce the issue

The Post install language string on security update for .htacess files includes code for the recommended manual change in the files
See: /administrator/language/en-GB/en-GB.com_cpanel.ini

COM_CPANEL_MSG_ADDNOSNIFF_BODY="<p>Joomla is now shipped with additional security hardenings in the default htaccess.txt and web.config.txt files. These hardenings disable the so called MIME-type sniffing feature in web browsers. The sniffing leads to specific attack vectors, where scripts in normally harmless file formats (eg images) will be executed, leading to Cross-Site-Scripting vulnerabilities.</p><p>The security team recommends to manually apply the necessary changes to existing .htaccess or web.config files, as those files can not be updated automatically.</p><p><strong>Changes for .htaccess</strong><br />Add the following lines before \"## Mod_rewrite in use.\":</p><pre>&lt;IfModule mod_headers.c&gt;\nHeader always set X-Content-Type-Options \"nosniff\"\n&lt;/IfModule&gt;</pre><p><strong>Changes for web.config</strong><br />Add the following lines right after \"&lt;/rewrite&gt;\":</p><pre>&lt;httpProtocol&gt;\n &lt;customHeaders&gt;\n &lt;add name=\"X-Content-Type-Options\" value=\"nosniff\" /&gt;\n &lt;/customHeaders&gt;\n&lt;/httpProtocol&gt;</pre>"

Expected result

Code should not be present in the language string to avoid errors from translators or if it requires an update to the code itself on a future release. There should be the alert but the code to change .htacess should be placed in Joomla docs and a link provided.

Actual result

Actual string:
COM_CPANEL_MSG_ADDNOSNIFF_BODY="<p>Joomla is now shipped with additional security hardenings in the default htaccess.txt and web.config.txt files. These hardenings disable the so called MIME-type sniffing feature in web browsers. The sniffing leads to specific attack vectors, where scripts in normally harmless file formats (eg images) will be executed, leading to Cross-Site-Scripting vulnerabilities.</p><p>The security team recommends to manually apply the necessary changes to existing .htaccess or web.config files, as those files can not be updated automatically.</p><p><strong>Changes for .htaccess</strong><br />Add the following lines before \"## Mod_rewrite in use.\":</p><pre>&lt;IfModule mod_headers.c&gt;\nHeader always set X-Content-Type-Options \"nosniff\"\n&lt;/IfModule&gt;</pre><p><strong>Changes for web.config</strong><br />Add the following lines right after \"&lt;/rewrite&gt;\":</p><pre>&lt;httpProtocol&gt;\n &lt;customHeaders&gt;\n &lt;add name=\"X-Content-Type-Options\" value=\"nosniff\" /&gt;\n &lt;/customHeaders&gt;\n&lt;/httpProtocol&gt;</pre>"

System information (as much as possible)

Joomla stagging

Additional comments

avatar horus68 horus68 - open - 11 Mar 2019
avatar joomla-cms-bot joomla-cms-bot - change - 11 Mar 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 11 Mar 2019
avatar brianteeman
brianteeman - comment - 11 Mar 2019

sorry but if a translator is not able to understand that they should not be translating that code then I seriously wonder if they are knowledgeable enough to successfully translate any part of joomla

avatar franz-wohlkoenig franz-wohlkoenig - change - 11 Mar 2019
Status New Discussion
avatar Bakual
Bakual - comment - 12 Mar 2019

Sorry Brian, but that is not relevant.
One can be a good translator and know that he don't have to translate HTML tags and still make errors on that string. Because the string indeed is quite complex and has a lot of code and escaped special characters in it.
His suggestion was to move part of the string (the .htaccess / webconfig changes) to a documentation page and place a link into the message instead. Doesn't sound like a bad idea to me.

avatar brianteeman
brianteeman - comment - 12 Mar 2019

all the code and escaped characters is in the part not to be translated

avatar ot2sen
ot2sen - comment - 12 Mar 2019

Perhaps replace it with a link to a diff instead. Less to explain, make it visual when its not supposed to be translated anyway.

avatar Bakual
Bakual - comment - 13 Mar 2019

all the code and escaped characters is in the part not to be translated

Yep, and that's why it shouldn't be in the language string, if possible. In a postinstall, we can't use sprintf to insert it (which we would do in all other similar places), so using a link to a doc page (or diff or whatever) would achieve the same.
@brianteeman I don't see why you resist that idea so strongly. What is the issue with having a link instead?

avatar roland-d
roland-d - comment - 13 Mar 2019

As a user, I like that I can just copy-paste the code directly from the message and don't have to follow a link to a page. Perhaps it is just me being lazy :)

Since it is a code fragment, can't it have it's own language string and we combine them in the output with sprintf? You just would not need to translate that particular string.

avatar infograf768
infograf768 - comment - 13 Mar 2019

I have already been looking into this.
The JText::_ is global
https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_postinstall/views/messages/tmpl/default.php#L58

Using a sprintf there would imply defining the variable when necessary (in this case the code snippet).

Only possibility I see would be to add a column in the #__postinstall_messages table where such snippets would be added when necessary.

For 4.0 ?

avatar Bakual
Bakual - comment - 13 Mar 2019

As a user, I like that I can just copy-paste the code directly from the message and don't have to follow a link to a page. Perhaps it is just me being lazy :)

Since you can't directly edit the file in your browser and likely need FTP it's not that easy anyway.
A doc page could even have additional information, nicely formatted code snippets and whatever.

Since it is a code fragment, can't it have it's own language string and we combine them in the output with sprintf? You just would not need to translate that particular string.

To my knowledge, that isn't possible for postinstall messages.

avatar roland-d
roland-d - comment - 13 Mar 2019

and likely need FTP

Let's promote SFTP/SSH :)

avatar franz-wohlkoenig franz-wohlkoenig - change - 22 Mar 2019
Category com_cpanel
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Apr 2019
Labels Added: J3 Issue
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 4 Apr 2019
avatar jwaisner jwaisner - change - 24 Mar 2020
Status Discussion Confirmed
avatar chmst chmst - change - 1 Jan 2021
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2021-01-01 18:39:15
Closed_By chmst
avatar chmst
chmst - comment - 1 Jan 2021

Please test #31822

avatar chmst chmst - close - 1 Jan 2021

Add a Comment

Login with GitHub to post a comment