J3 Issue ?
avatar helgator
helgator
27 Sep 2018

Steps to reproduce the issue

  • back end
  • new menu item of type "external URL"
  • set a link like dokuwiki/doku.php?id=support:start
  • save

Expected result

  • the new menu item gets saved

Actual result

  • error message that the item cant be saved without giving a reason

System information (as much as possible)

  • Joomla 3.8.12

Additional comments

avatar helgator helgator - open - 27 Sep 2018
avatar joomla-cms-bot joomla-cms-bot - labeled - 27 Sep 2018
avatar brianteeman
brianteeman - comment - 27 Sep 2018

I just tried and had no problem

image

avatar helgator
helgator - comment - 27 Sep 2018

Use the exact link I gave in the description, it is a relative link.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22417.

avatar franz-wohlkoenig franz-wohlkoenig - change - 28 Sep 2018
Priority Urgent Medium
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 28 Sep 2018
Category com_menus
avatar infograf768
infograf768 - comment - 28 Sep 2018

I confirm the issue.
When using : in a relative link, $protocol (in that case it is dokuwiki/doku.php?id=support) does not include any of the items accepted in the $scheme array, i.e.

			$scheme   = array(
					'http', 'https', 'ftp', 'ftps', 'gopher', 'mailto',
					'news', 'prospero', 'telnet', 'rlogin', 'tn3270', 'wais',
					'mid', 'cid', 'nntp', 'tel', 'urn', 'ldap', 'file', 'fax',
					'modem', 'git', 'sms',
				);

therefore it throws the warning and returns false

See https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_menus/controllers/item.php#L331-L356

There must be a reason for this code, maybe security.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 28 Sep 2018

There must be a reason for this code, maybe security.

@SniperSister?

avatar SniperSister
SniperSister - comment - 28 Sep 2018

Well, it's a url field, so checking the schema against a list of allowed schemes (that was the code in question does) is a straightforward thing todo in terms of input validation

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 28 Sep 2018

@SniperSister thanks for Comment.

avatar infograf768
infograf768 - comment - 30 Sep 2018

@helgator

As it is quite easy to enter a non-relative url in your specific case, could you please close this Issue? (or can we?)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22417.

avatar franz-wohlkoenig franz-wohlkoenig - change - 30 Sep 2018
Status Discussion Information Required
avatar helgator
helgator - comment - 30 Sep 2018

I know one can enter a non-relative url. But it is highly inconvenient to impossible when you have a ready made Joomla installation for your community that gets of course installed on different domains. These links have to be relative or each user has to look for the external links and customise them. That is error prone for no good reason. Why not fix the problem? After all we are not at M$ here right? :)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22417.

avatar SniperSister
SniperSister - comment - 30 Sep 2018

@helgator make a suggestion how to fix this. Disabling input validation surly isn’t a proper solution, so what would you suggest?

avatar Quy
Quy - comment - 30 Sep 2018

How about checking the scheme only when length of protocol is less than 9?

if (strlen($protocol) < 9 && !in_array($protocol, $scheme))

avatar helgator
helgator - comment - 30 Sep 2018

My suggestion: Why do we need input validation here? It is the admin who is working here.

And if you really want to validate then line 335 should be something like maybe, not sure:

if (strstr($data['link'], '://'))

avatar SniperSister
SniperSister - comment - 1 Oct 2018

My suggestion: Why do we need input validation here? It is the admin who is working here.

Joomla has a configurable ACL System, so it’s possible to give low-privilege users access to the menue manager. So it’s not only “the admin” accessing this form.

Checking for :// isn’t an option either, because the slashes aren’t part of the URL specification and not all protocols require them. Popular example are mailto links.

avatar helgator
helgator - comment - 1 Oct 2018

Okay lets call the users accessing the menu items "privileged". Should those users not be trustworthy users? Why do their inputs need to be validated?

If we think validation is necessary anyway then Im out and the code savy people have to take over.

avatar SniperSister
SniperSister - comment - 1 Oct 2018

Okay lets call the users accessing the menu items "privileged". Should those users not be trustworthy users? Why do their inputs need to be validated?

Because those users aren't trustworthy in all cases, it depends on your specific usecase. For the same reason there's input filtering in com_content article for Administrator-level users. And for the same reason we only allow superadmins to access the extension manager.

If we think validation is necessary anyway then Im out and the code savy people have to take over.

That's the key thing here, it's not a code problem, it's a question of "what is the expected behavior" and weighting security and convenience.

avatar helgator
helgator - comment - 1 Oct 2018

Im sure there is a way to reconcile the two via code.

avatar helgator
helgator - comment - 11 Dec 2018

Any progress in the JLB about this? thx

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 16 Mar 2019

@HLeithner any Comment?

avatar HLeithner
HLeithner - comment - 18 Mar 2019

@helgator does it work if you url encode the string?

dokuwiki/doku.php?id=support%3Astart

avatar joomla-cms-bot joomla-cms-bot - change - 11 May 2019
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2019-05-11 16:33:14
Closed_By joomla-cms-bot
avatar Quy Quy - change - 11 May 2019
Closed_By joomla-cms-bot Quy
avatar joomla-cms-bot joomla-cms-bot - close - 11 May 2019
avatar joomla-cms-bot
joomla-cms-bot - comment - 11 May 2019

Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/22417

avatar Quy
Quy - comment - 11 May 2019

Closing due to no response.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22417.

avatar helgator
helgator - comment - 12 May 2019

Sorry for the late reply. Because I needed a quick solution I made a html override of the menu module and hard coded my link in there. Hence never got a chance to test the url encode approach in production.

avatar infograf768
infograf768 - comment - 12 May 2019

@HLeithner
Your solution works fine.

Add a Comment

Login with GitHub to post a comment