Since the latest update to 8.x-5.0-beta3 if i paste an external link and i save without confirming the no result option the link wont take, but if i click the no result option it will change any capitalized letter to lowercase and breaks the link.

how to reproduce

Scenario One:

- use module as usual
- paste in an (external) URL
- directly hit enter while not selecting the upcomming autosuggest
- anchor link will not get applied in the rich text editor

Scenario Two:

- use module as usual
- paste in an (external) URL with lowercase and uppercase characters
- select the autosuggest saying ('Linkit could not find any suggestions. This URL will be used as is.')
- anchor link will be set
- look the the source code of the riche text
- all uppercase characters will be now lowercase

Problem

Using external URLs with uppercase letters (e.g. url shortener) will not work and lead to broken links.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wolfhowling created an issue. See original summary.

anon’s picture

well, you have to select the result in the autocomplete field in order to "set it".

wolfhowling’s picture

yes but when i do that it changes all uppercase to lowercase and that breaks the links i have which are case sensitive.

yobottehg’s picture

We also have the problem that everything is lowercased. I will investigate.

anon’s picture

Does it make sense to select the external link in the list?

The reason for this is that that now there are more then one field that gets populated when selecting a link in the result list and the reason for that is that I don't wanted to have a "self made uri" inserted in the visible field.

If this doesn't make sense for a lot of users, we might change this behavior.

tassilogroeper’s picture

Title: External links not taking » Uppercase and External links not working as expected
Assigned: Unassigned » tassilogroeper
Issue summary: View changes
Priority: Normal » Major
tassilogroeper’s picture

@anon yes this is a big problem for us, since linkit will replace the normal anchor modal for us. It is a great tool - so thanks for that.

- In my patch I actually just removed the uppercase from the default fallback. So uppercase links will work.
- But the Submit on enter will not. (to me, this is not a big problem. Only annoying, though)

Actually, I see a bigger security problem here:
Yes, the label in the autosuggest gets escaped in `src/SuggestionManager.php:55` but the actual path not `src/SuggestionManager.php:58`.
So can you think of a way to escape this? PHP `filter_var` using the url filter will not allow telephone numbers or url without a protocol, for example. http://php.net/manual/en/filter.filters.validate.php#110411

Or do you think this is not a problem, since the rich text gets escaped in the final rendering of the page. But what about the rich text in the backend then? can this be used as an attack vector? I' unsure about this one

anon’s picture

If you mean the text saved in the database I don't see this is a problem. The output is where the sanitation should be.

Or do I misunderstand you?

tassilogroeper’s picture

Assigned: tassilogroeper » Unassigned
tassilogroeper’s picture

Honestly the only attack vector I can think of is:
- after hitting ok in the modal with a url-like JS injected
- the rich text will have this js injected

BUT I just played along with it and was not able to inject it. It was escaped before being injected to the rich text.
It was a gut feeling about the query being directly displayed again. so never mind.

  • anon committed 019d039 on 8.x-5.x authored by tassilogroeper
    Issue #2805239 by tassilogroeper, anon: Uppercase and External links not...
anon’s picture

Status: Active » Fixed

I have committed the patch in #7.

abogomolov’s picture

Status: Fixed » Needs work
FileSize
318 bytes

@anon it's very hard to explain this behavior to the editors. It looks broken. Is it possible to catch the submit even and populate the hidden fields?
Adding the "autoFocus" option can also help.

anon’s picture

Status: Needs work » Fixed

@abogomolov: I agree with you, this might not be the best solution. I would really appreciate some feedback and how we can change this to the better. However, I see this as a new issue. Please, feel free to open a new issue about this.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.